emacs-devel
[Top][All Lists]
Advanced

[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 15:04:58 +0200

On 6/27/05, Juri Linkov <address@hidden> wrote:

> IMO, `set-variable' should
> accept an alias when it is not marked as obsolete.

Try this patch, please. It doesn't modify `set-variable' but
`user-variable-p', so it returns t for non-obsolete aliases of user
variables.

(Anyway, is that a new feature or a bug fix?)


-- 
                    /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 13:03:26 -0000
@@ -94,4 +94,5 @@
 Lisp_Object Qdebug_on_error;
  Lisp_Object Qdeclare;
+Lisp_Object Qbyte_obsolete_variable;
 
 /* This holds either the symbol `run-hooks' or nil.
@@ -894,10 +895,12 @@
 \(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).  */)
+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.  */)
      (variable)
      Lisp_Object variable;
 {
   Lisp_Object documentation;
+  struct Lisp_Symbol *sym;
 
   if (!SYMBOLP (variable))
@@ -920,4 +923,10 @@
       || (!NILP (Fget (variable, intern ("custom-autoload")))))
     return Qt;
+
+  sym = XSYMBOL (variable);
+  if (sym->indirect_variable
+      && NILP (Fget (variable, Qbyte_obsolete_variable)))
+    return Fuser_variable_p (sym->value);
+
   return Qnil;
 }
@@ -3410,4 +3419,7 @@
   staticpro (&Qdeclare);
 
+  Qbyte_obsolete_variable = intern ("byte-obsolete-variable");
+  staticpro (&Qbyte_obsolete_variable);
+
   /* Note that the process handling also uses Qexit, but we don't want
      to staticpro it twice, so we just do it here.  */




reply via email to

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