branch: externals/mct commit ab19c21471a2dd68d1d2f613ae65663825930a28 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Streamline check for {pass,block}list --- mct.el | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mct.el b/mct.el index 78bfaebab2..2feeffe931 100644 --- a/mct.el +++ b/mct.el @@ -223,10 +223,20 @@ See `completions-format' for possible values." 'category)))) (defun mct--symbol-in-list (list) - "Test if symbol of command or category is in LIST." + "Test if command or category is in LIST." (or (memq (mct--this-command) list) (memq (mct--completion-category) list))) +(defun mct--passlist-p () + "Return non-nil if symbol is in the `mct-completion-passlist'." + (or (memq (mct--this-command) mct-completion-passlist) + (memq (mct--completion-category) mct-completion-passlist))) + +(defun mct--blocklist-p () + "Return non-nil if symbol is in the `mct-completion-blocklist'." + (or (memq (mct--this-command) mct-completion-blocklist) + (memq (mct--completion-category) mct-completion-blocklist))) + ;;;; Basics of intersection between minibuffer and Completions' buffer (define-obsolete-variable-alias @@ -350,12 +360,12 @@ Meant to be added to `after-change-functions'." "Set up the completions' buffer." (cond ((null mct-live-completion)) - ((mct--symbol-in-list mct-completion-passlist) + ((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--symbol-in-list mct-completion-blocklist)) + ((not (mct--blocklist-p)) (add-hook 'after-change-functions #'mct--live-completions-refresh nil t)))) (defvar-local mct--active nil