unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 20759@debbugs.gnu.org, Dmitry Gutov <dgutov@yandex.ru>
Subject: bug#20759: 25.0.50; pcase doc: (‘ QPAT) instead of (` QPAT)
Date: Fri, 12 Jun 2015 16:34:09 -0700	[thread overview]
Message-ID: <557B6C71.8070507@cs.ucla.edu> (raw)
In-Reply-To: <87eglh6ru4.fsf@web.de>

[-- Attachment #1: Type: text/plain, Size: 328 bytes --]

On 06/12/2015 05:20 AM, Michael Heerdegen wrote:
> Thinking again about this, maybe `PAT would be didactically better, in
> this special case of the pcase doc.

Sure, that's doable.  For consistency, the usage string computed 
automatically by "C-h f `" should be "`STRUCTURE", not "(\` 
STRUCTURE)".  I installed the attached.

[-- Attachment #2: 0001-Document-X-as-X-not-as-X.patch --]
[-- Type: text/x-patch, Size: 2508 bytes --]

From 8f79b74f37e6787d27b69cac14091ec25b03a89e Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri, 12 Jun 2015 16:27:42 -0700
Subject: [PATCH] Document `X as "`X", not as "(` X)"

* lisp/help.el (help-split-fundoc, help--make-usage-docstring):
Document (backquote FOO) as "`FOO", not as "(` FOO)" (Bug#20759).
---
 lisp/help.el | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/lisp/help.el b/lisp/help.el
index b766cd0..d24fbfd 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1368,18 +1368,21 @@ DEF is the function whose usage we're looking for in DOCSTRING."
   ;; In cases where `function' has been fset to a subr we can't search for
   ;; function's name in the doc string so we use `fn' as the anonymous
   ;; function name instead.
-  (when (and docstring (string-match "\n\n(fn\\(\\( .*\\)?)\\)\\'" docstring))
+  (when (and docstring
+	     (string-match "\n\n(fn\\(\\( +\\([^\n ]+\\( .*\\)?\\)?\\)?)\\)\\'"
+			   docstring))
     (let ((doc (unless (zerop (match-beginning 0))
-		 (substring docstring 0 (match-beginning 0))))
-	  (usage-tail (match-string 1 docstring)))
-      (cons (format "(%s%s"
-		    ;; Replace `fn' with the actual function name.
-		    (if (symbolp def)
-			(help--docstring-quote
-			 (substring (format "%S" (list def)) 1 -1))
-		      'anonymous)
-		    usage-tail)
-	    doc))))
+                 (substring docstring 0 (match-beginning 0)))))
+      (cons (if (and (eq def '\`) (match-beginning 3) (not (match-beginning 4)))
+                (concat "\\=`" (match-string 3 docstring))
+              (let ((usage-tail (match-string 1 docstring)))
+                (format "(%s%s"
+                        ;; Replace `fn' with the actual function name.
+                        (if (symbolp def)
+                            (help--docstring-quote (format "%S" def))
+                          'anonymous)
+                        usage-tail)))
+            doc))))
 
 (defun help-add-fundoc-usage (docstring arglist)
   "Add the usage info to DOCSTRING.
@@ -1467,7 +1470,9 @@ the same names as used in the original source code, when possible."
 (define-obsolete-function-alias 'help-make-usage 'help--make-usage "25.1")
 
 (defun help--make-usage-docstring (fn arglist)
-  (help--docstring-quote (format "%S" (help--make-usage fn arglist))))
+  (help--docstring-quote
+   (let ((print-quoted (eq fn '\`)))
+     (format "%S" (help--make-usage fn arglist)))))
 
 \f
 (provide 'help)
-- 
2.1.0



  parent reply	other threads:[~2015-06-12 23:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-07 15:41 bug#20759: 25.0.50; pcase doc: (‘ QPAT) instead of (` QPAT) Michael Heerdegen
2015-06-07 18:14 ` Glenn Morris
2015-06-07 18:18   ` Glenn Morris
2015-06-07 18:41     ` Michael Heerdegen
2015-06-07 20:42 ` Dmitry Gutov
2015-06-11 17:37 ` Paul Eggert
2015-06-12 12:20   ` Michael Heerdegen
2015-06-12 14:05     ` Stefan Monnier
2015-06-12 23:34     ` Paul Eggert [this message]
2015-06-13 14:12       ` Stefan Monnier
2015-06-13 16:36         ` Paul Eggert

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=557B6C71.8070507@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=20759@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=michael_heerdegen@web.de \
    /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).