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

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

[elpa] externals/corfu bdc5960b53: corfu--in-region, corfu--auto-complet


From: ELPA Syncer
Subject: [elpa] externals/corfu bdc5960b53: corfu--in-region, corfu--auto-complete: Fix gud-gdb completion (Fix #157)
Date: Thu, 21 Apr 2022 16:57:21 -0400 (EDT)

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

    corfu--in-region, corfu--auto-complete: Fix gud-gdb completion (Fix #157)
    
    Copy the start marker returned by the `completion-at-point-function' only 
if is
    not already a marker. This ensures that markers created by the
    `completion-at-point-function' (and in particular its marker type) are kept
    intact. The `gud-gdb-completion-at-point' has a hack which uses an 
insert-before
    marker to hide some side effects of the completion process. It is unclear 
to me
    if always copying the markers is disallowed by the `completion-at-point' 
API. I
    believe the approach used by Corfu was not wrong. But this means then that
    `gud-gdb-completion-at-point' must be improved such that it doesn't rely on 
the
    insert-before hack anymore. The FIXME in `gud-gdb-completion-at-point` also
    hints at that.
---
 corfu.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/corfu.el b/corfu.el
index 2d4d6d8033..84bfc2c46d 100644
--- a/corfu.el
+++ b/corfu.el
@@ -1083,8 +1083,8 @@ See `completion-in-region' for the arguments BEG, END, 
TABLE, PRED."
         (`(,newstr . ,newpt)
          (pcase-let ((`(,base ,candidates ,total . ,_)
                       (corfu--recompute-candidates str pt table pred)))
-           (setq beg (copy-marker beg)
-                 end (copy-marker end t)
+           (unless (markerp beg) (setq beg (copy-marker beg)))
+           (setq end (copy-marker end t)
                  completion-in-region--data (list beg end table pred))
            (unless (equal str newstr)
              (completion--replace beg end (concat newstr)))
@@ -1139,7 +1139,9 @@ See `completion-in-region' for the arguments BEG, END, 
TABLE, PRED."
               (lambda () (eq beg (car-safe (funcall fun)))))
              (completion-extra-properties plist))
          (setq completion-in-region--data
-               (list (copy-marker beg) (copy-marker end t) table
+               (list (if (markerp beg) beg (copy-marker beg))
+                     (copy-marker end t)
+                     table
                      (plist-get plist :predicate)))
          (corfu--setup)
          (corfu--update))))))



reply via email to

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