diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2022-12-14 12:16:28 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2022-12-14 12:16:28 +0100 |
commit | 931d97bf56328d8b030f52eef3b9737b46ab7551 (patch) | |
tree | 63b3ff02d2ce33c92d6c2ee31d928a1d5dba1919 /lisp/emacs-lisp | |
parent | be165f7533271b04fddb814c190a2e632f637dc4 (diff) | |
download | emacs-931d97bf56328d8b030f52eef3b9737b46ab7551.tar.gz emacs-931d97bf56328d8b030f52eef3b9737b46ab7551.tar.bz2 emacs-931d97bf56328d8b030f52eef3b9737b46ab7551.zip |
Shortdoc: read and evaluate strings after :eval
* lisp/emacs-lisp/shortdoc.el (shortdoc--display-function):
If the parameter of :eval is a string then read, evaluate and print
the result. This was always the intention and is documented behaviour.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/shortdoc.el | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index 83283247150..c6925791d08 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -1440,14 +1440,16 @@ function's documentation in the Info manual")) do (cl-case type (:eval + (insert " ") (if (stringp value) - (insert " " value "\n") - (insert " ") - (prin1 value (current-buffer)) - (insert "\n") - (insert " " double-arrow " ") - (prin1 (eval value) (current-buffer)) - (insert "\n"))) + (insert value) + (prin1 value (current-buffer))) + (insert "\n " double-arrow " ") + (let ((expr (if (stringp value) + (car (read-from-string value)) + value))) + (prin1 (eval expr) (current-buffer))) + (insert "\n")) (:no-eval* (if (stringp value) (insert " " value "\n") |