]> git.eshelyaron.com Git - emacs.git/commitdiff
(describe-variable): Add phrases about initialization file with and
authorRobert J. Chassell <bob@rattlesnake.com>
Mon, 25 Feb 2008 16:31:25 +0000 (16:31 +0000)
committerRobert J. Chassell <bob@rattlesnake.com>
Mon, 25 Feb 2008 16:31:25 +0000 (16:31 +0000)
without customization; use new button type help-info-variable.

lisp/help-fns.el
lisp/help-mode.el

index d7886215880d3c9f214628a291867e99e7f96891..b5172ec024bca9ede30c4e58218dc79992956440 100644 (file)
@@ -636,8 +636,8 @@ it is displayed along with the global value."
             (terpri)
 
             (let* ((alias (condition-case nil
-                             (indirect-variable variable)
-                           (error variable)))
+                              (indirect-variable variable)
+                            (error variable)))
                    (obsolete (get variable 'byte-obsolete-variable))
                   (safe-var (get variable 'safe-local-variable))
                    (doc (or (documentation-property variable 'variable-documentation)
@@ -676,17 +676,39 @@ it is displayed along with the global value."
              (princ "Documentation:\n")
              (with-current-buffer standard-output
                (insert (or doc "Not documented as a variable."))))
-           ;; Make a link to customize if this variable can be customized.
-           (when (custom-variable-p variable)
-             (let ((customize-label "customize"))
+
+            (let ((customize-label "customize")
+                  (initialization-file "initialization file"))
+              ;; All variables can be set; some can be customized
+              (when (and (symbolp variable) (not (custom-variable-p variable)))
+               (terpri)
+               (terpri)
+               (princ (concat "You can set this variable in your "
+                               initialization-file "."))
+               (with-current-buffer standard-output
+                 (save-excursion
+                    (re-search-backward
+                    (concat "\\(" initialization-file "\\)") nil t)
+                    (help-xref-button 1 'help-info-variable variable
+                                      "(emacs)Init File"))))
+              ;; Make a link to customize if this variable can be customized.
+              (when (custom-variable-p variable)
                (terpri)
                (terpri)
-               (princ (concat "You can " customize-label " this variable."))
+               (princ (concat "You can " customize-label " this variable"))
+               (princ (concat " or set it in your " initialization-file "."))
                (with-current-buffer standard-output
                  (save-excursion
                    (re-search-backward
                     (concat "\\(" customize-label "\\)") nil t)
-                   (help-xref-button 1 'help-customize-variable variable))))
+                   (help-xref-button 1 'help-customize-variable variable))
+                 (save-excursion
+                    (re-search-backward
+                    (concat "\\(" initialization-file "\\)") nil t)
+                    (help-xref-button 1 'help-info-variable variable
+                                      "(emacs)Init File")
+                    )
+                  ))
              ;; Note variable's version or package version
              (let ((output (describe-variable-custom-version-info variable)))
                (when output
index 95ae547f4573d494febec748c1e34863a13e3c08..841ad8e251280c3b5ac8452672a7e1be70d969d6 100644 (file)
@@ -159,6 +159,12 @@ The format is (FUNCTION ARGS...).")
   'help-function #'help-xref-go-forward
   'help-echo (purecopy "mouse-2, RET: move forward to next help buffer"))
 
+(define-button-type 'help-info-variable
+  :supertype 'help-xref
+  ;; the name of the variable is put before the argument to Info
+  'help-function (lambda (a v) (info v))
+  'help-echo (purecopy "mouse-2, RET: read this Info node"))
+
 (define-button-type 'help-info
   :supertype 'help-xref
   'help-function #'info