emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/tempel 6c288c32a2 80/82: README: Document Capf setup (F


From: ELPA Syncer
Subject: [elpa] externals/tempel 6c288c32a2 80/82: README: Document Capf setup (Fix #14)
Date: Sun, 9 Jan 2022 20:58:47 -0500 (EST)

branch: externals/tempel
commit 6c288c32a2cbbc8233fe86a6fde3a12a827df815
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    README: Document Capf setup (Fix #14)
---
 README.org | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/README.org b/README.org
index 16429e2599..7ac6f76f58 100644
--- a/README.org
+++ b/README.org
@@ -56,6 +56,20 @@ and has to be installed manually with ~package-install-file~.
     :bind (("M-+" . tempel-complete) ;; Alternative tempel-expand
            ("M-*" . tempel-insert))
     :init
+
+    ;; 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
+      ;; often when you don't expect it.
+      (add-hook 'completion-at-point-functions #'tempel-expand -1 'local))
+    (add-hook 'prog-mode-hook 'tempel-setup-capf)
+    (add-hook 'text-mode-hook 'tempel-setup-capf)
+
     ;; Optionally make the Tempel templates available to Abbrev,
     ;; either locally or globally. `expand-abbrev' is bound to C-x '.
     ;; (add-hook 'prog-mode-hook #'tempel-abbrev-mode)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]