[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Documentation not clear for the Lisp function set-variable
From: |
Juanma Barranquero |
Subject: |
Re: Documentation not clear for the Lisp function set-variable |
Date: |
Tue, 28 Jun 2005 11:26:28 +0200 |
> The patch below modifies `user-variable-p' [etc, etc.]
That would be more convincing if I really attached the patch...
(BTW, the patch uses diff -b because most of user-visible-p is now
inside a while loop, but otherwise unchanged.)
--
/L/e/k/t/u
Index: src/eval.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/eval.c,v
retrieving revision 1.246
diff -b -c -2 -r1.246 eval.c
*** src/eval.c 28 Jun 2005 02:27:38 -0000 1.246
--- src/eval.c 28 Jun 2005 08:34:08 -0000
***************
*** 890,899 ****
}
DEFUN ("user-variable-p", Fuser_variable_p, Suser_variable_p, 1, 1, 0,
! doc: /* Returns t if VARIABLE is intended to be set and
modified by users.
\(The alternative is a variable used internally in a Lisp program.)
! Determined by whether the first character of the documentation
! for the variable is `*' or if the variable is customizable (has a non-nil
! value of `standard-value' or of `custom-autoload' on its property list). */)
(variable)
Lisp_Object variable;
--- 890,911 ----
}
+ /* Error handler used in Fuser_variable_p. */
+ static Lisp_Object
+ user_variable_p_eh (ignore)
+ Lisp_Object ignore;
+ {
+ return Qnil;
+ }
+
DEFUN ("user-variable-p", Fuser_variable_p, Suser_variable_p, 1, 1, 0,
! doc: /* Return t if VARIABLE is intended to be set and
modified by users.
\(The alternative is a variable used internally in a Lisp program.)
! A variable is a user variable if
! \(1) the first character of its documentation is `*', or
! \(2) it is customizable (its property list contains a non-nil value
! of `standard-value' or `custom-autoload'), or
! \(3) it is an alias for another user variable.
! Return nil if VARIABLE is an alias and there is a loop in the
! chain of symbols. */)
(variable)
Lisp_Object variable;
***************
*** 904,907 ****
--- 916,927 ----
return Qnil;
+ /* If indirect and there's an alias loop, don't check anything else. */
+ if (XSYMBOL (variable)->indirect_variable
+ && NILP (internal_condition_case_1 (indirect_variable, variable,
+ Qt, user_variable_p_eh)))
+ return Qnil;
+
+ while (1)
+ {
documentation = Fget (variable, Qvariable_documentation);
if (INTEGERP (documentation) && XINT (documentation) < 0)
***************
*** 920,924 ****
--- 940,950 ----
|| (!NILP (Fget (variable, intern ("custom-autoload")))))
return Qt;
+
+ if (!XSYMBOL (variable)->indirect_variable)
return Qnil;
+
+ /* An indirect variable? Let's follow the chain. */
+ variable = XSYMBOL (variable)->value;
+ }
}
- Re: Documentation not clear for the Lisp function set-variable, (continued)
- Re: Documentation not clear for the Lisp function set-variable, Eli Zaretskii, 2005/06/27
- Re: Documentation not clear for the Lisp function set-variable, Luc Teirlinck, 2005/06/27
- Re: Documentation not clear for the Lisp function set-variable, Juanma Barranquero, 2005/06/27
- Re: Documentation not clear for the Lisp function set-variable, Eli Zaretskii, 2005/06/27
- Re: Documentation not clear for the Lisp function set-variable, Juanma Barranquero, 2005/06/28
- Re: Documentation not clear for the Lisp function set-variable, Richard M. Stallman, 2005/06/28
- Re: Documentation not clear for the Lisp function set-variable, Juanma Barranquero, 2005/06/28
- Re: Documentation not clear for the Lisp function set-variable,
Juanma Barranquero <=
- Re: Documentation not clear for the Lisp function set-variable, Stefan Monnier, 2005/06/28
- Re: Documentation not clear for the Lisp function set-variable, Juanma Barranquero, 2005/06/28
- Re: Documentation not clear for the Lisp function set-variable, Stefan Monnier, 2005/06/29
- Re: Documentation not clear for the Lisp function set-variable, Juanma Barranquero, 2005/06/29
- Re: Documentation not clear for the Lisp function set-variable, Richard M. Stallman, 2005/06/29
- Re: Documentation not clear for the Lisp function set-variable, Richard M. Stallman, 2005/06/27