emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 2c18969: * lisp/help-fns.el (describe-variable): Us


From: Stefan Monnier
Subject: [Emacs-diffs] master 2c18969: * lisp/help-fns.el (describe-variable): Use cl-print for the value
Date: Thu, 2 Mar 2017 02:13:31 -0500 (EST)

branch: master
commit 2c18969c810f338d73beda592ee5af7103132e97
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/help-fns.el (describe-variable): Use cl-print for the value
    
    Use `pp-buffer' rather than `pp' so as to avoid calling prin1 twice.
---
 lisp/help-fns.el | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 21f76e1..69a6113 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -391,12 +391,12 @@ suitable file is found, return nil."
               ;; If lots of ordinary text characters run this command,
               ;; don't mention them one by one.
               (if (< (length non-modified-keys) 10)
-                  (princ (mapconcat 'key-description keys ", "))
+                  (princ (mapconcat #'key-description keys ", "))
                 (dolist (key non-modified-keys)
                   (setq keys (delq key keys)))
                 (if keys
                     (progn
-                      (princ (mapconcat 'key-description keys ", "))
+                      (princ (mapconcat #'key-description keys ", "))
                       (princ ", and many ordinary text characters"))
                   (princ "many ordinary text characters"))))
             (when (or remapped keys non-modified-keys)
@@ -842,15 +842,22 @@ it is displayed along with the global value."
                (let ((line-beg (line-beginning-position))
                      (print-rep
                       (let ((rep
-                             (let ((print-quoted t))
-                               (prin1-to-string val))))
+                             (let ((print-quoted t)
+                                    (print-circle t))
+                               (cl-prin1-to-string val))))
                         (if (and (symbolp val) (not (booleanp val)))
                             (format-message "`%s'" rep)
                           rep))))
                  (if (< (+ (length print-rep) (point) (- line-beg)) 68)
                      (insert " " print-rep)
                    (terpri)
-                   (pp val)
+                    (let ((buf (current-buffer)))
+                      (with-temp-buffer
+                        (insert print-rep)
+                        (pp-buffer)
+                        (let ((pp-buffer (current-buffer)))
+                          (with-current-buffer buf
+                            (insert-buffer-substring pp-buffer)))))
                     ;; Remove trailing newline.
                     (and (= (char-before) ?\n) (delete-char -1)))
                  (let* ((sv (get variable 'standard-value))



reply via email to

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