summaryrefslogtreecommitdiff
path: root/lisp/help.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-06-12 16:27:42 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2015-06-12 16:28:09 -0700
commit351739ba1446446dd4755aac2406c21a93edf63f (patch)
tree8108cd968dda3b62e1a6247dabfcc9d080436e8c /lisp/help.el
parentd4870a525dcd7dc233a1ed1df676885bad27ee16 (diff)
downloademacs-351739ba1446446dd4755aac2406c21a93edf63f.tar.gz
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).
Diffstat (limited to 'lisp/help.el')
-rw-r--r--lisp/help.el29
1 files changed, 17 insertions, 12 deletions
diff --git a/lisp/help.el b/lisp/help.el
index b766cd0e983..d24fbfd64ec 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)))))
(provide 'help)