* src/minibuf.c (Fread_no_blanks_input): Move to minibuffer.el

* src/keymap.c (syms_of_keymap):
* lisp/minibuffer.el (minibuffer-local-ns-map): Move declaration
to initialization.
(read-no-blanks-input): Move from `minibuf.c`.
This commit is contained in:
Stefan Monnier
2021-04-20 10:36:48 -04:00
parent 298f25ee1d
commit 3e93c2e5ae
3 changed files with 27 additions and 35 deletions

View File

@@ -2469,10 +2469,33 @@ with `minibuffer-local-must-match-map'.")
(defvar minibuffer-local-filename-must-match-map (make-sparse-keymap))
(make-obsolete-variable 'minibuffer-local-filename-must-match-map nil "24.1")
(let ((map minibuffer-local-ns-map))
(define-key map " " 'exit-minibuffer)
(define-key map "\t" 'exit-minibuffer)
(define-key map "?" 'self-insert-and-exit))
(defvar minibuffer-local-ns-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map minibuffer-local-map)
(define-key map " " #'exit-minibuffer)
(define-key map "\t" #'exit-minibuffer)
(define-key map "?" #'self-insert-and-exit)
map)
"Local keymap for the minibuffer when spaces are not allowed.")
(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))
;;; Major modes for the minibuffer
(defvar minibuffer-inactive-mode-map
(let ((map (make-keymap)))

View File

@@ -3148,12 +3148,6 @@ syms_of_keymap (void)
doc: /* Default keymap to use when reading from the minibuffer. */);
Vminibuffer_local_map = Fmake_sparse_keymap (Qnil);
DEFVAR_LISP ("minibuffer-local-ns-map", Vminibuffer_local_ns_map,
doc: /* Local keymap for the minibuffer when spaces are not allowed. */);
Vminibuffer_local_ns_map = Fmake_sparse_keymap (Qnil);
Fset_keymap_parent (Vminibuffer_local_ns_map, Vminibuffer_local_map);
DEFVAR_LISP ("minor-mode-map-alist", Vminor_mode_map_alist,
doc: /* Alist of keymaps to use for minor modes.
Each element looks like (VARIABLE . KEYMAP); KEYMAP is used to read

View File

@@ -1360,30 +1360,6 @@ Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
return unbind_to (count, val);
}
DEFUN ("read-no-blanks-input", Fread_no_blanks_input, Sread_no_blanks_input, 1, 3, 0,
doc: /* 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. */)
(Lisp_Object prompt, Lisp_Object initial, Lisp_Object inherit_input_method)
{
CHECK_STRING (prompt);
barf_if_interaction_inhibited ();
return read_minibuf (Vminibuffer_local_ns_map, initial, prompt,
0, Qminibuffer_history, make_fixnum (0), Qnil, 0,
!NILP (inherit_input_method));
}
DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0,
doc: /* Read the name of a command and return as a symbol.
Prompt with PROMPT. By default, return DEFAULT-VALUE or its first element
@@ -2517,7 +2493,6 @@ instead. */);
defsubr (&Sread_variable);
defsubr (&Sinternal_complete_buffer);
defsubr (&Sread_buffer);
defsubr (&Sread_no_blanks_input);
defsubr (&Sminibuffer_depth);
defsubr (&Sminibuffer_prompt);