aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-07-30 15:26:31 +0000
committerChong Yidong2008-07-30 15:26:31 +0000
commit33df281c8bafc8b71e9d771a20bc7884519bbc09 (patch)
treee7574f68718cb2a4d1e5508423baf480dbc6edf1
parentbc85033335c7b664e8f08cc66cf474025ac55f26 (diff)
downloademacs-33df281c8bafc8b71e9d771a20bc7884519bbc09.tar.gz
emacs-33df281c8bafc8b71e9d771a20bc7884519bbc09.zip
(read_buffer_completion_ignore_case): New var.
(Fread_buffer): Use it.
-rw-r--r--src/minibuf.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index 168c6ab0b26..4fa480e2540 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -113,6 +113,7 @@ Lisp_Object Vread_buffer_function;
113 113
114int completion_ignore_case; 114int completion_ignore_case;
115Lisp_Object Qcompletion_ignore_case; 115Lisp_Object Qcompletion_ignore_case;
116int read_buffer_completion_ignore_case;
116 117
117/* List of regexps that should restrict possible completions. */ 118/* List of regexps that should restrict possible completions. */
118 119
@@ -1178,17 +1179,25 @@ Optional second arg DEF is value to return if user enters an empty line.
1178 If DEF is a list of default values, return its first element. 1179 If DEF is a list of default values, return its first element.
1179If optional third arg REQUIRE-MATCH is non-nil, 1180If optional third arg REQUIRE-MATCH is non-nil,
1180 only existing buffer names are allowed. 1181 only existing buffer names are allowed.
1181The argument PROMPT should be a string ending with a colon and a space. */) 1182The argument PROMPT should be a string ending with a colon and a space.
1183If `read-buffer-completion-ignore-case' is non-nil, completion ignores
1184case while reading the buffer name.
1185If `read-buffer-function' is non-nil, this works by calling it as a
1186function, instead of the usual behavior. */)
1182 (prompt, def, require_match) 1187 (prompt, def, require_match)
1183 Lisp_Object prompt, def, require_match; 1188 Lisp_Object prompt, def, require_match;
1184{ 1189{
1185 Lisp_Object args[4]; 1190 Lisp_Object args[4], result;
1186 unsigned char *s; 1191 unsigned char *s;
1187 int len; 1192 int len;
1193 int count = SPECPDL_INDEX ();
1188 1194
1189 if (BUFFERP (def)) 1195 if (BUFFERP (def))
1190 def = XBUFFER (def)->name; 1196 def = XBUFFER (def)->name;
1191 1197
1198 specbind (Qcompletion_ignore_case,
1199 read_buffer_completion_ignore_case ? Qt : Qnil);
1200
1192 if (NILP (Vread_buffer_function)) 1201 if (NILP (Vread_buffer_function))
1193 { 1202 {
1194 if (!NILP (def)) 1203 if (!NILP (def))
@@ -1218,9 +1227,9 @@ The argument PROMPT should be a string ending with a colon and a space. */)
1218 prompt = Fformat (3, args); 1227 prompt = Fformat (3, args);
1219 } 1228 }
1220 1229
1221 return Fcompleting_read (prompt, intern ("internal-complete-buffer"), 1230 result = Fcompleting_read (prompt, intern ("internal-complete-buffer"),
1222 Qnil, require_match, Qnil, Qbuffer_name_history, 1231 Qnil, require_match, Qnil, Qbuffer_name_history,
1223 def, Qnil); 1232 def, Qnil);
1224 } 1233 }
1225 else 1234 else
1226 { 1235 {
@@ -1228,8 +1237,9 @@ The argument PROMPT should be a string ending with a colon and a space. */)
1228 args[1] = prompt; 1237 args[1] = prompt;
1229 args[2] = def; 1238 args[2] = def;
1230 args[3] = require_match; 1239 args[3] = require_match;
1231 return Ffuncall(4, args); 1240 result = Ffuncall(4, args);
1232 } 1241 }
1242 return unbind_to (count, result);
1233} 1243}
1234 1244
1235static Lisp_Object 1245static Lisp_Object
@@ -2111,6 +2121,11 @@ syms_of_minibuf ()
2111 doc: /* If this is non-nil, `read-buffer' does its work by calling this function. */); 2121 doc: /* If this is non-nil, `read-buffer' does its work by calling this function. */);
2112 Vread_buffer_function = Qnil; 2122 Vread_buffer_function = Qnil;
2113 2123
2124 DEFVAR_BOOL ("read-buffer-completion-ignore-case",
2125 &read_buffer_completion_ignore_case,
2126 doc: /* *Non-nil means completion ignores case when reading a buffer name. */);
2127 read_buffer_completion_ignore_case = 0;
2128
2114 DEFVAR_LISP ("minibuffer-setup-hook", &Vminibuffer_setup_hook, 2129 DEFVAR_LISP ("minibuffer-setup-hook", &Vminibuffer_setup_hook,
2115 doc: /* Normal hook run just after entry to minibuffer. */); 2130 doc: /* Normal hook run just after entry to minibuffer. */);
2116 Vminibuffer_setup_hook = Qnil; 2131 Vminibuffer_setup_hook = Qnil;