mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
New variable 'completion-preview-is-calling'
* lisp/completion-preview.el (completion-preview-is-calling): New variable. (completion-preview--capf-wrapper): Bind it to t when calling the CAPF. * etc/NEWS: Announce it.
This commit is contained in:
parent
b54cde9119
commit
a24ff52a79
2 changed files with 17 additions and 1 deletions
5
etc/NEWS
5
etc/NEWS
|
|
@ -4489,6 +4489,11 @@ the minibuffer, instead of waiting with 'sit-for' and then clearing it.
|
||||||
This makes 'minibuffer-message' usable in Lisp programs which want to
|
This makes 'minibuffer-message' usable in Lisp programs which want to
|
||||||
print a message and then continue to perform work.
|
print a message and then continue to perform work.
|
||||||
|
|
||||||
|
---
|
||||||
|
** New variable 'completion-preview-is-calling'.
|
||||||
|
Completion functions (in 'completion-at-point-functions') can check this
|
||||||
|
variable to tell if they are being called by Completion Preview mode.
|
||||||
|
|
||||||
** Special Events
|
** Special Events
|
||||||
|
|
||||||
+++
|
+++
|
||||||
|
|
|
||||||
|
|
@ -523,9 +523,20 @@ candidates or if there are multiple matching completions and
|
||||||
(setq sorted (cdr sorted)))
|
(setq sorted (cdr sorted)))
|
||||||
(list (substring string 0 base) common suffixes))))))
|
(list (substring string 0 base) common suffixes))))))
|
||||||
|
|
||||||
|
(defvar completion-preview-is-calling nil
|
||||||
|
"Non-nil while Completion Preview mode is calling a completion function.
|
||||||
|
|
||||||
|
Completion functions (in `completion-at-point-functions') can check this
|
||||||
|
variable and adjust their behavior for completion preview.
|
||||||
|
For example, a completion function can skip calculating annotations for
|
||||||
|
candidates it produces for display in the completion preview, which does
|
||||||
|
not make use of such annotations.")
|
||||||
|
|
||||||
(defun completion-preview--capf-wrapper (capf)
|
(defun completion-preview--capf-wrapper (capf)
|
||||||
"Translate return value of CAPF to properties for completion preview overlay."
|
"Translate return value of CAPF to properties for completion preview overlay."
|
||||||
(let ((res (ignore-errors (funcall capf))))
|
(let ((res (ignore-errors
|
||||||
|
(let ((completion-preview-is-calling t))
|
||||||
|
(funcall capf)))))
|
||||||
(and (consp res)
|
(and (consp res)
|
||||||
(not (functionp res))
|
(not (functionp res))
|
||||||
(seq-let (beg end table &rest plist) res
|
(seq-let (beg end table &rest plist) res
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue