[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is that value the original value or did I change it?

From: Stefan Monnier
Subject: Re: is that value the original value or did I change it?
Date: 05 Apr 2002 10:38:03 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

>>>>> "Dan" == Dan Jacobson <address@hidden> writes:
> here's the typical C-h v output,
> bla-bla-bla value is t

> Documentation:
> *If non-nil, offer to bla-bla-bla...

> OK, but wouldn't it be neat for it to tell what its original or
> default value was, along with its current value?  That way one
> wouldn't have to poke around to see if it was one's .emacs that gave
> it the current value... I'm talking about some default value checker,
> not just asking the author to note the default value in the
> documentation.

For customized variables, this information is already available in
the `standard-value' symbol property, so we could do something like the
patch below (Dan, the patch is against the CVS version of the code, which
has changed since Emacs-21.2).

The only problem I see is that I find this `default value' often
uninteresting (typically for variables whose default is "obviously"
nil), but maybe it's just because I'm not a novice any more ;-)


Index: help-fns.el
RCS file: /cvsroot/emacs/emacs/lisp/help-fns.el,v
retrieving revision 1.8
diff -u -u -b -r1.8 help-fns.el
--- help-fns.el 1 Apr 2002 12:31:51 -0000       1.8
+++ help-fns.el 5 Apr 2002 15:32:44 -0000
@@ -359,9 +364,14 @@
                    (pp val)
                    (help-xref-on-pp from (point))
                    (if (< (point) (+ from 20))
-                       (save-excursion
-                         (goto-char from)
-                         (delete-char -1)))))))
+                       (delete-region (1- from) from))
+                   (let ((sv (get variable 'standard-value)))
+                     (when (and (consp sv) (not (equal val sv)))
+                       (princ "\nOriginal value was \n")
+                       (setq from (point))
+                       (pp (car sv))
+                       (if (< (point) (+ from 20))
+                           (delete-region (1- from) from))))))))
            (when (local-variable-p variable)
              (princ (format "Local in buffer %s; " (buffer-name)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]