X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/36a50f38fbbcf5cc0cafc44af9d1bfcd6c13fc25..eb0f65b4fbbea60100b53cb40a1d7138d47ad0d2:/src/minibuf.c diff --git a/src/minibuf.c b/src/minibuf.c index e7c288b251..03be8d1ff9 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1081,7 +1081,7 @@ A user option, or customizable variable, is one for which return Fintern (name, Qnil); } -DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 3, 0, +DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 4, 0, doc: /* Read the name of a buffer and return as a string. Prompt with PROMPT. Optional second arg DEF is value to return if user enters an empty line. @@ -1093,8 +1093,11 @@ 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. */) - (Lisp_Object prompt, Lisp_Object def, Lisp_Object require_match) +function, instead of the usual behavior. +Optional arg PREDICATE if non-nil is a function limiting the buffers that can +be considered. */) + (Lisp_Object prompt, Lisp_Object def, Lisp_Object require_match, + Lisp_Object predicate) { Lisp_Object result; char *s; @@ -1136,11 +1139,16 @@ function, instead of the usual behavior. */) } result = Fcompleting_read (prompt, intern ("internal-complete-buffer"), - Qnil, require_match, Qnil, + predicate, require_match, Qnil, Qbuffer_name_history, def, Qnil); } else - result = call3 (Vread_buffer_function, prompt, def, require_match); + result = (NILP (predicate) + /* Partial backward compatibility for older read_buffer_functions + which don't expect a `predicate' argument. */ + ? call3 (Vread_buffer_function, prompt, def, require_match) + : call4 (Vread_buffer_function, prompt, def, require_match, + predicate)); return unbind_to (count, result); } @@ -1902,13 +1910,10 @@ syms_of_minibuf (void) staticpro (&minibuf_save_list); DEFSYM (Qcompletion_ignore_case, "completion-ignore-case"); - DEFSYM (Qread_file_name_internal, "read-file-name-internal"); DEFSYM (Qminibuffer_default, "minibuffer-default"); Fset (Qminibuffer_default, Qnil); DEFSYM (Qminibuffer_completion_table, "minibuffer-completion-table"); - DEFSYM (Qminibuffer_completion_confirm, "minibuffer-completion-confirm"); - DEFSYM (Qminibuffer_completion_predicate, "minibuffer-completion-predicate"); staticpro (&last_minibuf_string); last_minibuf_string = Qnil; @@ -1936,8 +1941,6 @@ syms_of_minibuf (void) For example, `eval-expression' uses this. */); Vread_expression_history = Qnil; - DEFSYM (Qread_expression_history, "read-expression-history"); - DEFVAR_LISP ("read-buffer-function", Vread_buffer_function, doc: /* If this is non-nil, `read-buffer' does its work by calling this function. The function is called with the arguments passed to `read-buffer'. */);