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

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

[elpa] externals/mct c7412a3 2/2: Add helper function for retrieving cur


From: ELPA Syncer
Subject: [elpa] externals/mct c7412a3 2/2: Add helper function for retrieving current command
Date: Mon, 13 Dec 2021 02:57:28 -0500 (EST)

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

    Add helper function for retrieving current command
    
    This is taken from the feedback I received from Juri Linkov in a
    discussion pertaining to Emacs bug#52389:
    <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=52389>.
---
 mct.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/mct.el b/mct.el
index 603b7e2..e525d9f 100644
--- a/mct.el
+++ b/mct.el
@@ -278,16 +278,20 @@ Meant to be added to `after-change-functions'."
   (when (window-live-p (mct--get-completion-window))
     (mct--live-completions-timer)))
 
+(defun mct--this-command ()
+  "Return this command."
+  (or (bound-and-true-p current-minibuffer-command) this-command))
+
 (defun mct--setup-live-completions ()
   "Set up the completions' buffer."
   (cond
-   ((memq this-command mct-completion-passlist)
+   ((memq (mct--this-command) mct-completion-passlist)
     (setq-local mct-minimum-input 0)
     (setq-local mct-live-update-delay 0)
     (mct--show-completions)
     (add-hook 'after-change-functions #'mct--live-completions nil t))
    ((null mct-live-completion))
-   ((not (memq this-command mct-completion-blocklist))
+   ((not (memq (mct--this-command) mct-completion-blocklist))
     (if (eq mct-live-completion 'visible)
         (add-hook 'after-change-functions 
#'mct--live-completions-visible-timer nil t)
       (add-hook 'after-change-functions #'mct--live-completions-timer nil 
t)))))
@@ -900,7 +904,7 @@ Apply APP while inhibiting modification hooks."
            mct-remove-shadowed-file-names
            (eq (mct--completion-category) 'file)
            rfn-eshadow-overlay (overlay-buffer rfn-eshadow-overlay)
-           (eq this-command 'self-insert-command)
+           (eq (mct--this-command) 'self-insert-command)
            (= saved-point (point-max))
            (or (>= (- (point) (overlay-end rfn-eshadow-overlay)) 2)
                (eq ?/ (char-before (- (point) 2)))))



reply via email to

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