[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mct a5c4ba3 7/8: Do not affect completions-format globa
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mct a5c4ba3 7/8: Do not affect completions-format global state |
Date: |
Tue, 30 Nov 2021 13:57:26 -0500 (EST) |
branch: externals/mct
commit a5c4ba36da4c146b4a2feece902fc8170961e94e
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Do not affect completions-format global state
Thanks to Daniel Mendler for the contributions that make this possible,
including the following patches:
c77fb3f 2021-11-30 Move mct--clean-completions to mct--setup-completion-list
d0ac8aa 2021-11-30 Avoid setting variables globally, restrict state to the
buffers
6b19465 2021-11-30 Unify completion list setup into a single function
1cee8df 2021-11-30 Rename mct--setup-completions to
mct--setup-live-completions
799041d 2021-11-30 Introduce mct--active variable, use advice for
minibuffer setup
The upside of this change is that mct-completions-format can now be set
with 'setq' without the exception it had before of requiring a restart
of mct-mode.
---
README.org | 3 ---
mct.el | 21 +++++++++------------
2 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/README.org b/README.org
index 55a8a1d..e99fec9 100644
--- a/README.org
+++ b/README.org
@@ -408,9 +408,6 @@ And with more options:
(setq mct-apply-completion-stripes t)
(setq mct-minimum-input 3)
(setq mct-live-update-delay 0.6)
-
-;; NOTE: setting this variable with `setq', requires `mct-mode' to be
-;; reloaded.
(setq mct-completions-format 'one-column)
;; NOTE: `mct-completion-blocklist' can be used for commands with lots
diff --git a/mct.el b/mct.el
index a809366..72623bb 100644
--- a/mct.el
+++ b/mct.el
@@ -169,14 +169,7 @@ and/or the documentation string of `display-buffer'."
(defcustom mct-completions-format 'one-column
"The appearance and sorting used by `mct-mode'.
-See `completions-format' for possible values.
-
-NOTE that setting this option with `setq' requires a restart of
-`mct-mode'."
- :set (lambda (var val)
- (when (bound-and-true-p mct-mode)
- (setq completions-format val))
- (set var val))
+See `completions-format' for possible values."
:type '(choice (const horizontal) (const vertical) (const one-column))
:group 'mct)
@@ -308,6 +301,10 @@ Meant to be added to `after-change-functions'."
(buf (window-buffer win)))
(buffer-local-value 'mct--active buf)))
+(defun mct--display-completion-list-advice (&rest app)
+ (let ((completions-format mct-completions-format))
+ (apply app)))
+
(defun mct--completing-read-advice (&rest app)
(minibuffer-with-setup-hook
(lambda ()
@@ -384,8 +381,7 @@ Meant to be added to `after-change-functions'."
;; We need this to make things work on Emacs 27.
(defun mct--one-column-p ()
"Test if we have a one-column view available."
- (and (eq completions-format 'one-column)
- (eq mct-completions-format 'one-column)
+ (and (eq mct-completions-format 'one-column)
(>= emacs-major-version 28)))
;;;;; Focus minibuffer and/or show completions
@@ -1029,8 +1025,7 @@ region.")
(defun mct--setup-completion-list ()
(when (mct--active-p)
- (setq-local completion-show-help nil
- completions-format mct-completions-format)
+ (setq-local completion-show-help nil)
(mct--setup-clean-completions)
(mct--setup-appearance)
(mct--setup-completion-list-keymap)
@@ -1060,6 +1055,7 @@ region.")
(advice-add #'completing-read-default :around
#'mct--completing-read-advice)
(advice-add #'completing-read-multiple :around
#'mct--completing-read-advice)
(advice-add #'completing-read-multiple :filter-args
#'mct--crm-indicator)
+ (advice-add #'display-completion-list :around
#'mct--display-completion-list-advice)
(advice-add #'minibuffer-message :around #'mct--honor-inhibit-message)
(advice-add #'minibuf-eldef-setup-minibuffer :around
#'mct--stealthily))
(remove-hook 'completion-list-mode-hook #'mct--setup-completion-list)
@@ -1072,6 +1068,7 @@ region.")
(advice-remove #'completing-read-default #'mct--completing-read-advice)
(advice-remove #'completing-read-multiple #'mct--completing-read-advice)
(advice-remove #'completing-read-multiple #'mct--crm-indicator)
+ (advice-remove #'display-completion-list
#'mct--display-completion-list-advice)
(advice-remove #'minibuffer-message #'mct--honor-inhibit-message)
(advice-remove #'minibuf-eldef-setup-minibuffer #'mct--stealthily)))
- [elpa] externals/mct updated (527c437 -> f30dddf), ELPA Syncer, 2021/11/30
- [elpa] externals/mct 1cee8df 2/8: Rename mct--setup-completions to mct--setup-live-completions, ELPA Syncer, 2021/11/30
- [elpa] externals/mct 799041d 1/8: Introduce mct--active variable, use advice for minibuffer setup, ELPA Syncer, 2021/11/30
- [elpa] externals/mct 6b19465 3/8: Unify completion list setup into a single function, ELPA Syncer, 2021/11/30
- [elpa] externals/mct d0ac8aa 4/8: Avoid setting variables globally, restrict state to the buffers, ELPA Syncer, 2021/11/30
- [elpa] externals/mct f30dddf 8/8: Make sure the completions-format stays local, ELPA Syncer, 2021/11/30
- [elpa] externals/mct dea8ed0 6/8: Rename internal functions for consistency, ELPA Syncer, 2021/11/30
- [elpa] externals/mct a5c4ba3 7/8: Do not affect completions-format global state,
ELPA Syncer <=
- [elpa] externals/mct c77fb3f 5/8: Move mct--clean-completions to mct--setup-completion-list, ELPA Syncer, 2021/11/30