Avoid signaling an error in 'describe-symbol'
* lisp/help-fns.el (describe-symbol): Avoid errors when the symbol exists as a function/variable/face/etc., but is undocumented. * test/automated/help-fns.el (help-fns-test-describe-symbol): New test.
This commit is contained in:
parent
855c6e8cdb
commit
7ad01cb68a
2 changed files with 21 additions and 9 deletions
|
@ -1040,15 +1040,17 @@ Will show the info of SYMBOL as a function, variable, and/or face."
|
|||
(let ((inhibit-read-only t)
|
||||
(name (caar docs)) ;Name of doc currently at BOB.
|
||||
(doc (cdr (cadr docs)))) ;Doc to add at BOB.
|
||||
(insert doc)
|
||||
(delete-region (point) (progn (skip-chars-backward " \t\n") (point)))
|
||||
(insert "\n\n"
|
||||
(eval-when-compile
|
||||
(propertize "\n" 'face '(:height 0.1 :inverse-video t)))
|
||||
"\n")
|
||||
(when name
|
||||
(insert (symbol-name symbol)
|
||||
" is also a " name "." "\n\n")))
|
||||
(when doc
|
||||
(insert doc)
|
||||
(delete-region (point)
|
||||
(progn (skip-chars-backward " \t\n") (point)))
|
||||
(insert "\n\n"
|
||||
(eval-when-compile
|
||||
(propertize "\n" 'face '(:height 0.1 :inverse-video t)))
|
||||
"\n")
|
||||
(when name
|
||||
(insert (symbol-name symbol)
|
||||
" is also a " name "." "\n\n"))))
|
||||
(setq docs (cdr docs)))
|
||||
(unless single
|
||||
;; Don't record the `describe-variable' item in the stack.
|
||||
|
|
|
@ -57,4 +57,14 @@
|
|||
(should (search-forward
|
||||
"(defgh\\\\\\[universal-argument\\]b\\`c\\'d\\\\e\\\"f X)"))))
|
||||
|
||||
(ert-deftest help-fns-test-describe-symbol ()
|
||||
"Test the `describe-symbol' function."
|
||||
;; 'describe-symbol' would originally signal an error for
|
||||
;; 'font-lock-comment-face'.
|
||||
(describe-symbol 'font-lock-comment-face)
|
||||
(with-current-buffer "*Help*"
|
||||
(should (> (point-max) 1))
|
||||
(goto-char (point-min))
|
||||
(should (looking-at "^font-lock-comment-face is "))))
|
||||
|
||||
;;; help-fns.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue