summaryrefslogtreecommitdiff
path: root/src/minibuf.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2015-03-16 14:49:01 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2015-03-16 14:49:01 -0400
commitf925fc93bac41d7622d1af927e33b0e738ff55b0 (patch)
treee8635662256290a1662a299b66e32f6301535200 /src/minibuf.c
parent43a847c02c3eb848cd0d55a4722bfe7f39b1112f (diff)
downloademacs-f925fc93bac41d7622d1af927e33b0e738ff55b0.tar.gz
Add `predicate' arg to `read-buffer' and use it for erc-iswitchb
Fixes: debbugs:20116 * src/minibuf.c (Fread_buffer): Add `predicate' argument. * src/callint.c (Fcall_interactively): Adjust calls accordingly. * lisp/erc/erc.el (erc-switch-to-buffer): Rename from erc-iswitchb and rewrite using read-buffer. (erc--buffer-p): New function, extracted from erc-buffer-filter. (erc-buffer-filter): Use it. (erc-with-all-buffers-of-server): Silence compile warning if the return value is unused. (erc-is-valid-nick-p, erc-common-server-suffixes, erc-get-arglist) (erc-command-name, erc-popup-input-buffer): Use \` and \' to match beg/end of string. * lisp/obsolete/iswitchb.el (iswitchb-read-buffer): Add `predicate' arg. * lisp/isearchb.el (isearchb-iswitchb): Adjust accordingly. * lisp/ido.el (ido-read-buffer): Add `predicate' argument. * lisp/misearch.el (unload-function-defs-list): Declare before use.
Diffstat (limited to 'src/minibuf.c')
-rw-r--r--src/minibuf.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index e7c288b251b..c03316965d3 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);
}