]> git.eshelyaron.com Git - emacs.git/commitdiff
(custom-variable-documentation): New function.
authorLuc Teirlinck <teirllm@auburn.edu>
Sat, 19 Jun 2004 16:02:06 +0000 (16:02 +0000)
committerLuc Teirlinck <teirllm@auburn.edu>
Sat, 19 Jun 2004 16:02:06 +0000 (16:02 +0000)
(custom-variable): Use it.

lisp/cus-edit.el

index 5caeb78265e826fb0c341bb7556b04810e5d8dd5..9e0efc5d3d0402f844c7afcdb56a58b14336e9f4 100644 (file)
@@ -2074,11 +2074,25 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
   :group 'custom-buffer
   :version "20.3")
 
+(defun custom-variable-documentation (variable)
+  "Return documentation of VARIABLE for use in Custom buffer.
+Normally just return the docstring.  But if VARIABLE automatically
+becomes buffer local when set, append a message to that effect."
+  (if (and (local-variable-if-set-p variable)
+          (or (not (local-variable-p variable))
+              (with-temp-buffer
+                (local-variable-if-set-p variable))))
+      (concat (documentation-property variable 'variable-documentation)
+             "\n
+This variable automatically becomes buffer-local when set outside Custom.
+However, setting it through Custom sets the default value.")
+    (documentation-property variable 'variable-documentation)))
+
 (define-widget 'custom-variable 'custom
   "Customize variable."
   :format "%v"
   :help-echo "Set or reset this variable."
-  :documentation-property 'variable-documentation
+  :documentation-property #'custom-variable-documentation
   :custom-category 'option
   :custom-state nil
   :custom-menu 'custom-variable-menu-create