]> git.eshelyaron.com Git - completion-preview.git/commitdiff
Only keep the ':exit-function' completion property
authorEshel Yaron <me@eshelyaron.com>
Wed, 1 Nov 2023 21:47:02 +0000 (22:47 +0100)
committerEshel Yaron <me@eshelyaron.com>
Wed, 1 Nov 2023 21:47:02 +0000 (22:47 +0100)
Avoid passing on properties such as ':predicate', whose value may be a
function that assume a certain structure of completion candidate,
which may no longer hold.

* completion-preview.el (completion-preview-show): Only keep the
':exit-function' property.

completion-preview.el

index 9c6b8ea2341876d4165389a29d3795f9995fdf5f..36ffb6ecd7229027e3760a0e150f92f1ad450a9f 100644 (file)
@@ -113,6 +113,7 @@ Compatibility definition for `minibuffer--sort-by-length-alpha'."
     (pcase res
       (`(,_ ,beg ,end ,table . ,plist)
        (let* ((pred (plist-get plist :predicate))
+              (exit-fn (plist-get plist :exit-function))
               (string (buffer-substring beg end))
               (md (completion-metadata string table pred))
               (sort-fn (or (completion-metadata-get md 'cycle-sort-function)
@@ -138,7 +139,7 @@ Compatibility definition for `minibuffer--sort-by-length-alpha'."
                    (setq completion-preview--overlay (make-overlay end end))
                    (overlay-put completion-preview--overlay 'after-string after)
                    (overlay-put completion-preview--overlay 'completion-preview-data
-                                (append (list beg end (list cand)) plist))
+                                (list beg end (list cand) :exit-function exit-fn))
                    (completion-preview-active-mode)))))))))))
 
 (defun completion-preview--post-command ()