From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas =?UTF-8?Q?R=C3=B6hler?= Newsgroups: gmane.emacs.bugs Subject: bug#18992: 24.4; describe-mode Date: Sat, 08 Nov 2014 16:54:38 +0100 Message-ID: <545E3CBE.2080001@easy-emacs.de> References: <545DDF6C.9000901@easy-emacs.de> <871tpdvk10.fsf@thinkpad-t440p.tsdh.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1415462126 15344 80.91.229.3 (8 Nov 2014 15:55:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 8 Nov 2014 15:55:26 +0000 (UTC) Cc: 18992@debbugs.gnu.org To: Tassilo Horn Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 08 16:55:19 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xn8MA-0000x2-DJ for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Nov 2014 16:55:18 +0100 Original-Received: from localhost ([::1]:36172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xn8MA-0003ZR-4x for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Nov 2014 10:55:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xn8M1-0003ZD-J6 for bug-gnu-emacs@gnu.org; Sat, 08 Nov 2014 10:55:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xn8Lv-00084X-A0 for bug-gnu-emacs@gnu.org; Sat, 08 Nov 2014 10:55:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xn8Lv-00084I-5r for bug-gnu-emacs@gnu.org; Sat, 08 Nov 2014 10:55:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xn8Lu-000416-JX for bug-gnu-emacs@gnu.org; Sat, 08 Nov 2014 10:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andreas =?UTF-8?Q?R=C3=B6hler?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Nov 2014 15:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18992 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18992-submit@debbugs.gnu.org id=B18992.141546210015423 (code B ref 18992); Sat, 08 Nov 2014 15:55:02 +0000 Original-Received: (at 18992) by debbugs.gnu.org; 8 Nov 2014 15:55:00 +0000 Original-Received: from localhost ([127.0.0.1]:53824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xn8Ls-00040h-6J for submit@debbugs.gnu.org; Sat, 08 Nov 2014 10:55:00 -0500 Original-Received: from mout.kundenserver.de ([212.227.17.10]:49209) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xn8Ln-00040W-A6 for 18992@debbugs.gnu.org; Sat, 08 Nov 2014 10:54:56 -0500 Original-Received: from [192.168.178.32] (brln-4db93dba.pool.mediaWays.net [77.185.61.186]) by mrelayeu.kundenserver.de (node=mreue101) with ESMTP (Nemesis) id 0MhUQs-1XQdeo1jVa-00MY9E; Sat, 08 Nov 2014 16:54:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.2.0 In-Reply-To: <871tpdvk10.fsf@thinkpad-t440p.tsdh.org> X-Provags-ID: V02:K0:lEzJMdTdWzQfUFzFoA636ktLauoe0MQDG7M7kXsc0vz q8MjxgzmI73AucxPrUpPpi7fV8opSOcgOwhFUBdJdIf1e/d4wi OhueOrc/4ARojAoYw5hSf5XSklag+2h8146C/PgQnPXy0EGkIh frsGsfxzyJuuRV4SayXjYsBKE9AizGIkBC1t276EBdHayruVUC wh2RdoBXdb/6Ebp0bTSI53qft0CfX5DIYFkhy7rXsZY6mv4sMn zEUF6AohgKAjA7MN7CNIY9TkvA62IoTuEuQob4dS+u55COiY19 255mY2BsfTGjLVU5ifdlIYfNzKlw4ZW6bLOBVGOlG3Ra5kVYx0 Duk5X767y+5b7703pCBa9xF9kg4SHJcy4uVHC418M X-UI-Out-Filterresults: notjunk:1; X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:95721 On 08.11.2014 15:34, Tassilo Horn wrote: > Andreas Röhler 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