diff options
| author | Stefan Monnier | 2015-03-16 14:49:01 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-03-16 14:49:01 -0400 |
| commit | f925fc93bac41d7622d1af927e33b0e738ff55b0 (patch) | |
| tree | e8635662256290a1662a299b66e32f6301535200 /src | |
| parent | 43a847c02c3eb848cd0d55a4722bfe7f39b1112f (diff) | |
| download | emacs-f925fc93bac41d7622d1af927e33b0e738ff55b0.tar.gz emacs-f925fc93bac41d7622d1af927e33b0e738ff55b0.zip | |
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')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/callint.c | 4 | ||||
| -rw-r--r-- | src/minibuf.c | 18 |
3 files changed, 20 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e328afcde8f..fbf8fb452fc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2015-03-16 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * minibuf.c (Fread_buffer): Add `predicate' argument. | ||
| 4 | * callint.c (Fcall_interactively): Adjust calls accordingly. | ||
| 5 | |||
| 1 | 2015-03-15 Eli Zaretskii <eliz@gnu.org> | 6 | 2015-03-15 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * xdisp.c (handle_invisible_prop): Fix up it->position even when | 8 | * xdisp.c (handle_invisible_prop): Fix up it->position even when |
diff --git a/src/callint.c b/src/callint.c index 0c6c03036c8..cf50e0c3788 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -531,13 +531,13 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 531 | args[i] = Fcurrent_buffer (); | 531 | args[i] = Fcurrent_buffer (); |
| 532 | if (EQ (selected_window, minibuf_window)) | 532 | if (EQ (selected_window, minibuf_window)) |
| 533 | args[i] = Fother_buffer (args[i], Qnil, Qnil); | 533 | args[i] = Fother_buffer (args[i], Qnil, Qnil); |
| 534 | args[i] = Fread_buffer (callint_message, args[i], Qt); | 534 | args[i] = Fread_buffer (callint_message, args[i], Qt, Qnil); |
| 535 | break; | 535 | break; |
| 536 | 536 | ||
| 537 | case 'B': /* Name of buffer, possibly nonexistent. */ | 537 | case 'B': /* Name of buffer, possibly nonexistent. */ |
| 538 | args[i] = Fread_buffer (callint_message, | 538 | args[i] = Fread_buffer (callint_message, |
| 539 | Fother_buffer (Fcurrent_buffer (), Qnil, Qnil), | 539 | Fother_buffer (Fcurrent_buffer (), Qnil, Qnil), |
| 540 | Qnil); | 540 | Qnil, Qnil); |
| 541 | break; | 541 | break; |
| 542 | 542 | ||
| 543 | case 'c': /* Character. */ | 543 | case 'c': /* Character. */ |
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 | |||
| 1081 | return Fintern (name, Qnil); | 1081 | return Fintern (name, Qnil); |
| 1082 | } | 1082 | } |
| 1083 | 1083 | ||
| 1084 | DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 3, 0, | 1084 | DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 4, 0, |
| 1085 | doc: /* Read the name of a buffer and return as a string. | 1085 | doc: /* Read the name of a buffer and return as a string. |
| 1086 | Prompt with PROMPT. | 1086 | Prompt with PROMPT. |
| 1087 | Optional second arg DEF is value to return if user enters an empty line. | 1087 | 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. | |||
| 1093 | If `read-buffer-completion-ignore-case' is non-nil, completion ignores | 1093 | If `read-buffer-completion-ignore-case' is non-nil, completion ignores |
| 1094 | case while reading the buffer name. | 1094 | case while reading the buffer name. |
| 1095 | If `read-buffer-function' is non-nil, this works by calling it as a | 1095 | If `read-buffer-function' is non-nil, this works by calling it as a |
| 1096 | function, instead of the usual behavior. */) | 1096 | function, instead of the usual behavior. |
| 1097 | (Lisp_Object prompt, Lisp_Object def, Lisp_Object require_match) | 1097 | Optional arg PREDICATE if non-nil is a function limiting the buffers that can |
| 1098 | be considered. */) | ||
| 1099 | (Lisp_Object prompt, Lisp_Object def, Lisp_Object require_match, | ||
| 1100 | Lisp_Object predicate) | ||
| 1098 | { | 1101 | { |
| 1099 | Lisp_Object result; | 1102 | Lisp_Object result; |
| 1100 | char *s; | 1103 | char *s; |
| @@ -1136,11 +1139,16 @@ function, instead of the usual behavior. */) | |||
| 1136 | } | 1139 | } |
| 1137 | 1140 | ||
| 1138 | result = Fcompleting_read (prompt, intern ("internal-complete-buffer"), | 1141 | result = Fcompleting_read (prompt, intern ("internal-complete-buffer"), |
| 1139 | Qnil, require_match, Qnil, | 1142 | predicate, require_match, Qnil, |
| 1140 | Qbuffer_name_history, def, Qnil); | 1143 | Qbuffer_name_history, def, Qnil); |
| 1141 | } | 1144 | } |
| 1142 | else | 1145 | else |
| 1143 | result = call3 (Vread_buffer_function, prompt, def, require_match); | 1146 | result = (NILP (predicate) |
| 1147 | /* Partial backward compatibility for older read_buffer_functions | ||
| 1148 | which don't expect a `predicate' argument. */ | ||
| 1149 | ? call3 (Vread_buffer_function, prompt, def, require_match) | ||
| 1150 | : call4 (Vread_buffer_function, prompt, def, require_match, | ||
| 1151 | predicate)); | ||
| 1144 | return unbind_to (count, result); | 1152 | return unbind_to (count, result); |
| 1145 | } | 1153 | } |
| 1146 | 1154 | ||