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

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

[elpa] externals/consult f567690 1/2: consult-completion-in-region: Eval


From: ELPA Syncer
Subject: [elpa] externals/consult f567690 1/2: consult-completion-in-region: Evaluate completion table in the original buffer
Date: Tue, 29 Jun 2021 15:57:07 -0400 (EDT)

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

    consult-completion-in-region: Evaluate completion table in the original 
buffer
    
    See https://github.com/minad/vertico/issues/61
---
 consult.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/consult.el b/consult.el
index 878436f..92c2763 100644
--- a/consult.el
+++ b/consult.el
@@ -2665,6 +2665,7 @@ These configuration options are supported:
       (let* ((limit (car (completion-boundaries initial collection predicate 
"")))
              (category (completion-metadata-get metadata 'category))
              (exit-status 'finished)
+             (buffer (current-buffer))
              (completion
               (cond
                ((atom all) nil)
@@ -2694,7 +2695,14 @@ These configuration options are supported:
                            ;; However this is undefined behavior since initial 
does not only contain the
                            ;; directory, but also the filename.
                            (read-file-name prompt initial initial 
require-match nil predicate)
-                         (completing-read prompt collection predicate 
require-match initial)))))))))
+                         (completing-read prompt
+                                          ;; Evaluate completion table in the 
original buffer
+                                          (if (functionp collection)
+                                              (lambda (&rest args)
+                                                (with-current-buffer buffer
+                                                  (apply collection args)))
+                                            collection)
+                                          predicate require-match 
initial)))))))))
         (if completion
             (progn
               (delete-region start end)



reply via email to

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