]> git.eshelyaron.com Git - emacs.git/commitdiff
Shortdoc: read and evaluate strings after :eval
authorMattias Engdegård <mattiase@acm.org>
Wed, 14 Dec 2022 11:16:28 +0000 (12:16 +0100)
committerMattias Engdegård <mattiase@acm.org>
Wed, 14 Dec 2022 11:16:28 +0000 (12:16 +0100)
* 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.

lisp/emacs-lisp/shortdoc.el

index 83283247150607d25e3a08e564fda3fe549a0618..c6925791d08154b839ec29dd1246444815cfd756 100644 (file)
@@ -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")