[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: |
Mon, 27 Jun 2005 23:38:52 +0200 |
> This patch produces the following text:
>
> Determined by whether the first character of the documentation
> for the variable is `*', the variable is customizable (has a non-nil
> value of `standard-value' or of `custom-autoload' on its property list),
> or it is a non-obsolete alias for another user variable.
>
> Does anyone else think that this sentence is so confusing in its
> structure as to be almost unparsable? (The old sentence was even less
> clear.)
Unparsable I wouldn't say, but certainly not very good. But anyway,
Richard just said that obsolete aliases should be set-variable too.
> I think this sentence sorely needs rephrasing. For starters, it
> should not use passive tense.
What about this patch? Do you like it a bit more?
--
/L/e/k/t/u
Index: src/eval.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/eval.c,v
retrieving revision 1.245
diff -u -2 -r1.245 eval.c
--- src/eval.c 27 Jun 2005 05:59:23 -0000 1.245
+++ src/eval.c 27 Jun 2005 21:32:36 -0000
@@ -890,10 +890,22 @@
}
+/* 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: /* Returns t if VARIABLE is intended to be set and
modified by users.
+ 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.)
-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 is considered to be 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,21 +916,35 @@
return Qnil;
- documentation = Fget (variable, Qvariable_documentation);
- if (INTEGERP (documentation) && XINT (documentation) < 0)
- return Qt;
- if (STRINGP (documentation)
- && ((unsigned char) SREF (documentation, 0) == '*'))
- return Qt;
- /* If it is (STRING . INTEGER), a negative integer means a user variable. */
- if (CONSP (documentation)
- && STRINGP (XCAR (documentation))
- && INTEGERP (XCDR (documentation))
- && XINT (XCDR (documentation)) < 0)
- return Qt;
- /* Customizable? See `custom-variable-p'. */
- if ((!NILP (Fget (variable, intern ("standard-value"))))
- || (!NILP (Fget (variable, intern ("custom-autoload")))))
- return Qt;
- 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)
+ return Qt;
+ if (STRINGP (documentation)
+ && ((unsigned char) SREF (documentation, 0) == '*'))
+ return Qt;
+ /* If it is (STRING . INTEGER), a negative integer means a user
variable. */
+ if (CONSP (documentation)
+ && STRINGP (XCAR (documentation))
+ && INTEGERP (XCDR (documentation))
+ && XINT (XCDR (documentation)) < 0)
+ return Qt;
+ /* Customizable? See `custom-variable-p'. */
+ if ((!NILP (Fget (variable, intern ("standard-value"))))
+ || (!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, Juanma Barranquero, 2005/06/29
- Re: Documentation not clear for the Lisp function set-variable, Juri Linkov, 2005/06/29
- Re: Documentation not clear for the Lisp function set-variable, Juanma Barranquero, 2005/06/30
- Re: Documentation not clear for the Lisp function set-variable, Luc Teirlinck, 2005/06/30
- Re: Documentation not clear for the Lisp function set-variable, Juanma Barranquero, 2005/06/30
- 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, Richard M. Stallman, 2005/06/29
- 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 <=
- 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, 2005/06/28
- 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