diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-05-07 10:21:26 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-05-07 10:21:26 -0400 |
commit | 19d1b9275e7565fb67fd9e0587f08837ba8a3220 (patch) | |
tree | 97d5461fafcd0f8a56754111bc26d991accfca73 /lisp/dabbrev.el | |
parent | 7e97b33aa62c39111f33a94c487f0a174d06346d (diff) | |
download | emacs-19d1b9275e7565fb67fd9e0587f08837ba8a3220.tar.gz |
(dabbrev-completion): Fix bug#45768
Make `dabbrev-completion` go through `completion-at-point` so that
it interacts correctly with Icomplete. Export a new
`completion-capf` function while we're at it, since it can be useful
elsewhere.
* lisp/dabbrev.el (dabbrev-capf): New function,
extracted from `dabbrev-completion`.
(dabbrev-completion): Use it.
Diffstat (limited to 'lisp/dabbrev.el')
-rw-r--r-- | lisp/dabbrev.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el index 06a8ead8340..b04128cf677 100644 --- a/lisp/dabbrev.el +++ b/lisp/dabbrev.el @@ -392,6 +392,14 @@ If the prefix argument is 16 (which comes from \\[universal-argument] \\[univers then it searches *all* buffers." (interactive "*P") (dabbrev--reset-global-variables) + (setq dabbrev--check-other-buffers (and arg t)) + (setq dabbrev--check-all-buffers + (and arg (= (prefix-numeric-value arg) 16))) + (let ((completion-at-point-functions '(dabbrev-capf))) + (completion-at-point))) + +(defun dabbrev-capf () + "Dabbrev completion function for `completion-at-point-functions'." (let* ((abbrev (dabbrev--abbrev-at-point)) (beg (progn (search-backward abbrev) (point))) (end (progn (search-forward abbrev) (point))) @@ -429,10 +437,7 @@ then it searches *all* buffers." (t (mapcar #'downcase completion-list))))))) (complete-with-action a list s p))))) - (setq dabbrev--check-other-buffers (and arg t)) - (setq dabbrev--check-all-buffers - (and arg (= (prefix-numeric-value arg) 16))) - (completion-in-region beg end table))) + (list beg end table))) ;;;###autoload (defun dabbrev-expand (arg) |