comparison src/minibuf.c @ 267:966663fcf606 r20-5b32

Import from CVS: tag r20-5b32
author cvs
date Mon, 13 Aug 2007 10:26:29 +0200
parents 262b8bb4a523
children c5d627a313b1
comparison
equal deleted inserted replaced
266:18d185df8c54 267:966663fcf606
212 212
213 if (ignore_case) 213 if (ignore_case)
214 { 214 {
215 while (l) 215 while (l)
216 { 216 {
217 Bufbyte c1 = DOWNCASE (current_buffer, charptr_emchar (s1)); 217 Emchar c1 = DOWNCASE (current_buffer, charptr_emchar (s1));
218 Bufbyte c2 = DOWNCASE (current_buffer, charptr_emchar (s2)); 218 Emchar c2 = DOWNCASE (current_buffer, charptr_emchar (s2));
219 219
220 if (c1 == c2) 220 if (c1 == c2)
221 { 221 {
222 l--; 222 l--;
223 INC_CHARPTR (s1); 223 INC_CHARPTR (s1);
287 } 287 }
288 return 0; 288 return 0;
289 } 289 }
290 290
291 291
292 292 /* #### Maybe we should allow ALIST to be a hashtable. It is wrong
293 for the use of obarrays to be better-rewarded than the use of
294 hashtables. By better-rewarded I mean that you can pass an obarray
295 to all of the completion functions, whereas you can't do anything
296 like that with a hashtable.
297
298 To do so, there should probably be a
299 map_obarray_or_alist_or_hashtable function which would be used by
300 both Ftry_completion and Fall_completions. But would the
301 additional funcalls slow things down? */
293 302
294 DEFUN ("try-completion", Ftry_completion, 2, 3, 0, /* 303 DEFUN ("try-completion", Ftry_completion, 2, 3, 0, /*
295 Return common substring of all completions of STRING in ALIST. 304 Return common substring of all completions of STRING in ALIST.
296 Each car of each element of ALIST is tested to see if it begins with STRING. 305 Each car of each element of ALIST is tested to see if it begins with STRING.
297 All that match are compared together; the longest initial sequence 306 All that match are compared together; the longest initial sequence
324 Charcount slength, blength; 333 Charcount slength, blength;
325 334
326 CHECK_STRING (string); 335 CHECK_STRING (string);
327 336
328 if (CONSP (alist)) 337 if (CONSP (alist))
329 { 338 {
330 Lisp_Object tem = XCAR (alist); 339 Lisp_Object tem = XCAR (alist);
331 if (SYMBOLP (tem)) /* lambda, autoload, etc. Emacs-lisp sucks */ 340 if (SYMBOLP (tem)) /* lambda, autoload, etc. Emacs-lisp sucks */
332 return call3 (alist, string, pred, Qnil); 341 return call3 (alist, string, pred, Qnil);
333 else 342 else
334 list = 1; 343 list = 1;
335 } 344 }
336 else if (VECTORP (alist)) 345 else if (VECTORP (alist))
337 list = 0; 346 list = 0;
338 else if (NILP (alist)) 347 else if (NILP (alist))
339 list = 1; 348 list = 1;
340 else 349 else
377 else 386 else
378 { 387 {
379 if (!ZEROP (bucket)) 388 if (!ZEROP (bucket))
380 { 389 {
381 struct Lisp_Symbol *next; 390 struct Lisp_Symbol *next;
382 if (!SYMBOLP (bucket)) { 391 if (!SYMBOLP (bucket))
383 signal_simple_error("Bad obarry passed to try-completions", 392 {
384 bucket); 393 signal_simple_error ("Bad obarray passed to try-completions",
385 } 394 bucket);
395 }
386 next = symbol_next (XSYMBOL (bucket)); 396 next = symbol_next (XSYMBOL (bucket));
387 elt = bucket; 397 elt = bucket;
388 eltstring = Fsymbol_name (elt); 398 eltstring = Fsymbol_name (elt);
389 if (next) 399 if (next)
390 XSETSYMBOL (bucket, next); 400 XSETSYMBOL (bucket, next);
527 Charcount slength; 537 Charcount slength;
528 538
529 CHECK_STRING (string); 539 CHECK_STRING (string);
530 540
531 if (CONSP (alist)) 541 if (CONSP (alist))
532 { 542 {
533 Lisp_Object tem = XCAR (alist); 543 Lisp_Object tem = XCAR (alist);
534 if (SYMBOLP (tem)) /* lambda, autoload, etc. Emacs-lisp sucks */ 544 if (SYMBOLP (tem)) /* lambda, autoload, etc. Emacs-lisp sucks */
535 return call3 (alist, string, pred, Qt); 545 return call3 (alist, string, pred, Qt);
536 else 546 else
537 list = 1; 547 list = 1;
538 } 548 }
539 else if (VECTORP (alist)) 549 else if (VECTORP (alist))
540 list = 0; 550 list = 0;
541 else if (NILP (alist)) 551 else if (NILP (alist))
542 list = 1; 552 list = 1;
543 else 553 else