diff options
| author | Lars Ingebrigtsen | 2016-04-28 15:24:09 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-04-28 15:24:09 +0200 |
| commit | d160f530328fa2872296485b92602435921bd4fd (patch) | |
| tree | e1a84bb0917ec379903289643860f835e5b9c76b | |
| parent | 14508eaa3c0a97e305e8eebae5ce55787eec1e4a (diff) | |
| download | emacs-d160f530328fa2872296485b92602435921bd4fd.tar.gz emacs-d160f530328fa2872296485b92602435921bd4fd.zip | |
Have describe-variable output multi-line values better
* lisp/help-fns.el (describe-variable): When printing
multi-line expressions, display them prettier (bug#10723).
| -rw-r--r-- | lisp/help-fns.el | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index c3a5f26d261..e2cb9f82a1b 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -758,9 +758,8 @@ it is displayed along with the global value." | |||
| 758 | (unless valvoid | 758 | (unless valvoid |
| 759 | (with-current-buffer standard-output | 759 | (with-current-buffer standard-output |
| 760 | (setq val-start-pos (point)) | 760 | (setq val-start-pos (point)) |
| 761 | (princ "value is ") | 761 | (princ "value is") |
| 762 | (let ((from (point)) | 762 | (let ((line-beg (line-beginning-position)) |
| 763 | (line-beg (line-beginning-position)) | ||
| 764 | (print-rep | 763 | (print-rep |
| 765 | (let ((rep | 764 | (let ((rep |
| 766 | (let ((print-quoted t)) | 765 | (let ((print-quoted t)) |
| @@ -769,17 +768,17 @@ it is displayed along with the global value." | |||
| 769 | (format-message "`%s'" rep) | 768 | (format-message "`%s'" rep) |
| 770 | rep)))) | 769 | rep)))) |
| 771 | (if (< (+ (length print-rep) (point) (- line-beg)) 68) | 770 | (if (< (+ (length print-rep) (point) (- line-beg)) 68) |
| 772 | (insert print-rep) | 771 | (insert " " print-rep) |
| 773 | (terpri) | 772 | (terpri) |
| 774 | (pp val) | 773 | (pp val) |
| 775 | (if (< (point) (+ 68 (line-beginning-position 0))) | 774 | ;; Remove trailing newline. |
| 776 | (delete-region from (1+ from)) | 775 | (delete-char -1)) |
| 777 | (delete-region (1- from) from))) | ||
| 778 | (let* ((sv (get variable 'standard-value)) | 776 | (let* ((sv (get variable 'standard-value)) |
| 779 | (origval (and (consp sv) | 777 | (origval (and (consp sv) |
| 780 | (condition-case nil | 778 | (condition-case nil |
| 781 | (eval (car sv)) | 779 | (eval (car sv)) |
| 782 | (error :help-eval-error))))) | 780 | (error :help-eval-error)))) |
| 781 | from) | ||
| 783 | (when (and (consp sv) | 782 | (when (and (consp sv) |
| 784 | (not (equal origval val)) | 783 | (not (equal origval val)) |
| 785 | (not (equal origval :help-eval-error))) | 784 | (not (equal origval :help-eval-error))) |