diff options
| author | John Paul Wallington | 2007-10-20 01:50:38 +0000 |
|---|---|---|
| committer | John Paul Wallington | 2007-10-20 01:50:38 +0000 |
| commit | 05849e2ab9213987e862245a06eec37223ee2c36 (patch) | |
| tree | 4d73c164876632e0742ec367eacec3b6e58bae51 | |
| parent | cc34934141dbd44b4cbf7a110e2bd2e3f92cf422 (diff) | |
| download | emacs-05849e2ab9213987e862245a06eec37223ee2c36.tar.gz emacs-05849e2ab9213987e862245a06eec37223ee2c36.zip | |
(describe-variable-custom-version-info): New function to return
variable's version or package version note.
(describe-variable): Use it, display result.
| -rw-r--r-- | lisp/help-fns.el | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index f62fadc22b5..bf57824dcf0 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -456,6 +456,28 @@ If ANY-SYMBOL is non-nil, don't insist the symbol be bound." | |||
| 456 | (and (or any-symbol (boundp sym)) sym))))) | 456 | (and (or any-symbol (boundp sym)) sym))))) |
| 457 | 0)) | 457 | 0)) |
| 458 | 458 | ||
| 459 | (defun describe-variable-custom-version-info (variable) | ||
| 460 | (let ((custom-version (get variable 'custom-version)) | ||
| 461 | (cpv (get variable 'custom-package-version)) | ||
| 462 | (output nil)) | ||
| 463 | (if custom-version | ||
| 464 | (setq output | ||
| 465 | (format "This variable was introduced, or its default value was changed, in\nversion %s of Emacs.\n" | ||
| 466 | custom-version)) | ||
| 467 | (when cpv | ||
| 468 | (let* ((package (car-safe cpv)) | ||
| 469 | (version (car (cdr-safe cpv))) | ||
| 470 | (pkg-versions (assq package customize-package-emacs-version-alist)) | ||
| 471 | (emacsv (cdr (assoc version pkg-versions)))) | ||
| 472 | (if (and package version) | ||
| 473 | (setq output | ||
| 474 | (format (concat "This variable was introduced, or its default value was changed, in\nversion %s of the %s package" | ||
| 475 | (if emacsv | ||
| 476 | (format " that is part of Emacs %s" emacsv)) | ||
| 477 | ".\n") | ||
| 478 | version package)))))) | ||
| 479 | output)) | ||
| 480 | |||
| 459 | ;;;###autoload | 481 | ;;;###autoload |
| 460 | (defun describe-variable (variable &optional buffer frame) | 482 | (defun describe-variable (variable &optional buffer frame) |
| 461 | "Display the full documentation of VARIABLE (a symbol). | 483 | "Display the full documentation of VARIABLE (a symbol). |
| @@ -646,16 +668,23 @@ it is displayed along with the global value." | |||
| 646 | (with-current-buffer standard-output | 668 | (with-current-buffer standard-output |
| 647 | (insert (or doc "Not documented as a variable.")))) | 669 | (insert (or doc "Not documented as a variable.")))) |
| 648 | ;; Make a link to customize if this variable can be customized. | 670 | ;; Make a link to customize if this variable can be customized. |
| 649 | (if (custom-variable-p variable) | 671 | (when (custom-variable-p variable) |
| 650 | (let ((customize-label "customize")) | 672 | (let ((customize-label "customize")) |
| 673 | (terpri) | ||
| 674 | (terpri) | ||
| 675 | (princ (concat "You can " customize-label " this variable.")) | ||
| 676 | (with-current-buffer standard-output | ||
| 677 | (save-excursion | ||
| 678 | (re-search-backward | ||
| 679 | (concat "\\(" customize-label "\\)") nil t) | ||
| 680 | (help-xref-button 1 'help-customize-variable variable)))) | ||
| 681 | ;; Note variable's version or package version | ||
| 682 | (let ((output (describe-variable-custom-version-info variable))) | ||
| 683 | (when output | ||
| 651 | (terpri) | 684 | (terpri) |
| 652 | (terpri) | 685 | (terpri) |
| 653 | (princ (concat "You can " customize-label " this variable.")) | 686 | (princ output)))) |
| 654 | (with-current-buffer standard-output | 687 | |
| 655 | (save-excursion | ||
| 656 | (re-search-backward | ||
| 657 | (concat "\\(" customize-label "\\)") nil t) | ||
| 658 | (help-xref-button 1 'help-customize-variable variable))))) | ||
| 659 | (print-help-return-message) | 688 | (print-help-return-message) |
| 660 | (save-excursion | 689 | (save-excursion |
| 661 | (set-buffer standard-output) | 690 | (set-buffer standard-output) |