]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove defining user variables via * in docstring.
authorChong Yidong <cyd@gnu.org>
Mon, 9 Apr 2012 12:36:01 +0000 (20:36 +0800)
committerChong Yidong <cyd@gnu.org>
Mon, 9 Apr 2012 12:36:01 +0000 (20:36 +0800)
* lisp/apropos.el (apropos-variable):
* lisp/files-x.el (read-file-local-variable):
* lisp/simple.el (set-variable):
* lisp/woman.el (woman-mini-help):
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Callers changed.

* lisp/custom.el (custom-variable-p): Return nil for non-symbol
arguments instead of signaling an error.
(user-variable-p): Obsolete alias for custom-variable-p.

* lisp/erc/erc.el (erc-cmd-SET): Call custom-variable-p instead of
user-variable-p.

* src/callint.c (Finteractive, Fcall_interactively):
* src/minibuf.c (Fread_variable): Callers changed.

* src/eval.c (Fuser_variable_p, user_variable_p_eh)
(lisp_indirect_variable): Functions deleted.
(Fdefvar): Caller changed.

* doc/lispref/commands.texi (Interactive Codes):
* doc/lispref/help.texi (Accessing Documentation):
* doc/lispref/minibuf.texi (High-Level Completion): Callers changed.

* doc/lispref/customize.texi (Variable Definitions): Remove user-variable-p.

20 files changed:
doc/lispref/ChangeLog
doc/lispref/commands.texi
doc/lispref/customize.texi
doc/lispref/help.texi
doc/lispref/minibuf.texi
etc/NEWS
lisp/ChangeLog
lisp/apropos.el
lisp/custom.el
lisp/emacs-lisp/byte-opt.el
lisp/erc/ChangeLog
lisp/erc/erc.el
lisp/files-x.el
lisp/simple.el
lisp/skeleton.el
lisp/woman.el
src/ChangeLog
src/callint.c
src/eval.c
src/minibuf.c

index afd6700ef612d299b6ada858e95ade5448b4d2fe..81558bbd248061763df1af4209a8d5da6ac44969 100644 (file)
@@ -1,3 +1,11 @@
+2012-04-09  Chong Yidong  <cyd@gnu.org>
+
+       * customize.texi (Variable Definitions): Remove user-variable-p.
+
+       * commands.texi (Interactive Codes):
+       * help.texi (Accessing Documentation):
+       * minibuf.texi (High-Level Completion): Callers changed.
+
 2012-04-06  Chong Yidong  <cyd@gnu.org>
 
        * minibuf.texi (Programmed Completion): Document metadata method.
index 617f050f498ad25ba9a1e1a3037421498ef91149..95039d36b7e93cb5eaa0f0ca0fb266a48ec06c5f 100644 (file)
@@ -482,7 +482,7 @@ discarded, @samp{U} provides @code{nil} as the argument.  No I/O.
 
 @item v
 A variable declared to be a user option (i.e., satisfying the
-predicate @code{user-variable-p}).  This reads the variable using
+predicate @code{custom-variable-p}).  This reads the variable using
 @code{read-variable}.  @xref{Definition of read-variable}.  Existing,
 Completion, Prompt.
 
index 4c3adee0db5c2e30b2a94a8f11b19451f95a4862..d86aea24fbc2ff33ef99a31673d47478672b38d4 100644 (file)
@@ -462,14 +462,6 @@ meaning it was declared with @code{defcustom}), or an alias for
 another customizable variable.
 @end defun
 
-@defun user-variable-p arg
-This function is like @code{custom-variable-p}, except it also returns
-@code{t} if the first character of the variable's documentation string
-is the character @samp{*}.  That is an obsolete way of indicating a
-user option, so for most purposes you may consider
-@code{user-variable-p} as equivalent to @code{custom-variable-p}.
-@end defun
-
 @node Customization Types
 @section Customization Types
 
index 537514d7fb99579500203258b6964f2fafe216e9..c703e7810f835ccfe1ea6386cd0e01500da8558e 100644 (file)
@@ -218,7 +218,7 @@ in the `*Help*' buffer."
 @group
                 (princ
                  (format "%s\t%s\n%s\n\n" s
-                   (if (user-variable-p s)
+                   (if (custom-variable-p s)
                        "Option " "Variable")
 @end group
 @group
index 4e11bc30d49ff13575150b684737b45e114c261e..437a2daa8e373e9d7e0b6598b8fe7c151a441322 100644 (file)
@@ -1313,17 +1313,17 @@ If the user then types @kbd{fill-p @key{RET}}, @code{read-variable}
 returns @code{fill-prefix}.
 
 In general, @code{read-variable} is similar to @code{read-command},
-but uses the predicate @code{user-variable-p} instead of
+but uses the predicate @code{custom-variable-p} instead of
 @code{commandp}:
 
-@cindex @code{user-variable-p} example
+@cindex @code{custom-variable-p} example
 @example
 @group
 (read-variable @var{prompt})
 @equiv{}
 (intern
  (completing-read @var{prompt} obarray
-                  'user-variable-p t nil))
+                  'custom-variable-p t nil))
 @end group
 @end example
 @end defun
index 16357f3cfd3e3bb48f348ade752ad0f40e53c7ab..a1ef62c0bd63a6c1a2d8fbf66bc72360fb4b7f10 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -43,6 +43,13 @@ been adding them there, put them somewhere else, eg site-lisp.
 * New Modes and Packages in Emacs 24.2
 \f
 * Incompatible Lisp Changes in Emacs 24.2
+
++++
+** Docstrings starting with `*' no longer indicate user options.
+Only variables defined using `defcustom' are considered user options.
+The function `user-variable-p' is now an obsolete alias for
+`custom-variable-p'.
+
 \f
 * Lisp changes in Emacs 24.2
 \f
index ed4470b998a5fb071dd63726a9d081033b42cc12..8c3093aa2c25106e34857d219271df78cefc6922 100644 (file)
@@ -1,3 +1,15 @@
+2012-04-09  Chong Yidong  <cyd@gnu.org>
+
+       * custom.el (custom-variable-p): Return nil for non-symbol
+       arguments instead of signaling an error.
+       (user-variable-p): Obsolete alias for custom-variable-p.
+
+       * apropos.el (apropos-variable):
+       * files-x.el (read-file-local-variable):
+       * simple.el (set-variable):
+       * woman.el (woman-mini-help):
+       * emacs-lisp/byte-opt.el (side-effect-free-fns): Callers changed.
+
 2012-04-09  Glenn Morris  <rgm@gnu.org>
 
        * startup.el (normal-top-level): Don't look for leim-list.el
index 423656c21fa8d639347d2102128a23432f1722cd..56b27e9b9b43d631ad258d6244f1255783ab51d8 100644 (file)
@@ -466,7 +466,7 @@ normal variables."
                       #'(lambda (symbol)
                           (and (boundp symbol)
                                (get symbol 'variable-documentation)))
-                    'user-variable-p)))
+                    'custom-variable-p)))
 
 ;; For auld lang syne:
 ;;;###autoload
index bffd30bff211fc41b6eabd73432783b1c852a91a..d8909f8be927c67e6893dbef5a37a5356dba36e6 100644 (file)
@@ -599,15 +599,17 @@ If NOSET is non-nil, don't bother autoloading LOAD when setting the variable."
   (put symbol 'custom-autoload (if noset 'noset t))
   (custom-add-load symbol load))
 
-;; This test is also in the C code of `user-variable-p'.
 (defun custom-variable-p (variable)
   "Return non-nil if VARIABLE is a customizable variable.
 A customizable variable is either (i) a variable whose property
 list contains a non-nil `standard-value' or `custom-autoload'
 property, or (ii) an alias for another customizable variable."
-  (setq variable (indirect-variable variable))
-  (or (get variable 'standard-value)
-      (get variable 'custom-autoload)))
+  (when (symbolp variable)
+    (setq variable (indirect-variable variable))
+    (or (get variable 'standard-value)
+       (get variable 'custom-autoload))))
+
+(define-obsolete-function-alias 'user-variable-p 'custom-variable-p "24.2")
 
 (defun custom-note-var-changed (variable)
   "Inform Custom that VARIABLE has been set (changed).
index 78ac29d89df8ad64edbf5d57a78600af5d9b7c9e..3b324a09659d8ed426c4e52404d13628cf3906fe 100644 (file)
         string-to-multibyte
         tan truncate
         unibyte-char-to-multibyte upcase user-full-name
-        user-login-name user-original-login-name user-variable-p
+        user-login-name user-original-login-name custom-variable-p
         vconcat
         window-buffer window-dedicated-p window-edges window-height
         window-hscroll window-minibuffer-p window-width
index af853c4e230740968fc5460fcebab41fca6fce3b..34aa015d7ac657bbd14fb4497510a40a5f7e4f5a 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-09  Chong Yidong  <cyd@gnu.org>
+
+       * erc.el (erc-cmd-SET): Call custom-variable-p instead of
+       user-variable-p.
+
 2012-02-08  Glenn Morris  <rgm@gnu.org>
 
        * erc-backend.el (erc-coding-system-precedence):
index b95d42b154a60284927e64947888ce2eea3cbbf1..63777fb38976eb708311efec675e218c5f288e23 100644 (file)
@@ -2616,7 +2616,7 @@ VALUE is computed by evaluating the rest of LINE in Lisp."
                           (if (consp val)
                               (concat "\n" (pp-to-string val))
                             (format " %S\n" val)))))
-              (apropos-internal "^erc-" 'user-variable-p))))
+              (apropos-internal "^erc-" 'custom-variable-p))))
      (current-buffer)) t)
    (t nil)))
 (defalias 'erc-cmd-VAR 'erc-cmd-SET)
index b4a04401a776ae45dc3f4deef530118bdfc642a2..e28e2ba83e3f3c9f7b643f1815faf99f351c30f3 100644 (file)
@@ -49,7 +49,7 @@ Intended to be used in the `interactive' spec of
             (format "%s: " prompt))
           obarray
           (lambda (sym)
-            (or (user-variable-p sym)
+            (or (custom-variable-p sym)
                  (get sym 'safe-local-variable)
                 (memq sym '(mode eval coding unibyte))))
           nil nil nil default nil))
index 8b04534455d4560c87d9953a500f22e481bd49dd..64356ce8aa7aa5c50886c5d7ed6f21a6b81cd440 100644 (file)
@@ -5983,7 +5983,7 @@ in the definition is used to check that VALUE is valid.
 With a prefix argument, set VARIABLE to VALUE buffer-locally."
   (interactive
    (let* ((default-var (variable-at-point))
-          (var (if (user-variable-p default-var)
+          (var (if (custom-variable-p default-var)
                   (read-variable (format "Set variable (default %s): " default-var)
                                  default-var)
                 (read-variable "Set variable: ")))
index 0f28d32293b55460a16dc204bba78c1ec6699937..5838915b1f543f489c36423d523c6a414782ce01 100644 (file)
@@ -456,7 +456,7 @@ automatically, and you are prompted to fill in the variable parts.")))
 ;;                  obarray
 ;;                  (lambda (symbol)
 ;;                    (or (eq symbol 'eval)
-;;                        (user-variable-p symbol)))
+;;                        (custom-variable-p symbol)))
 ;;                  t)
 ;;    comment-start str ": "
 ;;    (read-from-minibuffer "Expression: " nil read-expression-map nil
index 4ecf7c8891d0428e6f2da9eed40067b405728a35..c76399a96e54920f51151c0429b1483a70951141 100644 (file)
@@ -1987,7 +1987,7 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated."
                            (lambda (symbol)
                              (and
                               (or (commandp symbol)
-                                  (user-variable-p symbol))
+                                  (custom-variable-p symbol))
                               (not (get symbol 'apropos-inhibit))))))
     ;; Find documentation strings:
     (let ((p apropos-accumulator)
@@ -1999,7 +1999,7 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated."
                       (if (setq doc (documentation symbol t))
                           (substring doc 0 (string-match "\n" doc))
                         "(not documented)"))
-                  (if (user-variable-p symbol) ; 3. variable doc
+                  (if (custom-variable-p symbol)       ; 3. variable doc
                       (if (setq doc (documentation-property
                                      symbol 'variable-documentation t))
                           (substring doc 0 (string-match "\n" doc))))))
index c1fcfcf2437c6f6003326988179ea5cb746602d4..7c3dd115c5bfde64a3ad67cf1d839a5bf7f12352 100644 (file)
@@ -1,3 +1,12 @@
+2012-04-09  Chong Yidong  <cyd@gnu.org>
+
+       * eval.c (Fuser_variable_p, user_variable_p_eh)
+       (lisp_indirect_variable): Functions deleted.
+       (Fdefvar): Caller changed.
+
+       * callint.c (Finteractive, Fcall_interactively):
+       * minibuf.c (Fread_variable): Callers changed.
+
 2012-04-09  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (set_cursor_from_row): If the display string appears in
index e09210f1bb6f48e21e1ca4e9309acce4a198cd7e..96e2e10b9d5edec795e421367d7df0429228f2e8 100644 (file)
@@ -97,7 +97,7 @@ r -- Region: point and mark as 2 numeric args, smallest first.  Does no I/O.
 s -- Any string.  Does not inherit the current input method.
 S -- Any symbol.
 U -- Mouse up event discarded by a previous k or K argument.
-v -- Variable name: symbol that is user-variable-p.
+v -- Variable name: symbol that is `custom-variable-p'.
 x -- Lisp expression read but not evaluated.
 X -- Lisp expression read and evaluated.
 z -- Coding system.
@@ -748,7 +748,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
          break;
 
        case 'v':               /* Variable name: symbol that is
-                                  user-variable-p. */
+                                  custom-variable-p. */
          args[i] = Fread_variable (callint_message, Qnil);
          visargs[i] = last_minibuf_string;
          break;
index 4a3f5083b3b88a0f66cd5d3e556b98a5d4b1f07e..1a6501a2b689b97f510857c541779020c23c0c5a 100644 (file)
@@ -808,8 +808,6 @@ The optional argument DOCSTRING is a documentation string for the
 variable.
 
 To define a user option, use `defcustom' instead of `defvar'.
-The function `user-variable-p' also identifies a variable as a user
-option if its DOCSTRING starts with *, but this behavior is obsolete.
 usage: (defvar SYMBOL &optional INITVALUE DOCSTRING)  */)
   (Lisp_Object args)
 {
@@ -923,71 +921,6 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING])  */)
   return sym;
 }
 
-/* Error handler used in Fuser_variable_p.  */
-static Lisp_Object
-user_variable_p_eh (Lisp_Object ignore)
-{
-  return Qnil;
-}
-
-static Lisp_Object
-lisp_indirect_variable (Lisp_Object sym)
-{
-  struct Lisp_Symbol *s = indirect_variable (XSYMBOL (sym));
-  XSETSYMBOL (sym, s);
-  return sym;
-}
-
-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.)
-
-This function returns t if (i) the first character of its
-documentation is `*', or (ii) it is customizable (its property list
-contains a non-nil value of `standard-value' or `custom-autoload'), or
-\(iii) it is an alias for a user variable.
-
-But condition (i) is considered obsolete, so for most purposes this is
-equivalent to `custom-variable-p'.  */)
-  (Lisp_Object variable)
-{
-  Lisp_Object documentation;
-
-  if (!SYMBOLP (variable))
-      return Qnil;
-
-  /* If indirect and there's an alias loop, don't check anything else.  */
-  if (XSYMBOL (variable)->redirect == SYMBOL_VARALIAS
-      && NILP (internal_condition_case_1 (lisp_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)->redirect == SYMBOL_VARALIAS))
-       return Qnil;
-
-      /* An indirect variable?  Let's follow the chain.  */
-      XSETSYMBOL (variable, SYMBOL_ALIAS (XSYMBOL (variable)));
-    }
-}
 \f
 DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0,
        doc: /* Bind variables according to VARLIST then eval BODY.
@@ -3789,7 +3722,6 @@ alist of active lexical bindings.  */);
   defsubr (&Sdefvar);
   defsubr (&Sdefvaralias);
   defsubr (&Sdefconst);
-  defsubr (&Suser_variable_p);
   defsubr (&Slet);
   defsubr (&SletX);
   defsubr (&Swhile);
index a9bdf06b735405676b1a8e5ef23089b0b6575f65..05f9419ba349ea3671d74e3a3e6c806289ac085c 100644 (file)
@@ -72,7 +72,7 @@ Lisp_Object Qcompletion_ignore_case;
 static Lisp_Object Qminibuffer_completion_table;
 static Lisp_Object Qminibuffer_completion_predicate;
 static Lisp_Object Qminibuffer_completion_confirm;
-static Lisp_Object Quser_variable_p;
+static Lisp_Object Qcustom_variable_p;
 
 static Lisp_Object Qminibuffer_default;
 
@@ -1094,10 +1094,11 @@ Prompt with PROMPT.  */)
 #endif /* NOTDEF */
 
 DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0,
-       doc: /* Read the name of a user variable and return it as a symbol.
+       doc: /* Read the name of a user option and return it as a symbol.
 Prompt with PROMPT.  By default, return DEFAULT-VALUE or its first element
 if it is a list.
-A user variable is one for which `user-variable-p' returns non-nil.  */)
+A user option, or customizable variable, is one for which
+`custom-variable-p' returns non-nil.  */)
   (Lisp_Object prompt, Lisp_Object default_value)
 {
   Lisp_Object name, default_string;
@@ -1110,7 +1111,7 @@ A user variable is one for which `user-variable-p' returns non-nil.  */)
     default_string = default_value;
 
   name = Fcompleting_read (prompt, Vobarray,
-                          Quser_variable_p, Qt,
+                          Qcustom_variable_p, Qt,
                           Qnil, Qnil, default_string, Qnil);
   if (NILP (name))
     return name;
@@ -1975,11 +1976,11 @@ syms_of_minibuf (void)
   staticpro (&last_minibuf_string);
   last_minibuf_string = Qnil;
 
-  DEFSYM (Quser_variable_p, "user-variable-p");
   DEFSYM (Qminibuffer_history, "minibuffer-history");
   DEFSYM (Qbuffer_name_history, "buffer-name-history");
   Fset (Qbuffer_name_history, Qnil);
 
+  DEFSYM (Qcustom_variable_p, "custom-variable-p");
   DEFSYM (Qminibuffer_setup_hook, "minibuffer-setup-hook");
   DEFSYM (Qminibuffer_exit_hook, "minibuffer-exit-hook");
   DEFSYM (Qhistory_length, "history-length");