emacs-diffs
[Top][All Lists]
Advanced

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

master 000f13a2bc: Make `apropos-variable' include values in output


From: Lars Ingebrigtsen
Subject: master 000f13a2bc: Make `apropos-variable' include values in output
Date: Tue, 10 May 2022 09:02:11 -0400 (EDT)

branch: master
commit 000f13a2bc60428bf02157956b22ba23570b0725
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make `apropos-variable' include values in output
    
    * lisp/apropos.el (apropos-print): Include variable values in the
    output (bug#13842).
---
 etc/NEWS        |  3 +++
 lisp/apropos.el | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index 212253d3db..13c8aacb2b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -476,6 +476,9 @@ This allows you to enter emoji using short strings, eg 
:face_palm: or
 
 ** Help
 
+---
+*** 'M-x apropos-variable' output now includes values of variables.
+
 +++
 *** New doc string syntax to indicate that symbols shouldn't be links.
 When displaying doc strings in *Help* buffers, strings that are
diff --git a/lisp/apropos.el b/lisp/apropos.el
index 79c4df10d2..28184476e6 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -1247,6 +1247,19 @@ as a heading."
                                 'apropos-user-option
                               'apropos-variable)
                             (not nosubst))
+          ;; Insert an excerpt of variable values.
+          (when (boundp symbol)
+            (insert "  Value: ")
+            (let* ((print-escape-newlines t)
+                   (value (prin1-to-string (symbol-value symbol)))
+                   (truncated (truncate-string-to-width
+                               value (- (window-width) 20) nil nil t)))
+              (insert truncated)
+              (unless (equal value truncated)
+                (buttonize-region (1- (point)) (point)
+                                  (lambda (_)
+                                    (message "Value: %s" value))))
+              (insert "\n")))
          (apropos-print-doc 7 'apropos-group t)
          (apropos-print-doc 6 'apropos-face t)
          (apropos-print-doc 5 'apropos-widget t)



reply via email to

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