emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 8afef01: Better fix for documenting `X as "`X"


From: Paul Eggert
Subject: [Emacs-diffs] master 8afef01: Better fix for documenting `X as "`X"
Date: Sat, 13 Jun 2015 16:35:52 +0000

branch: master
commit 8afef016e2bc413c7a4913554ea6ed2c55474de6
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Better fix for documenting `X as "`X"
    
    Fix suggested by Stefan Monnier.
    * lisp/help-fns.el (help-fns--signature):
    Insert "`X", not "(\` X)", when documenting `X (Bug#20759).
    * lisp/help.el (help-split-fundoc, help--make-usage-docstring):
    Don't treat `X specially, as help-fns--signature now handles this.
---
 lisp/help-fns.el |    8 ++++++--
 lisp/help.el     |   28 +++++++++++-----------------
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 931e8af..80f30e8 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -383,9 +383,13 @@ suitable file is found, return nil."
                             (help--docstring-quote
                              (format-kbd-macro real-def))))
                    (t "[Missing arglist.  Please make a bug report.]")))
+             ;; Insert "`X", not "(\` X)", when documenting `X.
+             (use1 (replace-regexp-in-string
+                    "\\`(\\\\=\\\\\\\\=` \\([^\n ]*\\))\\'"
+                    "\\\\=`\\1" use t))
              (high (if raw
-                       (cons use doc)
-                     (help-highlight-arguments (substitute-command-keys use)
+                       (cons use1 doc)
+                     (help-highlight-arguments (substitute-command-keys use1)
                                                (substitute-command-keys 
doc)))))
         (let ((fill-begin (point))
               (high-usage (car high))
diff --git a/lisp/help.el b/lisp/help.el
index d24fbfd..2bf53c0 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1368,21 +1368,17 @@ 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\\(\\( +\\([^\n ]+\\( .*\\)?\\)?\\)?)\\)\\'"
-                          docstring))
+  (when (and docstring (string-match "\n\n(fn\\(\\( .*\\)?)\\)\\'" docstring))
     (let ((doc (unless (zerop (match-beginning 0))
-                 (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))))
+                (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 (format "%S" def))
+                     'anonymous)
+                   usage-tail)
+           doc))))
 
 (defun help-add-fundoc-usage (docstring arglist)
   "Add the usage info to DOCSTRING.
@@ -1470,9 +1466,7 @@ 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
-   (let ((print-quoted (eq fn '\`)))
-     (format "%S" (help--make-usage fn arglist)))))
+  (help--docstring-quote (format "%S" (help--make-usage fn arglist))))
 
 
 (provide 'help)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]