emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 931d97bf56 1/3: Shortdoc: read and evaluate strings after :eval


From: Mattias Engdegård
Subject: emacs-29 931d97bf56 1/3: Shortdoc: read and evaluate strings after :eval
Date: Wed, 14 Dec 2022 06:27:02 -0500 (EST)

branch: emacs-29
commit 931d97bf56328d8b030f52eef3b9737b46ab7551
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    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.
---
 lisp/emacs-lisp/shortdoc.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index 8328324715..c6925791d0 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")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]