From: Eshel Yaron Date: Thu, 15 Feb 2024 17:37:18 +0000 (+0100) Subject: Deprecate 'read-no-blanks-input' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0b718f953a5f0f80082ec535f71772473ad046b7;p=emacs.git Deprecate 'read-no-blanks-input' This function is unused in the Emacs tree, and it probably shouldn't be used anywhere else, either. * lisp/minibuffer.el (read-no-blanks-input): Turn it into an obsolete alias of 'read-string'. (self-insert-and-exit, minibuffer-local-ns-map): Deprecate. * doc/emacs/custom.texi (Minibuffer Maps): * doc/lispref/minibuf.texi (Text from Minibuffer) (Minibuffer Commands): Update. * lisp/calc/calc-store.el (calcVar-digit, calcVar-oper): Avoid 'self-insert-and-exit'. * test/src/minibuf-tests.el (test-inhibit-interaction): Adjust. --- diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index e047782e150..2bf53df2ed2 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -1791,7 +1791,6 @@ circumstances. @cindex minibuffer keymaps @vindex minibuffer-local-map -@vindex minibuffer-local-ns-map @vindex minibuffer-local-completion-map @vindex minibuffer-local-must-match-map The minibuffer has its own set of local keymaps; they contain various @@ -1801,9 +1800,6 @@ completion and exit commands. @item @code{minibuffer-local-map} is used for ordinary input (no completion). @item -@code{minibuffer-local-ns-map} is similar, except that @key{SPC} exits -just like @key{RET}. -@item @code{minibuffer-local-completion-map} is for permissive completion. @item @code{minibuffer-local-must-match-map} is for strict completion and diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index e79ce280936..2d8d2650cbc 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -350,18 +350,11 @@ See @code{read-regexp} above for details of how these values are used. @end defopt @defvar minibuffer-allow-text-properties -If this variable is @code{nil}, then @code{read-from-minibuffer} -and @code{read-string} strip all text properties from the minibuffer -input before returning it. However, -@code{read-no-blanks-input} (see below), as well as -@code{read-minibuffer} and related functions (@pxref{Object from -Minibuffer,, Reading Lisp Objects With the Minibuffer}), and all -functions that do minibuffer input with completion, remove the @code{face} -property unconditionally, regardless of the value of this variable. - -If this variable is non-@code{nil}, most text properties on strings -from the completion table are preserved---but only on the part of the -strings that were completed. +If this variable is @code{nil}, then @code{read-from-minibuffer} strip +all text properties from the minibuffer input before returning it. +Otherwise, the minibuffer input is returned as is, along with its text +properties. Moreover, if this variable is non-@code{nil}, most text +properties on strings from the completion table are preserved as well. @lisp (let ((minibuffer-allow-text-properties t)) @@ -420,53 +413,6 @@ default, it makes the following bindings: The variable @code{minibuffer-mode-map} is an alias for this variable. @end defvar -@defun read-no-blanks-input prompt &optional initial inherit-input-method -This function reads a string from the minibuffer, but does not allow -whitespace characters as part of the input: instead, those characters -terminate the input. The arguments @var{prompt}, @var{initial}, and -@var{inherit-input-method} are used as in @code{read-from-minibuffer}. - -This is a simplified interface to the @code{read-from-minibuffer} -function, and passes the value of the @code{minibuffer-local-ns-map} -keymap as the @var{keymap} argument for that function. Since the keymap -@code{minibuffer-local-ns-map} does not rebind @kbd{C-q}, it @emph{is} -possible to put a space into the string, by quoting it. - -This function discards text properties, regardless of the value of -@code{minibuffer-allow-text-properties}. - -@smallexample -@group -(read-no-blanks-input @var{prompt} @var{initial}) -@equiv{} -(let (minibuffer-allow-text-properties) - (read-from-minibuffer @var{prompt} @var{initial} minibuffer-local-ns-map)) -@end group -@end smallexample -@end defun - -@c Slightly unfortunate name, suggesting it might be related to the -@c Nextstep port... -@defvar minibuffer-local-ns-map -This built-in variable is the keymap used as the minibuffer local keymap -in the function @code{read-no-blanks-input}. By default, it makes the -following bindings, in addition to those of @code{minibuffer-local-map}: - -@table @asis -@item @key{SPC} -@cindex @key{SPC} in minibuffer -@code{exit-minibuffer} - -@item @key{TAB} -@cindex @key{TAB} in minibuffer -@code{exit-minibuffer} - -@item @kbd{?} -@cindex @kbd{?} in minibuffer -@code{self-insert-and-exit} -@end table -@end defvar - @vindex minibuffer-default-prompt-format @defun format-prompt prompt default &rest format-args Format @var{prompt} with default value @var{default} according to the @@ -2716,12 +2662,6 @@ keys in minibuffer local keymaps. The command throws an error if the current buffer is a minibuffer, but not the active minibuffer. @end deffn -@deffn Command self-insert-and-exit -This command exits the active minibuffer after inserting the last -character typed on the keyboard (found in @code{last-command-event}; -@pxref{Command Loop Info}). -@end deffn - @deffn Command previous-history-element n This command replaces the minibuffer contents with the value of the @var{n}th previous (older) history element. diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el index df584760606..dec331a0c99 100644 --- a/lisp/calc/calc-store.el +++ b/lisp/calc/calc-store.el @@ -221,8 +221,9 @@ (if (eq calc-store-opers 0) (beep) (insert "q") - (self-insert-and-exit)) - (self-insert-command 1))) + (call-interactively 'self-insert-command) + (exit-minibuffer)) + (call-interactively 'self-insert-command))) (defun calcVar-oper () (interactive) @@ -230,8 +231,9 @@ (calc-minibuffer-contains "\\'")) (progn (erase-buffer) - (self-insert-and-exit)) - (self-insert-command 1))) + (call-interactively 'self-insert-command) + (exit-minibuffer)) + (call-interactively 'self-insert-command))) (defun calc-store-map (&optional oper var) (interactive) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index ca981a1e7d2..911412e2b8c 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3085,6 +3085,7 @@ If nil, it defaults to 1." (defun self-insert-and-exit () "Terminate minibuffer input." + (declare (obsolete nil "30.1")) (interactive) (if (characterp last-command-event) (call-interactively 'self-insert-command) @@ -3396,13 +3397,6 @@ The completion method is determined by `completion-at-point-functions'." (make-obsolete-variable 'minibuffer-local-filename-completion-map nil "30.1") -(defvar-keymap minibuffer-local-ns-map - :doc "Local keymap for the minibuffer when spaces are not allowed." - :parent minibuffer-local-map - "SPC" #'exit-minibuffer - "TAB" #'exit-minibuffer - "?" #'self-insert-and-exit) - (defvar-keymap minibuffer-narrow-completions-map :doc "Keymap for completions narrowing commands." "n" #'minibuffer-narrow-completions-to-current @@ -3413,22 +3407,12 @@ The completion method is determined by `completion-at-point-functions'." (defalias 'minibuffer-narrow-completions-map minibuffer-narrow-completions-map) -(defun read-no-blanks-input (prompt &optional initial inherit-input-method) - "Read a string from the terminal, not allowing blanks. -Prompt with PROMPT. Whitespace terminates the input. If INITIAL is -non-nil, it should be a string, which is used as initial input, with -point positioned at the end, so that SPACE will accept the input. -\(Actually, INITIAL can also be a cons of a string and an integer. -Such values are treated as in `read-from-minibuffer', but are normally -not useful in this function.) - -Third arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits -the current input method and the setting of `enable-multibyte-characters'. - -If `inhibit-interaction' is non-nil, this function will signal an -`inhibited-interaction' error." - (read-from-minibuffer prompt initial minibuffer-local-ns-map - nil 'minibuffer-history nil inherit-input-method)) +(defvar-keymap minibuffer-local-ns-map + :doc "This variable is obsolete and no longer used.") + +(make-obsolete-variable 'minibuffer-local-ns-map nil "30.1") + +(define-obsolete-function-alias 'read-no-blanks-input 'read-string "30.1") ;;; Major modes for the minibuffer diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el index cb305ca0e55..96a7c052fb7 100644 --- a/test/src/minibuf-tests.el +++ b/test/src/minibuf-tests.el @@ -422,7 +422,6 @@ (should-error (y-or-n-p "Foo?") :type 'inhibited-interaction) (should-error (yes-or-no-p "Foo?") :type 'inhibited-interaction) - (should-error (read-no-blanks-input "foo: ") :type 'inhibited-interaction) ;; See that we get the expected error. (should (eq (condition-case nil