branch: externals/tempel
commit d6e2ac2f0f7cd6fa26be9a46b61b97bfcbffc7d5
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
add-hook/remove-hook has a serious issue where the hook--depth-alist is not
cleaned up
Stop using hook priorities everywhere until this is fixed.
---
README.org | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/README.org b/README.org
index 856defea64..3827300ceb 100644
--- a/README.org
+++ b/README.org
@@ -65,14 +65,15 @@ on on =use-package=.
;; Setup completion at point
(defun tempel-setup-capf ()
- ;; Add the Tempel Capf to `completion-at-point-functions'.
- ;; The depth is set to -1, such that `tempel-expand' is tried *before*
the
- ;; programming mode Capf. If a template name can be completed it takes
- ;; precedence over the programming mode completion. `tempel-expand' only
- ;; triggers on exact matches. Alternatively use `tempel-complete' if you
- ;; want to see all matches, but then Tempel will probably trigger too
+ ;; Add the Tempel Capf to `completion-at-point-functions'.
`tempel-expand'
+ ;; only triggers on exact matches. Alternatively use `tempel-complete' if
+ ;; you want to see all matches, but then Tempel will probably trigger too
;; often when you don't expect it.
- (add-hook 'completion-at-point-functions #'tempel-expand -1 'local))
+ ;; NOTE: We add `tempel-expand' *before* the main programming mode Capf,
+ ;; such that it will be tried first.
+ (setq-local completion-at-point-functions
+ (cons #'tempel-expand
+ completion-at-point-functions)))
(add-hook 'prog-mode-hook 'tempel-setup-capf)
(add-hook 'text-mode-hook 'tempel-setup-capf)