[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#38601: describe-mode never says the most important thing
From: |
Phil Sainty |
Subject: |
bug#38601: describe-mode never says the most important thing |
Date: |
Mon, 16 Dec 2019 11:32:24 +1300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 16/12/19 11:00 AM, Tomas Nordin wrote:
> Phil Sainty <psainty@orcon.net.nz> writes:
>> (I do think there's an argument for showing the mode symbol rather
>> than a capitalised variant of the name in the `describe-mode' help;
>> but that's a different conversation.)
>
> A different conversation but I didn't see that so I take the
> opportunity to agree here. The capitalized variants of the command
> name was always confusing to me -- is it the command name, only
> with a big letter in the beginning, or is it some sort of doxy
> description that is not the same as the command name. Easy to check,
> but anyway.
For the major mode it's just the `mode-name' value.
For the minor modes it's the symbol name, sans "-minor-mode"/"-mode",
passed through `capitalize': "foo-bar-mode" becomes "Foo-Bar".
This is hard-coded in `describe-mode', which produces the following:
(pp-eval-expression
'(let (minor-modes)
;; Older packages do not register in minor-mode-list but only in
;; minor-mode-alist.
(dolist (x minor-mode-alist)
(setq x (car x))
(unless (memq x minor-mode-list)
(push x minor-mode-list)))
;; Find enabled minor mode we will want to mention.
(dolist (mode minor-mode-list)
;; Document a minor mode if it is listed in minor-mode-alist,
;; non-nil, and has a function definition.
(let ((fmode (or (get mode :minor-mode-function) mode)))
(and (boundp mode) (symbol-value mode)
(fboundp fmode)
(let ((pretty-minor-mode
(if (string-match "\\(\\(-minor\\)?-mode\\)?\\'"
(symbol-name fmode))
(capitalize
(substring (symbol-name fmode)
0 (match-beginning 0)))
fmode)))
(push (list fmode pretty-minor-mode
(format-mode-line
(assq mode minor-mode-alist)))
minor-modes)))))
minor-modes))