diff options
| author | Paul Eggert | 2015-06-11 10:23:46 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-06-11 10:24:38 -0700 |
| commit | b2205626370071bc85dc07b043c833bc50c0baec (patch) | |
| tree | 9f317202483e1a28bd75cd4faddb521d708006d2 /test | |
| parent | eda386fc71419a6ec33f2f5fe73d7cb7ce51c028 (diff) | |
| download | emacs-b2205626370071bc85dc07b043c833bc50c0baec.tar.gz emacs-b2205626370071bc85dc07b043c833bc50c0baec.zip | |
Fix quoting of help for functions with odd names
While investigating Bug#20759, I discovered other quoting problems:
C-h f mishandled characters like backslash and quote in function names.
This fix changes the behavior so that 'C-h f pcase RET' now
generates "... (\` QPAT) ..." instead of "... (` QPAT) ...",
because '(format "%S" '(` FOO))' returns "(\\` FOO)". A comment
in src/lread.c's read1 function says that the backslash will be
needed starting in Emacs 25, which implies that 'format' is
correct and the old pcase documention was wrong to omit the backslash.
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/help-fns.el (help-fns--signature):
* lisp/help.el (help-add-fundoc-usage):
* lisp/progmodes/elisp-mode.el (elisp-function-argstring):
Use help--make-usage-docstring rather than formatting
help-make-usage.
* lisp/emacs-lisp/pcase.el (pcase--make-docstring):
Return raw docstring.
* lisp/help-fns.el (help-fns--signature): New arg RAW, to return
raw docstring. Take more care to distinguish raw from cooked dstrings.
(describe-function-1): Let help-fns--signature substitute
command keys.
* lisp/help.el (help--docstring-quote): New function.
(help-split-fundoc): Use it, to quote funny characters more
systematically.
(help--make-usage): Rename from help-make-usage, since this
should be private. Leave an obsolete alias for the old name.
(help--make-usage-docstring): New function.
* test/automated/help-fns.el (help-fns-test-funny-names): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/automated/help-fns.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/automated/help-fns.el b/test/automated/help-fns.el index ba87593f420..4815ac68257 100644 --- a/test/automated/help-fns.el +++ b/test/automated/help-fns.el | |||
| @@ -34,4 +34,27 @@ | |||
| 34 | (goto-char (point-min)) | 34 | (goto-char (point-min)) |
| 35 | (should (search-forward "autoloaded Lisp macro" (line-end-position))))) | 35 | (should (search-forward "autoloaded Lisp macro" (line-end-position))))) |
| 36 | 36 | ||
| 37 | (defun abc\\\[universal-argument\]b\`c\'d\\e\"f (x) | ||
| 38 | "A function with a funny name. | ||
| 39 | |||
| 40 | \(fn XYYZZY)" | ||
| 41 | x) | ||
| 42 | |||
| 43 | (defun defgh\\\[universal-argument\]b\`c\'d\\e\"f (x) | ||
| 44 | "Another function with a funny name." | ||
| 45 | x) | ||
| 46 | |||
| 47 | (ert-deftest help-fns-test-funny-names () | ||
| 48 | "Test for help with functions with funny names." | ||
| 49 | (describe-function 'abc\\\[universal-argument\]b\`c\'d\\e\"f) | ||
| 50 | (with-current-buffer "*Help*" | ||
| 51 | (goto-char (point-min)) | ||
| 52 | (should (search-forward | ||
| 53 | "(abc\\\\\\[universal-argument\\]b\\`c\\'d\\\\e\\\"f XYYZZY)"))) | ||
| 54 | (describe-function 'defgh\\\[universal-argument\]b\`c\'d\\e\"f) | ||
| 55 | (with-current-buffer "*Help*" | ||
| 56 | (goto-char (point-min)) | ||
| 57 | (should (search-forward | ||
| 58 | "(defgh\\\\\\[universal-argument\\]b\\`c\\'d\\\\e\\\"f X)")))) | ||
| 59 | |||
| 37 | ;;; help-fns.el ends here | 60 | ;;; help-fns.el ends here |