[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tempel d3f44ccf21: tempel-complete: Add :company-locati
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tempel d3f44ccf21: tempel-complete: Add :company-location metadata |
Date: |
Mon, 23 Jan 2023 03:58:33 -0500 (EST) |
branch: externals/tempel
commit d3f44ccf213d058bb6f28c3895fd1f588e331d5d
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
tempel-complete: Add :company-location metadata
---
tempel.el | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/tempel.el b/tempel.el
index 1b8d82ef30..cbe2417c67 100644
--- a/tempel.el
+++ b/tempel.el
@@ -182,14 +182,17 @@ WIDTH, SEP and ELLIPSIS configure the formatting."
(tempel--print-template elts))
width 0 ?\s ellipsis))))
-(defun tempel--doc-buffer (templates name)
- "Create doc buffer for template NAME given the list of TEMPLATES."
+(defun tempel--info-buffer (templates fun name)
+ "Create info buffer for template NAME.
+FUN inserts the info into the buffer.
+TEMPLATES is the list of templates."
(when-let ((name (intern-soft name))
(elts (cdr (assoc name templates))))
- (with-current-buffer (get-buffer-create " *tempel-doc*")
- (erase-buffer)
- (insert (tempel--print-template elts))
- (current-buffer))))
+ (with-current-buffer (get-buffer-create " *tempel-info*")
+ (setq buffer-read-only t)
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (funcall fun elts)))))
(defun tempel--delete-word (word)
"Delete WORD before point."
@@ -685,7 +688,15 @@ If INTERACTIVE is nil the function acts like a capf."
:exit-function (apply-partially #'tempel--exit templates region)
:company-prefix-length (and tempel-trigger-prefix t)
:company-doc-buffer
- (apply-partially #'tempel--doc-buffer templates)
+ (apply-partially #'tempel--info-buffer templates
+ (lambda (elts)
+ (insert (tempel--print-template elts))
+ (current-buffer)))
+ :company-location
+ (apply-partially #'tempel--info-buffer templates
+ (lambda (elts)
+ (pp elts (current-buffer))
+ (list (current-buffer))))
:annotation-function
(and tempel-complete-annotation
(apply-partially #'tempel--annotate
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/tempel d3f44ccf21: tempel-complete: Add :company-location metadata,
ELPA Syncer <=