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

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

[elpa] externals/tempel f1306f100c: tempel-complete: Force completion wi


From: ELPA Syncer
Subject: [elpa] externals/tempel f1306f100c: tempel-complete: Force completion with tempel-trigger-prefix
Date: Wed, 6 Apr 2022 02:57:56 -0400 (EDT)

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

    tempel-complete: Force completion with tempel-trigger-prefix
---
 README.org | 13 +++++++------
 tempel.el  |  5 +++++
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/README.org b/README.org
index f0ef26e110..7450a056f0 100644
--- a/README.org
+++ b/README.org
@@ -73,12 +73,13 @@ on =use-package=.
 
     ;; Setup completion at point
     (defun tempel-setup-capf ()
-      ;; 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.
-      ;; NOTE: We add `tempel-expand' *before* the main programming mode Capf,
-      ;; such that it will be tried first.
+      ;; 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 you
+      ;; should also configure `tempel-trigger-prefix', such that Tempel
+      ;; does not trigger too often when you don't expect it. 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)))
diff --git a/tempel.el b/tempel.el
index 81f068d82c..94c2a9b8f2 100644
--- a/tempel.el
+++ b/tempel.el
@@ -633,6 +633,11 @@ If INTERACTIVE is nil the function acts like a capf."
               :exclusive 'no
               :company-kind (lambda (_) 'snippet)
               :exit-function (apply-partially #'tempel--exit templates region)
+              :company-prefix-length
+              (and tempel-trigger-prefix
+                   (save-excursion
+                     (search-forward tempel-trigger-prefix (cdr bounds) 
'noerror) t)
+                   t)
               :annotation-function
               (and tempel-complete-annotation
                    (apply-partially #'tempel--annotate



reply via email to

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