int completion_ignore_case;
Lisp_Object Qcompletion_ignore_case;
+int read_buffer_completion_ignore_case;
/* List of regexps that should restrict possible completions. */
If DEF is a list of default values, return its first element.
If optional third arg REQUIRE-MATCH is non-nil,
only existing buffer names are allowed.
-The argument PROMPT should be a string ending with a colon and a space. */)
+The argument PROMPT should be a string ending with a colon and a space.
+If `read-buffer-completion-ignore-case' is non-nil, completion ignores
+case while reading the buffer name.
+If `read-buffer-function' is non-nil, this works by calling it as a
+function, instead of the usual behavior. */)
(prompt, def, require_match)
Lisp_Object prompt, def, require_match;
{
- Lisp_Object args[4];
+ Lisp_Object args[4], result;
unsigned char *s;
int len;
+ int count = SPECPDL_INDEX ();
if (BUFFERP (def))
def = XBUFFER (def)->name;
+ specbind (Qcompletion_ignore_case,
+ read_buffer_completion_ignore_case ? Qt : Qnil);
+
if (NILP (Vread_buffer_function))
{
if (!NILP (def))
prompt = Fformat (3, args);
}
- return Fcompleting_read (prompt, intern ("internal-complete-buffer"),
- Qnil, require_match, Qnil, Qbuffer_name_history,
- def, Qnil);
+ result = Fcompleting_read (prompt, intern ("internal-complete-buffer"),
+ Qnil, require_match, Qnil, Qbuffer_name_history,
+ def, Qnil);
}
else
{
args[1] = prompt;
args[2] = def;
args[3] = require_match;
- return Ffuncall(4, args);
+ result = Ffuncall(4, args);
}
+ return unbind_to (count, result);
}
\f
static Lisp_Object
doc: /* If this is non-nil, `read-buffer' does its work by calling this function. */);
Vread_buffer_function = Qnil;
+ DEFVAR_BOOL ("read-buffer-completion-ignore-case",
+ &read_buffer_completion_ignore_case,
+ doc: /* *Non-nil means completion ignores case when reading a buffer name. */);
+ read_buffer_completion_ignore_case = 0;
+
DEFVAR_LISP ("minibuffer-setup-hook", &Vminibuffer_setup_hook,
doc: /* Normal hook run just after entry to minibuffer. */);
Vminibuffer_setup_hook = Qnil;