From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.bugs Subject: bug#18992: 24.4; describe-mode Date: Sat, 08 Nov 2014 15:34:03 +0100 Message-ID: <871tpdvk10.fsf@thinkpad-t440p.tsdh.org> References: <545DDF6C.9000901@easy-emacs.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1415457328 7486 80.91.229.3 (8 Nov 2014 14:35:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 8 Nov 2014 14:35:28 +0000 (UTC) Cc: 18992@debbugs.gnu.org To: Andreas =?UTF-8?Q?R=C3=B6hler?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 08 15:35:22 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 1Xn76o-0000d0-19 for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Nov 2014 15:35:22 +0100 Original-Received: from localhost ([::1]:36025 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xn76n-0005jp-Jl for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Nov 2014 09:35:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xn76e-0005je-M4 for bug-gnu-emacs@gnu.org; Sat, 08 Nov 2014 09:35:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xn76W-0007c1-2O for bug-gnu-emacs@gnu.org; Sat, 08 Nov 2014 09:35:12 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xn76V-0007be-Rr for bug-gnu-emacs@gnu.org; Sat, 08 Nov 2014 09:35:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xn76V-0001vM-D4 for bug-gnu-emacs@gnu.org; Sat, 08 Nov 2014 09:35:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tassilo Horn Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Nov 2014 14:35: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.14154572577335 (code B ref 18992); Sat, 08 Nov 2014 14:35:02 +0000 Original-Received: (at 18992) by debbugs.gnu.org; 8 Nov 2014 14:34:17 +0000 Original-Received: from localhost ([127.0.0.1]:53460 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xn75k-0001uE-7I for submit@debbugs.gnu.org; Sat, 08 Nov 2014 09:34:16 -0500 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:52212) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xn75e-0001u1-52 for 18992@debbugs.gnu.org; Sat, 08 Nov 2014 09:34:11 -0500 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B8FF5201EF for <18992@debbugs.gnu.org>; Sat, 8 Nov 2014 09:34:09 -0500 (EST) Original-Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Sat, 08 Nov 2014 09:34:09 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:to:cc:subject:references :date:in-reply-to:message-id:mime-version:content-type :content-transfer-encoding; s=smtpout; bh=ltl3mX/njXL0jXtwxEPQc+ yIEXM=; b=a1MaS/wuK94AxFFnZKHmYcabGBwqg0MBFHcJ6fI4Bk+AqU8O8z2wlF e88ofjwHEQXScqhffdAnMkQ4Roel15BkrjMVlJt/KJYfVVYxQJNFnGx+0mrTGPK2 R6cN0vFlDFcqlCKF/LgWz5jAHnOn6PhnhXvq461NIxhxaj4UMwpsQ= X-Sasl-enc: sTjxuoGxebu+uEdkpw4DomTMOQYrMp3frnmuvjcz1jf6 1415457249 Original-Received: from thinkpad-t440p.tsdh.org (unknown [2.162.187.228]) by mail.messagingengine.com (Postfix) with ESMTPA id F24DC68011E; Sat, 8 Nov 2014 09:34:08 -0500 (EST) In-Reply-To: <545DDF6C.9000901@easy-emacs.de> ("Andreas \=\?utf-8\?Q\?R\=C3\=B6h\?\= \=\?utf-8\?Q\?ler\=22's\?\= message of "Sat, 08 Nov 2014 10:16:28 +0100") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) 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:95713 Andreas R=C3=B6hler 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 prec= ious 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--- =3D=3D=3D 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--- =3D=3D=3D 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 indi= cator): Bye, Tassilo