diff options
| author | Richard M. Stallman | 1996-11-10 18:52:18 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-11-10 18:52:18 +0000 |
| commit | 9a656d196af1e01fc3f95d5c83d0df69b559c0ce (patch) | |
| tree | 0fbf5bb43ce1d012b14834c1fc0709f25a1b1745 | |
| parent | c34a9d34a6f71cbf209c51f7afca9a6a878cbaec (diff) | |
| download | emacs-9a656d196af1e01fc3f95d5c83d0df69b559c0ce.tar.gz emacs-9a656d196af1e01fc3f95d5c83d0df69b559c0ce.zip | |
(describe-variable): Pretty-print the values.
Put doc string first, if the value is long.
| -rw-r--r-- | lisp/help.el | 70 |
1 files changed, 44 insertions, 26 deletions
diff --git a/lisp/help.el b/lisp/help.el index e775139ddb8..46c0975dd99 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -592,32 +592,50 @@ Returns the documentation as a string, also." | |||
| 592 | (list (if (equal val "") | 592 | (list (if (equal val "") |
| 593 | v (intern val))))) | 593 | v (intern val))))) |
| 594 | (if (symbolp variable) | 594 | (if (symbolp variable) |
| 595 | (with-output-to-temp-buffer "*Help*" | 595 | (let (valvoid) |
| 596 | (prin1 variable) | 596 | (with-output-to-temp-buffer "*Help*" |
| 597 | (if (not (boundp variable)) | 597 | (prin1 variable) |
| 598 | (princ " is void") | 598 | (if (not (boundp variable)) |
| 599 | (princ "'s value is ") | 599 | (progn |
| 600 | (prin1 (symbol-value variable))) | 600 | (princ " is void") |
| 601 | (terpri) | 601 | (terpri) |
| 602 | (if (local-variable-p variable) | 602 | (setq valvoid t)) |
| 603 | (progn | 603 | (princ "'s value is ") |
| 604 | (princ (format "Local in buffer %s; " (buffer-name))) | 604 | (terpri) |
| 605 | (if (not (default-boundp variable)) | 605 | (pp (symbol-value variable)) |
| 606 | (princ "globally void") | 606 | (terpri)) |
| 607 | (princ "global value is ") | 607 | (if (local-variable-p variable) |
| 608 | (prin1 (default-value variable))) | 608 | (progn |
| 609 | (terpri))) | 609 | (princ (format "Local in buffer %s; " (buffer-name))) |
| 610 | (terpri) | 610 | (if (not (default-boundp variable)) |
| 611 | (princ "Documentation:") | 611 | (princ "globally void") |
| 612 | (terpri) | 612 | (princ "global value is ") |
| 613 | (let ((doc (documentation-property variable 'variable-documentation))) | 613 | (terpri) |
| 614 | (princ (or doc "not documented as a variable."))) | 614 | (pp (default-value variable))) |
| 615 | (print-help-return-message) | 615 | (terpri))) |
| 616 | (save-excursion | 616 | (terpri) |
| 617 | (set-buffer standard-output) | 617 | (save-current-buffer |
| 618 | (help-mode) | 618 | (set-buffer standard-output) |
| 619 | ;; Return the text we displayed. | 619 | (if (> (count-lines (point-min) (point-max)) 10) |
| 620 | (buffer-string))) | 620 | (progn |
| 621 | (goto-char (point-min)) | ||
| 622 | (if valvoid | ||
| 623 | (forward-line 1) | ||
| 624 | (forward-sexp 1) | ||
| 625 | (delete-region (point) (progn (end-of-line) (point))) | ||
| 626 | (insert "'s value is shown below.\n\n") | ||
| 627 | (save-excursion | ||
| 628 | (insert "\n\nValue:")))))) | ||
| 629 | (princ "Documentation:") | ||
| 630 | (terpri) | ||
| 631 | (let ((doc (documentation-property variable 'variable-documentation))) | ||
| 632 | (princ (or doc "not documented as a variable."))) | ||
| 633 | (print-help-return-message) | ||
| 634 | (save-excursion | ||
| 635 | (set-buffer standard-output) | ||
| 636 | (help-mode) | ||
| 637 | ;; Return the text we displayed. | ||
| 638 | (buffer-string)))) | ||
| 621 | (message "You did not specify a variable"))) | 639 | (message "You did not specify a variable"))) |
| 622 | 640 | ||
| 623 | (defun where-is (definition) | 641 | (defun where-is (definition) |