From: Eshel Yaron Date: Thu, 7 Dec 2023 10:56:14 +0000 (+0100) Subject: Optionally dim hyphens in 'M-x' completion candidates X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f975722ce65ff707469eba550e39510e7b299dcf;p=emacs.git Optionally dim hyphens in 'M-x' completion candidates * lisp/simple.el (dim-hyphen): New face. (extended-command-dim-hyphens): New user option. (read-extended-command--affixation): Optionally dim hyphens. --- diff --git a/etc/NEWS b/etc/NEWS index c55719416d3..cdfd5b0de55 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1143,6 +1143,10 @@ This minor mode shows you symbol completion suggestions as you type, using an inline preview. New user options in the 'completion-preview' customization group control exactly when Emacs displays this preview. ++++ +*** New user option 'extended-command-dim-hyphens'. +Set this to non-nil to have Emacs dim hyphens in 'M-x' completions. + --- ** The highly accessible Modus themes collection has eight items. The 'modus-operandi' and 'modus-vivendi' are the main themes that have diff --git a/lisp/simple.el b/lisp/simple.el index e0b27658df6..1d2ff92440c 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -256,6 +256,18 @@ all other buffers." :group 'next-error :version "28.1") +(defcustom extended-command-dim-hyphens nil + "Whether to dim hyphens in \\[execute-extended-command] completions." + :type 'boolean + :group 'minibuffer + :version "30.1") + +(defface dim-hyphen + '((t :inherit shadow :weight light)) + "Face for dimming hyphens in \\[execute-extended-command] completions." + :group 'minibuffer + :version "30.1") + (defun next-error-buffer-on-selected-frame (&optional _avoid-current extra-test-inclusive extra-test-exclusive) @@ -2486,6 +2498,11 @@ or (if one of MODES is a minor mode), if it is switched on in BUFFER." (t "")))) (put-text-property 0 (length suffix) 'face 'completions-annotations suffix) + (when extended-command-dim-hyphens + (named-let dim ((hy (string-search "-" command-name))) + (when hy + (add-face-text-property hy (1+ hy) 'dim-hyphen nil command-name) + (dim (string-search "-" command-name (1+ hy)))))) (list command-name "" suffix))) command-names)))