diff options
| author | Chong Yidong | 2012-04-09 20:36:01 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-04-09 20:36:01 +0800 |
| commit | b4d3bc10dc84f6b01a2b6b215d0e489555aa6edd (patch) | |
| tree | efc38746407c5604b926f192b6f1339dbac410d1 | |
| parent | 9e40dda4c65e2b5a3dba82c180a20bb5c4687540 (diff) | |
| download | emacs-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.
| -rw-r--r-- | doc/lispref/ChangeLog | 8 | ||||
| -rw-r--r-- | doc/lispref/commands.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/customize.texi | 8 | ||||
| -rw-r--r-- | doc/lispref/help.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/minibuf.texi | 6 | ||||
| -rw-r--r-- | etc/NEWS | 7 | ||||
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/apropos.el | 2 | ||||
| -rw-r--r-- | lisp/custom.el | 10 | ||||
| -rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 2 | ||||
| -rw-r--r-- | lisp/erc/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/erc/erc.el | 2 | ||||
| -rw-r--r-- | lisp/files-x.el | 2 | ||||
| -rw-r--r-- | lisp/simple.el | 2 | ||||
| -rw-r--r-- | lisp/skeleton.el | 2 | ||||
| -rw-r--r-- | lisp/woman.el | 4 | ||||
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/callint.c | 4 | ||||
| -rw-r--r-- | src/eval.c | 68 | ||||
| -rw-r--r-- | src/minibuf.c | 11 |
20 files changed, 68 insertions, 100 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index afd6700ef61..81558bbd248 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2012-04-09 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * customize.texi (Variable Definitions): Remove user-variable-p. | ||
| 4 | |||
| 5 | * commands.texi (Interactive Codes): | ||
| 6 | * help.texi (Accessing Documentation): | ||
| 7 | * minibuf.texi (High-Level Completion): Callers changed. | ||
| 8 | |||
| 1 | 2012-04-06 Chong Yidong <cyd@gnu.org> | 9 | 2012-04-06 Chong Yidong <cyd@gnu.org> |
| 2 | 10 | ||
| 3 | * minibuf.texi (Programmed Completion): Document metadata method. | 11 | * minibuf.texi (Programmed Completion): Document metadata method. |
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 617f050f498..95039d36b7e 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi | |||
| @@ -482,7 +482,7 @@ discarded, @samp{U} provides @code{nil} as the argument. No I/O. | |||
| 482 | 482 | ||
| 483 | @item v | 483 | @item v |
| 484 | A variable declared to be a user option (i.e., satisfying the | 484 | A variable declared to be a user option (i.e., satisfying the |
| 485 | predicate @code{user-variable-p}). This reads the variable using | 485 | predicate @code{custom-variable-p}). This reads the variable using |
| 486 | @code{read-variable}. @xref{Definition of read-variable}. Existing, | 486 | @code{read-variable}. @xref{Definition of read-variable}. Existing, |
| 487 | Completion, Prompt. | 487 | Completion, Prompt. |
| 488 | 488 | ||
diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi index 4c3adee0db5..d86aea24fbc 100644 --- a/doc/lispref/customize.texi +++ b/doc/lispref/customize.texi | |||
| @@ -462,14 +462,6 @@ meaning it was declared with @code{defcustom}), or an alias for | |||
| 462 | another customizable variable. | 462 | another customizable variable. |
| 463 | @end defun | 463 | @end defun |
| 464 | 464 | ||
| 465 | @defun user-variable-p arg | ||
| 466 | This function is like @code{custom-variable-p}, except it also returns | ||
| 467 | @code{t} if the first character of the variable's documentation string | ||
| 468 | is the character @samp{*}. That is an obsolete way of indicating a | ||
| 469 | user option, so for most purposes you may consider | ||
| 470 | @code{user-variable-p} as equivalent to @code{custom-variable-p}. | ||
| 471 | @end defun | ||
| 472 | |||
| 473 | @node Customization Types | 465 | @node Customization Types |
| 474 | @section Customization Types | 466 | @section Customization Types |
| 475 | 467 | ||
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index 537514d7fb9..c703e7810f8 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi | |||
| @@ -218,7 +218,7 @@ in the `*Help*' buffer." | |||
| 218 | @group | 218 | @group |
| 219 | (princ | 219 | (princ |
| 220 | (format "%s\t%s\n%s\n\n" s | 220 | (format "%s\t%s\n%s\n\n" s |
| 221 | (if (user-variable-p s) | 221 | (if (custom-variable-p s) |
| 222 | "Option " "Variable") | 222 | "Option " "Variable") |
| 223 | @end group | 223 | @end group |
| 224 | @group | 224 | @group |
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 4e11bc30d49..437a2daa8e3 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi | |||
| @@ -1313,17 +1313,17 @@ If the user then types @kbd{fill-p @key{RET}}, @code{read-variable} | |||
| 1313 | returns @code{fill-prefix}. | 1313 | returns @code{fill-prefix}. |
| 1314 | 1314 | ||
| 1315 | In general, @code{read-variable} is similar to @code{read-command}, | 1315 | In general, @code{read-variable} is similar to @code{read-command}, |
| 1316 | but uses the predicate @code{user-variable-p} instead of | 1316 | but uses the predicate @code{custom-variable-p} instead of |
| 1317 | @code{commandp}: | 1317 | @code{commandp}: |
| 1318 | 1318 | ||
| 1319 | @cindex @code{user-variable-p} example | 1319 | @cindex @code{custom-variable-p} example |
| 1320 | @example | 1320 | @example |
| 1321 | @group | 1321 | @group |
| 1322 | (read-variable @var{prompt}) | 1322 | (read-variable @var{prompt}) |
| 1323 | @equiv{} | 1323 | @equiv{} |
| 1324 | (intern | 1324 | (intern |
| 1325 | (completing-read @var{prompt} obarray | 1325 | (completing-read @var{prompt} obarray |
| 1326 | 'user-variable-p t nil)) | 1326 | 'custom-variable-p t nil)) |
| 1327 | @end group | 1327 | @end group |
| 1328 | @end example | 1328 | @end example |
| 1329 | @end defun | 1329 | @end defun |
| @@ -43,6 +43,13 @@ been adding them there, put them somewhere else, eg site-lisp. | |||
| 43 | * New Modes and Packages in Emacs 24.2 | 43 | * New Modes and Packages in Emacs 24.2 |
| 44 | 44 | ||
| 45 | * Incompatible Lisp Changes in Emacs 24.2 | 45 | * Incompatible Lisp Changes in Emacs 24.2 |
| 46 | |||
| 47 | +++ | ||
| 48 | ** Docstrings starting with `*' no longer indicate user options. | ||
| 49 | Only variables defined using `defcustom' are considered user options. | ||
| 50 | The function `user-variable-p' is now an obsolete alias for | ||
| 51 | `custom-variable-p'. | ||
| 52 | |||
| 46 | 53 | ||
| 47 | * Lisp changes in Emacs 24.2 | 54 | * Lisp changes in Emacs 24.2 |
| 48 | 55 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ed4470b998a..8c3093aa2c2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2012-04-09 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * custom.el (custom-variable-p): Return nil for non-symbol | ||
| 4 | arguments instead of signaling an error. | ||
| 5 | (user-variable-p): Obsolete alias for custom-variable-p. | ||
| 6 | |||
| 7 | * apropos.el (apropos-variable): | ||
| 8 | * files-x.el (read-file-local-variable): | ||
| 9 | * simple.el (set-variable): | ||
| 10 | * woman.el (woman-mini-help): | ||
| 11 | * emacs-lisp/byte-opt.el (side-effect-free-fns): Callers changed. | ||
| 12 | |||
| 1 | 2012-04-09 Glenn Morris <rgm@gnu.org> | 13 | 2012-04-09 Glenn Morris <rgm@gnu.org> |
| 2 | 14 | ||
| 3 | * startup.el (normal-top-level): Don't look for leim-list.el | 15 | * startup.el (normal-top-level): Don't look for leim-list.el |
diff --git a/lisp/apropos.el b/lisp/apropos.el index 423656c21fa..56b27e9b9b4 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el | |||
| @@ -466,7 +466,7 @@ normal variables." | |||
| 466 | #'(lambda (symbol) | 466 | #'(lambda (symbol) |
| 467 | (and (boundp symbol) | 467 | (and (boundp symbol) |
| 468 | (get symbol 'variable-documentation))) | 468 | (get symbol 'variable-documentation))) |
| 469 | 'user-variable-p))) | 469 | 'custom-variable-p))) |
| 470 | 470 | ||
| 471 | ;; For auld lang syne: | 471 | ;; For auld lang syne: |
| 472 | ;;;###autoload | 472 | ;;;###autoload |
diff --git a/lisp/custom.el b/lisp/custom.el index bffd30bff21..d8909f8be92 100644 --- a/lisp/custom.el +++ b/lisp/custom.el | |||
| @@ -599,15 +599,17 @@ If NOSET is non-nil, don't bother autoloading LOAD when setting the variable." | |||
| 599 | (put symbol 'custom-autoload (if noset 'noset t)) | 599 | (put symbol 'custom-autoload (if noset 'noset t)) |
| 600 | (custom-add-load symbol load)) | 600 | (custom-add-load symbol load)) |
| 601 | 601 | ||
| 602 | ;; This test is also in the C code of `user-variable-p'. | ||
| 603 | (defun custom-variable-p (variable) | 602 | (defun custom-variable-p (variable) |
| 604 | "Return non-nil if VARIABLE is a customizable variable. | 603 | "Return non-nil if VARIABLE is a customizable variable. |
| 605 | A customizable variable is either (i) a variable whose property | 604 | A customizable variable is either (i) a variable whose property |
| 606 | list contains a non-nil `standard-value' or `custom-autoload' | 605 | list contains a non-nil `standard-value' or `custom-autoload' |
| 607 | property, or (ii) an alias for another customizable variable." | 606 | property, or (ii) an alias for another customizable variable." |
| 608 | (setq variable (indirect-variable variable)) | 607 | (when (symbolp variable) |
| 609 | (or (get variable 'standard-value) | 608 | (setq variable (indirect-variable variable)) |
| 610 | (get variable 'custom-autoload))) | 609 | (or (get variable 'standard-value) |
| 610 | (get variable 'custom-autoload)))) | ||
| 611 | |||
| 612 | (define-obsolete-function-alias 'user-variable-p 'custom-variable-p "24.2") | ||
| 611 | 613 | ||
| 612 | (defun custom-note-var-changed (variable) | 614 | (defun custom-note-var-changed (variable) |
| 613 | "Inform Custom that VARIABLE has been set (changed). | 615 | "Inform Custom that VARIABLE has been set (changed). |
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 78ac29d89df..3b324a09659 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el | |||
| @@ -1237,7 +1237,7 @@ | |||
| 1237 | string-to-multibyte | 1237 | string-to-multibyte |
| 1238 | tan truncate | 1238 | tan truncate |
| 1239 | unibyte-char-to-multibyte upcase user-full-name | 1239 | unibyte-char-to-multibyte upcase user-full-name |
| 1240 | user-login-name user-original-login-name user-variable-p | 1240 | user-login-name user-original-login-name custom-variable-p |
| 1241 | vconcat | 1241 | vconcat |
| 1242 | window-buffer window-dedicated-p window-edges window-height | 1242 | window-buffer window-dedicated-p window-edges window-height |
| 1243 | window-hscroll window-minibuffer-p window-width | 1243 | window-hscroll window-minibuffer-p window-width |
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index af853c4e230..34aa015d7ac 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-04-09 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * erc.el (erc-cmd-SET): Call custom-variable-p instead of | ||
| 4 | user-variable-p. | ||
| 5 | |||
| 1 | 2012-02-08 Glenn Morris <rgm@gnu.org> | 6 | 2012-02-08 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * erc-backend.el (erc-coding-system-precedence): | 8 | * erc-backend.el (erc-coding-system-precedence): |
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index b95d42b154a..63777fb3897 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el | |||
| @@ -2616,7 +2616,7 @@ VALUE is computed by evaluating the rest of LINE in Lisp." | |||
| 2616 | (if (consp val) | 2616 | (if (consp val) |
| 2617 | (concat "\n" (pp-to-string val)) | 2617 | (concat "\n" (pp-to-string val)) |
| 2618 | (format " %S\n" val))))) | 2618 | (format " %S\n" val))))) |
| 2619 | (apropos-internal "^erc-" 'user-variable-p)))) | 2619 | (apropos-internal "^erc-" 'custom-variable-p)))) |
| 2620 | (current-buffer)) t) | 2620 | (current-buffer)) t) |
| 2621 | (t nil))) | 2621 | (t nil))) |
| 2622 | (defalias 'erc-cmd-VAR 'erc-cmd-SET) | 2622 | (defalias 'erc-cmd-VAR 'erc-cmd-SET) |
diff --git a/lisp/files-x.el b/lisp/files-x.el index b4a04401a77..e28e2ba83e3 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el | |||
| @@ -49,7 +49,7 @@ Intended to be used in the `interactive' spec of | |||
| 49 | (format "%s: " prompt)) | 49 | (format "%s: " prompt)) |
| 50 | obarray | 50 | obarray |
| 51 | (lambda (sym) | 51 | (lambda (sym) |
| 52 | (or (user-variable-p sym) | 52 | (or (custom-variable-p sym) |
| 53 | (get sym 'safe-local-variable) | 53 | (get sym 'safe-local-variable) |
| 54 | (memq sym '(mode eval coding unibyte)))) | 54 | (memq sym '(mode eval coding unibyte)))) |
| 55 | nil nil nil default nil)) | 55 | nil nil nil default nil)) |
diff --git a/lisp/simple.el b/lisp/simple.el index 8b04534455d..64356ce8aa7 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -5983,7 +5983,7 @@ in the definition is used to check that VALUE is valid. | |||
| 5983 | With a prefix argument, set VARIABLE to VALUE buffer-locally." | 5983 | With a prefix argument, set VARIABLE to VALUE buffer-locally." |
| 5984 | (interactive | 5984 | (interactive |
| 5985 | (let* ((default-var (variable-at-point)) | 5985 | (let* ((default-var (variable-at-point)) |
| 5986 | (var (if (user-variable-p default-var) | 5986 | (var (if (custom-variable-p default-var) |
| 5987 | (read-variable (format "Set variable (default %s): " default-var) | 5987 | (read-variable (format "Set variable (default %s): " default-var) |
| 5988 | default-var) | 5988 | default-var) |
| 5989 | (read-variable "Set variable: "))) | 5989 | (read-variable "Set variable: "))) |
diff --git a/lisp/skeleton.el b/lisp/skeleton.el index 0f28d32293b..5838915b1f5 100644 --- a/lisp/skeleton.el +++ b/lisp/skeleton.el | |||
| @@ -456,7 +456,7 @@ automatically, and you are prompted to fill in the variable parts."))) | |||
| 456 | ;; obarray | 456 | ;; obarray |
| 457 | ;; (lambda (symbol) | 457 | ;; (lambda (symbol) |
| 458 | ;; (or (eq symbol 'eval) | 458 | ;; (or (eq symbol 'eval) |
| 459 | ;; (user-variable-p symbol))) | 459 | ;; (custom-variable-p symbol))) |
| 460 | ;; t) | 460 | ;; t) |
| 461 | ;; comment-start str ": " | 461 | ;; comment-start str ": " |
| 462 | ;; (read-from-minibuffer "Expression: " nil read-expression-map nil | 462 | ;; (read-from-minibuffer "Expression: " nil read-expression-map nil |
diff --git a/lisp/woman.el b/lisp/woman.el index 4ecf7c8891d..c76399a96e5 100644 --- a/lisp/woman.el +++ b/lisp/woman.el | |||
| @@ -1987,7 +1987,7 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated." | |||
| 1987 | (lambda (symbol) | 1987 | (lambda (symbol) |
| 1988 | (and | 1988 | (and |
| 1989 | (or (commandp symbol) | 1989 | (or (commandp symbol) |
| 1990 | (user-variable-p symbol)) | 1990 | (custom-variable-p symbol)) |
| 1991 | (not (get symbol 'apropos-inhibit)))))) | 1991 | (not (get symbol 'apropos-inhibit)))))) |
| 1992 | ;; Find documentation strings: | 1992 | ;; Find documentation strings: |
| 1993 | (let ((p apropos-accumulator) | 1993 | (let ((p apropos-accumulator) |
| @@ -1999,7 +1999,7 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated." | |||
| 1999 | (if (setq doc (documentation symbol t)) | 1999 | (if (setq doc (documentation symbol t)) |
| 2000 | (substring doc 0 (string-match "\n" doc)) | 2000 | (substring doc 0 (string-match "\n" doc)) |
| 2001 | "(not documented)")) | 2001 | "(not documented)")) |
| 2002 | (if (user-variable-p symbol) ; 3. variable doc | 2002 | (if (custom-variable-p symbol) ; 3. variable doc |
| 2003 | (if (setq doc (documentation-property | 2003 | (if (setq doc (documentation-property |
| 2004 | symbol 'variable-documentation t)) | 2004 | symbol 'variable-documentation t)) |
| 2005 | (substring doc 0 (string-match "\n" doc)))))) | 2005 | (substring doc 0 (string-match "\n" doc)))))) |
diff --git a/src/ChangeLog b/src/ChangeLog index c1fcfcf2437..7c3dd115c5b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2012-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 | |||
| 1 | 2012-04-09 Eli Zaretskii <eliz@gnu.org> | 10 | 2012-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. | |||
| 97 | s -- Any string. Does not inherit the current input method. | 97 | s -- Any string. Does not inherit the current input method. |
| 98 | S -- Any symbol. | 98 | S -- Any symbol. |
| 99 | U -- Mouse up event discarded by a previous k or K argument. | 99 | U -- Mouse up event discarded by a previous k or K argument. |
| 100 | v -- Variable name: symbol that is user-variable-p. | 100 | v -- Variable name: symbol that is `custom-variable-p'. |
| 101 | x -- Lisp expression read but not evaluated. | 101 | x -- Lisp expression read but not evaluated. |
| 102 | X -- Lisp expression read and evaluated. | 102 | X -- Lisp expression read and evaluated. |
| 103 | z -- Coding system. | 103 | z -- 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 | |||
| 808 | variable. | 808 | variable. |
| 809 | 809 | ||
| 810 | To define a user option, use `defcustom' instead of `defvar'. | 810 | To define a user option, use `defcustom' instead of `defvar'. |
| 811 | The function `user-variable-p' also identifies a variable as a user | ||
| 812 | option if its DOCSTRING starts with *, but this behavior is obsolete. | ||
| 813 | usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | 811 | usage: (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. */ | ||
| 927 | static Lisp_Object | ||
| 928 | user_variable_p_eh (Lisp_Object ignore) | ||
| 929 | { | ||
| 930 | return Qnil; | ||
| 931 | } | ||
| 932 | |||
| 933 | static Lisp_Object | ||
| 934 | lisp_indirect_variable (Lisp_Object sym) | ||
| 935 | { | ||
| 936 | struct Lisp_Symbol *s = indirect_variable (XSYMBOL (sym)); | ||
| 937 | XSETSYMBOL (sym, s); | ||
| 938 | return sym; | ||
| 939 | } | ||
| 940 | |||
| 941 | DEFUN ("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 | |||
| 945 | This function returns t if (i) the first character of its | ||
| 946 | documentation is `*', or (ii) it is customizable (its property list | ||
| 947 | contains a non-nil value of `standard-value' or `custom-autoload'), or | ||
| 948 | \(iii) it is an alias for a user variable. | ||
| 949 | |||
| 950 | But condition (i) is considered obsolete, so for most purposes this is | ||
| 951 | equivalent 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 | ||
| 992 | DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0, | 925 | DEFUN ("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; | |||
| 72 | static Lisp_Object Qminibuffer_completion_table; | 72 | static Lisp_Object Qminibuffer_completion_table; |
| 73 | static Lisp_Object Qminibuffer_completion_predicate; | 73 | static Lisp_Object Qminibuffer_completion_predicate; |
| 74 | static Lisp_Object Qminibuffer_completion_confirm; | 74 | static Lisp_Object Qminibuffer_completion_confirm; |
| 75 | static Lisp_Object Quser_variable_p; | 75 | static Lisp_Object Qcustom_variable_p; |
| 76 | 76 | ||
| 77 | static Lisp_Object Qminibuffer_default; | 77 | static Lisp_Object Qminibuffer_default; |
| 78 | 78 | ||
| @@ -1094,10 +1094,11 @@ Prompt with PROMPT. */) | |||
| 1094 | #endif /* NOTDEF */ | 1094 | #endif /* NOTDEF */ |
| 1095 | 1095 | ||
| 1096 | DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0, | 1096 | DEFUN ("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. |
| 1098 | Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element | 1098 | Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element |
| 1099 | if it is a list. | 1099 | if it is a list. |
| 1100 | A user variable is one for which `user-variable-p' returns non-nil. */) | 1100 | A 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"); |