diff options
| author | Paul Eggert | 2015-06-13 09:35:10 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-06-13 09:35:46 -0700 |
| commit | 8afef016e2bc413c7a4913554ea6ed2c55474de6 (patch) | |
| tree | dddc5194079a7a04941838ef9ab0626cf30daf90 /lisp/help.el | |
| parent | eb92f89c2125aaf8fdf93cdd85ab46ae278dd950 (diff) | |
| download | emacs-8afef016e2bc413c7a4913554ea6ed2c55474de6.tar.gz emacs-8afef016e2bc413c7a4913554ea6ed2c55474de6.zip | |
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.
Diffstat (limited to 'lisp/help.el')
| -rw-r--r-- | lisp/help.el | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/lisp/help.el b/lisp/help.el index d24fbfd64ec..2bf53c09b05 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." | |||
| 1368 | ;; In cases where `function' has been fset to a subr we can't search for | 1368 | ;; In cases where `function' has been fset to a subr we can't search for |
| 1369 | ;; function's name in the doc string so we use `fn' as the anonymous | 1369 | ;; function's name in the doc string so we use `fn' as the anonymous |
| 1370 | ;; function name instead. | 1370 | ;; function name instead. |
| 1371 | (when (and docstring | 1371 | (when (and docstring (string-match "\n\n(fn\\(\\( .*\\)?)\\)\\'" docstring)) |
| 1372 | (string-match "\n\n(fn\\(\\( +\\([^\n ]+\\( .*\\)?\\)?\\)?)\\)\\'" | ||
| 1373 | docstring)) | ||
| 1374 | (let ((doc (unless (zerop (match-beginning 0)) | 1372 | (let ((doc (unless (zerop (match-beginning 0)) |
| 1375 | (substring docstring 0 (match-beginning 0))))) | 1373 | (substring docstring 0 (match-beginning 0)))) |
| 1376 | (cons (if (and (eq def '\`) (match-beginning 3) (not (match-beginning 4))) | 1374 | (usage-tail (match-string 1 docstring))) |
| 1377 | (concat "\\=`" (match-string 3 docstring)) | 1375 | (cons (format "(%s%s" |
| 1378 | (let ((usage-tail (match-string 1 docstring))) | 1376 | ;; Replace `fn' with the actual function name. |
| 1379 | (format "(%s%s" | 1377 | (if (symbolp def) |
| 1380 | ;; Replace `fn' with the actual function name. | 1378 | (help--docstring-quote (format "%S" def)) |
| 1381 | (if (symbolp def) | 1379 | 'anonymous) |
| 1382 | (help--docstring-quote (format "%S" def)) | 1380 | usage-tail) |
| 1383 | 'anonymous) | 1381 | doc)))) |
| 1384 | usage-tail))) | ||
| 1385 | doc)))) | ||
| 1386 | 1382 | ||
| 1387 | (defun help-add-fundoc-usage (docstring arglist) | 1383 | (defun help-add-fundoc-usage (docstring arglist) |
| 1388 | "Add the usage info to DOCSTRING. | 1384 | "Add the usage info to DOCSTRING. |
| @@ -1470,9 +1466,7 @@ the same names as used in the original source code, when possible." | |||
| 1470 | (define-obsolete-function-alias 'help-make-usage 'help--make-usage "25.1") | 1466 | (define-obsolete-function-alias 'help-make-usage 'help--make-usage "25.1") |
| 1471 | 1467 | ||
| 1472 | (defun help--make-usage-docstring (fn arglist) | 1468 | (defun help--make-usage-docstring (fn arglist) |
| 1473 | (help--docstring-quote | 1469 | (help--docstring-quote (format "%S" (help--make-usage fn arglist)))) |
| 1474 | (let ((print-quoted (eq fn '\`))) | ||
| 1475 | (format "%S" (help--make-usage fn arglist))))) | ||
| 1476 | 1470 | ||
| 1477 | 1471 | ||
| 1478 | (provide 'help) | 1472 | (provide 'help) |