diff options
author | David Morgan <djm_uk@protonmail.com> | 2022-06-10 13:32:37 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2022-06-10 13:32:37 +0100 |
commit | e99cccf552301ea155a2ddce36a861bc556651dc (patch) | |
tree | bc48f90156419d03fa32b5b2bd6460f3040ca407 /.emacs.d/lisp/init-minibuffer.el | |
parent | 80dc64a09db6dfd12c15a30434684d58f896b76f (diff) | |
download | dotfiles-e99cccf552301ea155a2ddce36a861bc556651dc.tar.gz |
Add crm indicator and hide commands in M-x
Diffstat (limited to '.emacs.d/lisp/init-minibuffer.el')
-rw-r--r-- | .emacs.d/lisp/init-minibuffer.el | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el index 056350b..4bfbf37 100644 --- a/.emacs.d/lisp/init-minibuffer.el +++ b/.emacs.d/lisp/init-minibuffer.el @@ -12,7 +12,23 @@ '(read-only t cursor-intangible t face minibuffer-prompt)) (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) (setq enable-recursive-minibuffers t) - (minibuffer-depth-indicate-mode t)) + (minibuffer-depth-indicate-mode t) + + ;; Add prompt indicator to `completing-read-multiple'. + ;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma. + (defun crm-indicator (args) + (cons (format "[CRM%s] %s" + (replace-regexp-in-string + "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" + crm-separator) + (car args)) + (cdr args))) + (advice-add #'completing-read-multiple :filter-args #'crm-indicator) + + ;; Emacs 28: Hide commands in M-x which do not work in the current mode. + ;; Vertico commands are hidden in normal buffers. + (setq read-extended-command-predicate + #'command-completion-default-include-p)) (use-package vertico :init |