]> git.eshelyaron.com Git - emacs.git/commitdiff
Have describe-variable output multi-line values better
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 28 Apr 2016 13:24:09 +0000 (15:24 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 28 Apr 2016 13:24:09 +0000 (15:24 +0200)
* lisp/help-fns.el (describe-variable): When printing
multi-line expressions, display them prettier (bug#10723).

lisp/help-fns.el

index c3a5f26d261a274f82632ed24b15b1a4fcbc3c57..e2cb9f82a1bba31d2c171b89fd27e92008e14697 100644 (file)
@@ -758,9 +758,8 @@ it is displayed along with the global value."
            (unless valvoid
              (with-current-buffer standard-output
                (setq val-start-pos (point))
-               (princ "value is ")
-               (let ((from (point))
-                     (line-beg (line-beginning-position))
+               (princ "value is")
+               (let ((line-beg (line-beginning-position))
                      (print-rep
                       (let ((rep
                              (let ((print-quoted t))
@@ -769,17 +768,17 @@ it is displayed along with the global value."
                             (format-message "`%s'" rep)
                           rep))))
                  (if (< (+ (length print-rep) (point) (- line-beg)) 68)
-                     (insert print-rep)
+                     (insert " " print-rep)
                    (terpri)
                    (pp val)
-                   (if (< (point) (+ 68 (line-beginning-position 0)))
-                       (delete-region from (1+ from))
-                     (delete-region (1- from) from)))
+                    ;; Remove trailing newline.
+                    (delete-char -1))
                  (let* ((sv (get variable 'standard-value))
                         (origval (and (consp sv)
                                       (condition-case nil
                                           (eval (car sv))
-                                        (error :help-eval-error)))))
+                                        (error :help-eval-error))))
+                         from)
                    (when (and (consp sv)
                                (not (equal origval val))
                                (not (equal origval :help-eval-error)))