]> git.eshelyaron.com Git - emacs.git/commitdiff
Make `apropos-variable' include values in output
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 10 May 2022 13:01:00 +0000 (15:01 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 10 May 2022 13:02:04 +0000 (15:02 +0200)
* lisp/apropos.el (apropos-print): Include variable values in the
output (bug#13842).

etc/NEWS
lisp/apropos.el

index 212253d3dbf0222ca8072d48bfe748ac78e7d252..13c8aacb2b7d41d5e7c75e071196b41e3e94302f 100644 (file)
--- 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
index 79c4df10d25a6e607d3990593e6e5a1b6794b30b..28184476e688adc71c04937fea4aee0874c6faf8 100644 (file)
@@ -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)