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

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

[elpa] externals/mct 6e1d5dc834: Fix passlist setup


From: ELPA Syncer
Subject: [elpa] externals/mct 6e1d5dc834: Fix passlist setup
Date: Fri, 25 Feb 2022 12:57:36 -0500 (EST)

branch: externals/mct
commit 6e1d5dc83455460bcd525535e09f925f1eac451d
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Fix passlist setup
    
    Thanks to Morgan Willcock for the feedback in issue 24:
    <https://gitlab.com/protesilaos/mct/-/issues/24>.
---
 README.org |  5 +++--
 mct.el     | 28 +++++++++++++++++++++++-----
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/README.org b/README.org
index 9fb38ebbea..43a0273b74 100644
--- a/README.org
+++ b/README.org
@@ -1537,8 +1537,9 @@ MCT is meant to be a collective effort.  Every bit of 
help matters.
 
 + Ideas and user feedback :: Andrew Tropin, Benjamin (@zealotrush), Case
   Duckworth, Chris Burroughs, Jonathan Irving, José Antonio Ortega Ruiz,
-  Kostadin Ninev, Manuel Uberti, Philip Kaludercic, Theodor Thornhill,
-  Tomasz Hołubowicz, Z.Du.  As well as users: danrobi11.
+  Kostadin Ninev, Manuel Uberti, Morgan Willcock, Philip Kaludercic,
+  Theodor Thornhill, Tomasz Hołubowicz, Z.Du.  As well as users:
+  danrobi11.
 
 + Packaging :: Andrew Tropin and Nicolas Goaziou (Guix).
 
diff --git a/mct.el b/mct.el
index ef044cbf0a..b7eba90d16 100644
--- a/mct.el
+++ b/mct.el
@@ -419,14 +419,30 @@ Meant to be added to `after-change-functions'."
   "Set up the completions' buffer."
   (cond
    ((null mct-live-completion))
-   ((mct--passlist-p)
-    (setq-local mct-minimum-input 0)
-    (setq-local mct-live-update-delay 0)
-    (mct--show-completions)
-    (add-hook 'after-change-functions #'mct--live-completions-refresh nil t))
+   ;; ;; NOTE 2022-02-25: The passlist setup we had here was being
+   ;; ;; called too early in `mct--completing-read-advice'.  It would
+   ;; ;; fail to filter out the current candidate from the list
+   ;; ;; (e.g. current buffer from `switch-to-buffer').  This would, in
+   ;; ;; turn, hinder the scrolling behaviour of `minibuffer-complete'.
+   ;; ;; See: <https://gitlab.com/protesilaos/mct/-/issues/24>.  The
+   ;; ;; replacement function is `mct--setup-passlist' which is hooked
+   ;; ;; directly to `minibuffer-setup-hook'.
+   ;;
+   ;; ((mct--passlist-p)
+   ;;  (setq-local mct-minimum-input 0)
+   ;;  (setq-local mct-live-update-delay 0)
+   ;;  (mct--show-completions)
+   ;;  (add-hook 'after-change-functions #'mct--live-completions-refresh nil 
t))
    ((not (mct--blocklist-p))
     (add-hook 'after-change-functions #'mct--live-completions-refresh nil t))))
 
+(defun mct--setup-passlist ()
+  "Set up the minibuffer for `mct-completion-passlist'."
+  (when (and (mct--passlist-p) (mct--minibuffer-p))
+    (setq-local mct-minimum-input 0)
+    (setq-local mct-live-update-delay 0)
+    (mct--show-completions)))
+
 (defvar-local mct--active nil
   "Minibuffer local variable, t if Mct is active.")
 
@@ -1207,11 +1223,13 @@ region.")
   (if mct-minibuffer-mode
       (progn
         (add-hook 'completion-list-mode-hook #'mct--setup-completion-list)
+        (add-hook 'minibuffer-setup-hook #'mct--setup-passlist)
         (advice-add #'completing-read-default :around 
#'mct--completing-read-advice)
         (advice-add #'completing-read-multiple :around 
#'mct--completing-read-advice)
         (advice-add #'minibuffer-completion-help :around 
#'mct--minibuffer-completion-help-advice)
         (advice-add #'minibuf-eldef-setup-minibuffer :around 
#'mct--stealthily))
     (remove-hook 'completion-list-mode-hook #'mct--setup-completion-list)
+    (remove-hook 'minibuffer-setup-hook #'mct--setup-passlist)
     (advice-remove #'completing-read-default #'mct--completing-read-advice)
     (advice-remove #'completing-read-multiple #'mct--completing-read-advice)
     (advice-remove #'minibuffer-completion-help 
#'mct--minibuffer-completion-help-advice)



reply via email to

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