aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2012-04-09 20:36:01 +0800
committerChong Yidong2012-04-09 20:36:01 +0800
commitb4d3bc10dc84f6b01a2b6b215d0e489555aa6edd (patch)
treeefc38746407c5604b926f192b6f1339dbac410d1 /src
parent9e40dda4c65e2b5a3dba82c180a20bb5c4687540 (diff)
downloademacs-b4d3bc10dc84f6b01a2b6b215d0e489555aa6edd.tar.gz
emacs-b4d3bc10dc84f6b01a2b6b215d0e489555aa6edd.zip
Remove defining user variables via * in docstring.
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/callint.c4
-rw-r--r--src/eval.c68
-rw-r--r--src/minibuf.c11
4 files changed, 17 insertions, 75 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c1fcfcf2437..7c3dd115c5b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12012-04-09 Chong Yidong <cyd@gnu.org>
2
3 * eval.c (Fuser_variable_p, user_variable_p_eh)
4 (lisp_indirect_variable): Functions deleted.
5 (Fdefvar): Caller changed.
6
7 * callint.c (Finteractive, Fcall_interactively):
8 * minibuf.c (Fread_variable): Callers changed.
9
12012-04-09 Eli Zaretskii <eliz@gnu.org> 102012-04-09 Eli Zaretskii <eliz@gnu.org>
2 11
3 * xdisp.c (set_cursor_from_row): If the display string appears in 12 * xdisp.c (set_cursor_from_row): If the display string appears in
diff --git a/src/callint.c b/src/callint.c
index e09210f1bb6..96e2e10b9d5 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -97,7 +97,7 @@ r -- Region: point and mark as 2 numeric args, smallest first. Does no I/O.
97s -- Any string. Does not inherit the current input method. 97s -- Any string. Does not inherit the current input method.
98S -- Any symbol. 98S -- Any symbol.
99U -- Mouse up event discarded by a previous k or K argument. 99U -- Mouse up event discarded by a previous k or K argument.
100v -- Variable name: symbol that is user-variable-p. 100v -- Variable name: symbol that is `custom-variable-p'.
101x -- Lisp expression read but not evaluated. 101x -- Lisp expression read but not evaluated.
102X -- Lisp expression read and evaluated. 102X -- Lisp expression read and evaluated.
103z -- Coding system. 103z -- Coding system.
@@ -748,7 +748,7 @@ invoke it. If KEYS is omitted or nil, the return value of
748 break; 748 break;
749 749
750 case 'v': /* Variable name: symbol that is 750 case 'v': /* Variable name: symbol that is
751 user-variable-p. */ 751 custom-variable-p. */
752 args[i] = Fread_variable (callint_message, Qnil); 752 args[i] = Fread_variable (callint_message, Qnil);
753 visargs[i] = last_minibuf_string; 753 visargs[i] = last_minibuf_string;
754 break; 754 break;
diff --git a/src/eval.c b/src/eval.c
index 4a3f5083b3b..1a6501a2b68 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -808,8 +808,6 @@ The optional argument DOCSTRING is a documentation string for the
808variable. 808variable.
809 809
810To define a user option, use `defcustom' instead of `defvar'. 810To define a user option, use `defcustom' instead of `defvar'.
811The function `user-variable-p' also identifies a variable as a user
812option if its DOCSTRING starts with *, but this behavior is obsolete.
813usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) 811usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
814 (Lisp_Object args) 812 (Lisp_Object args)
815{ 813{
@@ -923,71 +921,6 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */)
923 return sym; 921 return sym;
924} 922}
925 923
926/* Error handler used in Fuser_variable_p. */
927static Lisp_Object
928user_variable_p_eh (Lisp_Object ignore)
929{
930 return Qnil;
931}
932
933static Lisp_Object
934lisp_indirect_variable (Lisp_Object sym)
935{
936 struct Lisp_Symbol *s = indirect_variable (XSYMBOL (sym));
937 XSETSYMBOL (sym, s);
938 return sym;
939}
940
941DEFUN ("user-variable-p", Fuser_variable_p, Suser_variable_p, 1, 1, 0,
942 doc: /* Return t if VARIABLE is intended to be set and modified by users.
943\(The alternative is a variable used internally in a Lisp program.)
944
945This function returns t if (i) the first character of its
946documentation is `*', or (ii) it is customizable (its property list
947contains a non-nil value of `standard-value' or `custom-autoload'), or
948\(iii) it is an alias for a user variable.
949
950But condition (i) is considered obsolete, so for most purposes this is
951equivalent to `custom-variable-p'. */)
952 (Lisp_Object variable)
953{
954 Lisp_Object documentation;
955
956 if (!SYMBOLP (variable))
957 return Qnil;
958
959 /* If indirect and there's an alias loop, don't check anything else. */
960 if (XSYMBOL (variable)->redirect == SYMBOL_VARALIAS
961 && NILP (internal_condition_case_1 (lisp_indirect_variable, variable,
962 Qt, user_variable_p_eh)))
963 return Qnil;
964
965 while (1)
966 {
967 documentation = Fget (variable, Qvariable_documentation);
968 if (INTEGERP (documentation) && XINT (documentation) < 0)
969 return Qt;
970 if (STRINGP (documentation)
971 && ((unsigned char) SREF (documentation, 0) == '*'))
972 return Qt;
973 /* If it is (STRING . INTEGER), a negative integer means a user variable. */
974 if (CONSP (documentation)
975 && STRINGP (XCAR (documentation))
976 && INTEGERP (XCDR (documentation))
977 && XINT (XCDR (documentation)) < 0)
978 return Qt;
979 /* Customizable? See `custom-variable-p'. */
980 if ((!NILP (Fget (variable, intern ("standard-value"))))
981 || (!NILP (Fget (variable, intern ("custom-autoload")))))
982 return Qt;
983
984 if (!(XSYMBOL (variable)->redirect == SYMBOL_VARALIAS))
985 return Qnil;
986
987 /* An indirect variable? Let's follow the chain. */
988 XSETSYMBOL (variable, SYMBOL_ALIAS (XSYMBOL (variable)));
989 }
990}
991 924
992DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, 925DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0,
993 doc: /* Bind variables according to VARLIST then eval BODY. 926 doc: /* Bind variables according to VARLIST then eval BODY.
@@ -3789,7 +3722,6 @@ alist of active lexical bindings. */);
3789 defsubr (&Sdefvar); 3722 defsubr (&Sdefvar);
3790 defsubr (&Sdefvaralias); 3723 defsubr (&Sdefvaralias);
3791 defsubr (&Sdefconst); 3724 defsubr (&Sdefconst);
3792 defsubr (&Suser_variable_p);
3793 defsubr (&Slet); 3725 defsubr (&Slet);
3794 defsubr (&SletX); 3726 defsubr (&SletX);
3795 defsubr (&Swhile); 3727 defsubr (&Swhile);
diff --git a/src/minibuf.c b/src/minibuf.c
index a9bdf06b735..05f9419ba34 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -72,7 +72,7 @@ Lisp_Object Qcompletion_ignore_case;
72static Lisp_Object Qminibuffer_completion_table; 72static Lisp_Object Qminibuffer_completion_table;
73static Lisp_Object Qminibuffer_completion_predicate; 73static Lisp_Object Qminibuffer_completion_predicate;
74static Lisp_Object Qminibuffer_completion_confirm; 74static Lisp_Object Qminibuffer_completion_confirm;
75static Lisp_Object Quser_variable_p; 75static Lisp_Object Qcustom_variable_p;
76 76
77static Lisp_Object Qminibuffer_default; 77static Lisp_Object Qminibuffer_default;
78 78
@@ -1094,10 +1094,11 @@ Prompt with PROMPT. */)
1094#endif /* NOTDEF */ 1094#endif /* NOTDEF */
1095 1095
1096DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0, 1096DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0,
1097 doc: /* Read the name of a user variable and return it as a symbol. 1097 doc: /* Read the name of a user option and return it as a symbol.
1098Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element 1098Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element
1099if it is a list. 1099if it is a list.
1100A user variable is one for which `user-variable-p' returns non-nil. */) 1100A user option, or customizable variable, is one for which
1101`custom-variable-p' returns non-nil. */)
1101 (Lisp_Object prompt, Lisp_Object default_value) 1102 (Lisp_Object prompt, Lisp_Object default_value)
1102{ 1103{
1103 Lisp_Object name, default_string; 1104 Lisp_Object name, default_string;
@@ -1110,7 +1111,7 @@ A user variable is one for which `user-variable-p' returns non-nil. */)
1110 default_string = default_value; 1111 default_string = default_value;
1111 1112
1112 name = Fcompleting_read (prompt, Vobarray, 1113 name = Fcompleting_read (prompt, Vobarray,
1113 Quser_variable_p, Qt, 1114 Qcustom_variable_p, Qt,
1114 Qnil, Qnil, default_string, Qnil); 1115 Qnil, Qnil, default_string, Qnil);
1115 if (NILP (name)) 1116 if (NILP (name))
1116 return name; 1117 return name;
@@ -1975,11 +1976,11 @@ syms_of_minibuf (void)
1975 staticpro (&last_minibuf_string); 1976 staticpro (&last_minibuf_string);
1976 last_minibuf_string = Qnil; 1977 last_minibuf_string = Qnil;
1977 1978
1978 DEFSYM (Quser_variable_p, "user-variable-p");
1979 DEFSYM (Qminibuffer_history, "minibuffer-history"); 1979 DEFSYM (Qminibuffer_history, "minibuffer-history");
1980 DEFSYM (Qbuffer_name_history, "buffer-name-history"); 1980 DEFSYM (Qbuffer_name_history, "buffer-name-history");
1981 Fset (Qbuffer_name_history, Qnil); 1981 Fset (Qbuffer_name_history, Qnil);
1982 1982
1983 DEFSYM (Qcustom_variable_p, "custom-variable-p");
1983 DEFSYM (Qminibuffer_setup_hook, "minibuffer-setup-hook"); 1984 DEFSYM (Qminibuffer_setup_hook, "minibuffer-setup-hook");
1984 DEFSYM (Qminibuffer_exit_hook, "minibuffer-exit-hook"); 1985 DEFSYM (Qminibuffer_exit_hook, "minibuffer-exit-hook");
1985 DEFSYM (Qhistory_length, "history-length"); 1986 DEFSYM (Qhistory_length, "history-length");