unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: 38222@debbugs.gnu.org
Subject: bug#38222: describe-mode shows (fn...)
Date: Fri, 15 Nov 2019 19:32:57 +0100	[thread overview]
Message-ID: <CAAeL0STKDV0nUMo536zbPLqCr=4KHeLvB5w8v6xdWFE=7UK94Q@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 255 bytes --]

Package: emacs
Severity: minor
Tags: patch

Currently, the output of `describe-mode' includes the (fn...) calling
convention specifiers from the docstrings of major and minor modes.

Assuming that's not intended, here's a patch to fix it.

OK to install?

[-- Attachment #1.2: Type: text/html, Size: 396 bytes --]

[-- Attachment #2: 0001-Strip-fn.-from-output-of-describe-mode.patch --]
[-- Type: application/octet-stream, Size: 1562 bytes --]

From eda6eeadb99f0b1ccfaa251ec9f7d510b5b8121a Mon Sep 17 00:00:00 2001
From: Juanma Barranquero <lekktu@gmail.com>
Date: Fri, 15 Nov 2019 19:21:48 +0100
Subject: [PATCH] Strip "(fn...)" from output of `describe-mode'

* lisp/help.el (help--doc-w/o-fn): New function.
(describe-mode): Use it.
---
 lisp/help.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/help.el b/lisp/help.el
index 3b3d1f977e..2286e4ff93 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -878,6 +878,10 @@ describe-key
             (princ ", which is ")
 	    (describe-function-1 defn)))))))
 \f
+(defun help--doc-w/o-fn (mode)
+  ;; Remove the (fn...) thingy at the end of the docstring
+  (replace-regexp-in-string "\n\n(fn[^)]*?)\\'" "" (documentation mode)))
+
 (defun describe-mode (&optional buffer)
   "Display documentation of current major mode and minor modes.
 A brief summary of the minor modes comes first, followed by the
@@ -951,7 +955,7 @@ describe-mode
 				     "no indicator"
 				   (format "indicator%s"
 					   indicator))))
-		  (princ (documentation mode-function)))
+		  (princ (help--doc-w/o-fn mode-function)))
 		(insert-button pretty-minor-mode
 			       'action (car help-button-cache)
 			       'follow-link t
@@ -981,7 +985,7 @@ describe-mode
                                     nil t)
 		(help-xref-button 1 'help-function-def mode file-name)))))
 	(princ ":\n")
-	(princ (documentation major-mode)))))
+	(princ (help--doc-w/o-fn major-mode)))))
   ;; For the sake of IELM and maybe others
   nil)
 
-- 
2.23.0.windows.1


             reply	other threads:[~2019-11-15 18:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15 18:32 Juanma Barranquero [this message]
2019-11-16  5:14 ` bug#38222: describe-mode shows (fn...) Lars Ingebrigtsen
2019-11-16  5:20   ` Juanma Barranquero
2019-11-19 10:20     ` Juanma Barranquero

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAAeL0STKDV0nUMo536zbPLqCr=4KHeLvB5w8v6xdWFE=7UK94Q@mail.gmail.com' \
    --to=lekktu@gmail.com \
    --cc=38222@debbugs.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).