comparison lisp/help-fns.el @ 92211:a1afa11e3c51

(describe-variable): Add phrases about initialization file with and without customization; use new button type help-info-variable.
author Robert J. Chassell <bob@rattlesnake.com>
date Mon, 25 Feb 2008 16:31:25 +0000
parents bfe257ff864c
children 49a2376794b9
comparison
equal deleted inserted replaced
92210:692687f5f1ca 92211:a1afa11e3c51
634 'help-echo "mouse-2, RET: show value") 634 'help-echo "mouse-2, RET: show value")
635 (insert ".\n"))) 635 (insert ".\n")))
636 (terpri) 636 (terpri)
637 637
638 (let* ((alias (condition-case nil 638 (let* ((alias (condition-case nil
639 (indirect-variable variable) 639 (indirect-variable variable)
640 (error variable))) 640 (error variable)))
641 (obsolete (get variable 'byte-obsolete-variable)) 641 (obsolete (get variable 'byte-obsolete-variable))
642 (safe-var (get variable 'safe-local-variable)) 642 (safe-var (get variable 'safe-local-variable))
643 (doc (or (documentation-property variable 'variable-documentation) 643 (doc (or (documentation-property variable 'variable-documentation)
644 (documentation-property alias 'variable-documentation))) 644 (documentation-property alias 'variable-documentation)))
645 (extra-line nil)) 645 (extra-line nil))
674 674
675 (if extra-line (terpri)) 675 (if extra-line (terpri))
676 (princ "Documentation:\n") 676 (princ "Documentation:\n")
677 (with-current-buffer standard-output 677 (with-current-buffer standard-output
678 (insert (or doc "Not documented as a variable.")))) 678 (insert (or doc "Not documented as a variable."))))
679 ;; Make a link to customize if this variable can be customized. 679
680 (when (custom-variable-p variable) 680 (let ((customize-label "customize")
681 (let ((customize-label "customize")) 681 (initialization-file "initialization file"))
682 ;; All variables can be set; some can be customized
683 (when (and (symbolp variable) (not (custom-variable-p variable)))
682 (terpri) 684 (terpri)
683 (terpri) 685 (terpri)
684 (princ (concat "You can " customize-label " this variable.")) 686 (princ (concat "You can set this variable in your "
687 initialization-file "."))
688 (with-current-buffer standard-output
689 (save-excursion
690 (re-search-backward
691 (concat "\\(" initialization-file "\\)") nil t)
692 (help-xref-button 1 'help-info-variable variable
693 "(emacs)Init File"))))
694 ;; Make a link to customize if this variable can be customized.
695 (when (custom-variable-p variable)
696 (terpri)
697 (terpri)
698 (princ (concat "You can " customize-label " this variable"))
699 (princ (concat " or set it in your " initialization-file "."))
685 (with-current-buffer standard-output 700 (with-current-buffer standard-output
686 (save-excursion 701 (save-excursion
687 (re-search-backward 702 (re-search-backward
688 (concat "\\(" customize-label "\\)") nil t) 703 (concat "\\(" customize-label "\\)") nil t)
689 (help-xref-button 1 'help-customize-variable variable)))) 704 (help-xref-button 1 'help-customize-variable variable))
705 (save-excursion
706 (re-search-backward
707 (concat "\\(" initialization-file "\\)") nil t)
708 (help-xref-button 1 'help-info-variable variable
709 "(emacs)Init File")
710 )
711 ))
690 ;; Note variable's version or package version 712 ;; Note variable's version or package version
691 (let ((output (describe-variable-custom-version-info variable))) 713 (let ((output (describe-variable-custom-version-info variable)))
692 (when output 714 (when output
693 (terpri) 715 (terpri)
694 (terpri) 716 (terpri)