all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: Tassilo Horn <tsdh@gnu.org>
Cc: 18992@debbugs.gnu.org
Subject: bug#18992: 24.4; describe-mode
Date: Sat, 08 Nov 2014 16:54:38 +0100	[thread overview]
Message-ID: <545E3CBE.2080001@easy-emacs.de> (raw)
In-Reply-To: <871tpdvk10.fsf@thinkpad-t440p.tsdh.org>

On 08.11.2014 15:34, Tassilo Horn wrote:
> Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
>
>> M-x describe-mode RET should report the major-mode.
>> Currently it tells the value of "mode-name".
>>
>> Several issues with this:
>>
>> - Value of mode-name is displayed in current-buffers mode-line allready
>
> I guess the main usage of `describe-mode' is to get its documentation
> and key bindings.
>
>> - mode-name often will be a quit shortened, as space in mode-line is precious
>
> Usually it's just the capitalized version of the major-mode function
> with the `-mode' stripped.  And sometimes it contains more information
> that just the mode function, e.g., "Dired by name", "Dired by date",
> etc.
>
>> - don't see a usage of mode-name beyond mode-line
>
> The other important usage is printing the pretty name with
> describe-mode. ;-)
>
>> - user will be interested in value of major-mode, which isn't told
>
> describe-mode prints a link you can click to jump to the major-mode
> function.
>
>> See for example from inside a M-x shell RET
>>
>> M-x describe-mode says: "Shell mode"
>> while the real major-mode is sh-mode
>
> No, the real mode function is `shell-mode'.  `sh-mode' is the editing
> mode for shell scripts, and that has mode-names like "Shell-script[zsh]"
> or "Shell-script[bash]" which are even more informative than just the
> plain mode function.
>
> Well, but of course having the mode functions printed in `describe-mode'
> wouldn't hurt anyway.  This patch does that:
>
> --8<---------------cut here---------------start------------->8---
> === modified file 'lisp/help.el'
> --- lisp/help.el	2014-08-07 03:25:09 +0000
> +++ lisp/help.el	2014-11-08 14:27:54 +0000
> @@ -946,7 +946,8 @@
>               (let ((start (point)))
>                 (insert (format-mode-line mode nil nil buffer))
>                 (add-text-properties start (point) '(face bold)))))
> -	(princ " mode")
> +	(princ " mode ")
> +	(princ (format "(`%s')" major-mode))
>   	(let* ((mode major-mode)
>   	       (file-name (find-lisp-object-file-name mode nil)))
>   	  (when file-name
> --8<---------------cut here---------------end--------------->8---
>
> With that, in this message buffer I get:
>
> --8<---------------cut here---------------start------------->8---
> Message mode (`message-mode') defined in `message.el':
> Major mode for editing mail and news to be sent.
> Like Text Mode but with these additional commands:
> ...
> --8<---------------cut here---------------end--------------->8---
>
> With the following patch, the same would be done for the active minor
> modes, too:
>
> --8<---------------cut here---------------start------------->8---
> === modified file 'lisp/help.el'
> --- lisp/help.el	2014-08-07 03:25:09 +0000
> +++ lisp/help.el	2014-11-08 14:31:30 +0000
> @@ -924,7 +924,8 @@
>   		  (push (point-marker) help-button-cache)
>   		  ;; Document the minor modes fully.
>   		  (insert pretty-minor-mode)
> -		  (princ (format " minor mode (%s):\n"
> +		  (princ (format " minor mode (`%s'; %s):\n"
> +				 mode-function
>   				 (if (zerop (length indicator))
>   				     "no indicator"
>   				   (format "indicator%s"
> @@ -946,7 +947,8 @@
>               (let ((start (point)))
>                 (insert (format-mode-line mode nil nil buffer))
>                 (add-text-properties start (point) '(face bold)))))
> -	(princ " mode")
> +	(princ " mode ")
> +	(princ (format "(`%s')" major-mode))
>   	(let* ((mode major-mode)
>   	       (file-name (find-lisp-object-file-name mode nil)))
>   	  (when file-name
> --8<---------------cut here---------------end--------------->8---
>
> However, in contrast to major-modes, minor mode names tend to be much
> longer, so we can get some long lines like:
>
> Global-Edit-Server-Edit minor mode (`global-edit-server-edit-mode'; no indicator):
>
> Bye,
> Tassilo
>

What about mentioning the variable at stake, i.e. "major-mode: " resp. "minor-mode: " in format-function?
As said, repeating the rather arbitrary mode-line string doesn't contribute, is confusing.

Thanks,

Andreas





  reply	other threads:[~2014-11-08 15:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-08  9:16 bug#18992: 24.4; describe-mode Andreas Röhler
2014-11-08 14:34 ` Tassilo Horn
2014-11-08 15:54   ` Andreas Röhler [this message]
2014-11-08 16:35     ` Drew Adams
2014-11-08 15:57   ` Drew Adams
2014-11-08 16:42     ` Drew Adams
2019-12-05 11:35   ` Stefan Kangas
2020-01-15  2:01     ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=545E3CBE.2080001@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --cc=18992@debbugs.gnu.org \
    --cc=tsdh@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.