comparison src/minibuf.c @ 5666:daf5accfe973

Use #'test-completion, minibuf.el, instead of implementing same. lisp/ChangeLog addition: 2012-05-14 Aidan Kehoe <kehoea@parhasard.net> Update minibuf.el to use #'test-completion, use the generality of recent completion changes to avoid some unnecessary consing when reading. * behavior.el (read-behavior): * cus-edit.el (custom-face-prompt): * cus-edit.el (widget-face-action): * faces.el (read-face-name): * minibuf.el: * minibuf.el (minibuffer-completion-table): * minibuf.el (exact-minibuffer-completion-p): Removed. #'test-completion is equivalent to this, but more general. * minibuf.el (minibuffer-do-completion-1): Use #'test-completion. * minibuf.el (completing-read): Update the documentation of the arguments used for completion. * minibuf.el (minibuffer-complete-and-exit): Use #'test-completion. * minibuf.el (exit-minibuffer): Use #'test-completion. * minibuf.el (minibuffer-smart-mouse-tracker): Use #'test-completion. * minibuf.el (read-color): No need to construct a completion table separate from the colour list. src/ChangeLog addition: 2012-05-14 Aidan Kehoe <kehoea@parhasard.net> * minibuf.c (Ftest_completion): Correct some documentation here.
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 14 May 2012 08:46:05 +0100
parents 2014ff433daf
children b79e1e02bf01
comparison
equal deleted inserted replaced
5665:8593e614573a 5666:daf5accfe973
686 686
687 return 0; 687 return 0;
688 } 688 }
689 689
690 DEFUN ("test-completion", Ftest_completion, 2, 3, 0, /* 690 DEFUN ("test-completion", Ftest_completion, 2, 3, 0, /*
691 Return non-nil if STRING is a valid completion in COLLECTION. 691 Return non-nil if STRING is an exact completion in COLLECTION.
692 692
693 COLLECTION must be a list, a hash table, an obarray, or a function. 693 COLLECTION must be a list, a hash table, an obarray, or a function.
694 694
695 Each string (or symbol) in COLLECTION is tested to see if it (or its 695 Each string (or symbol) in COLLECTION is tested to see if it (or its
696 name) begins with STRING. The value is a list of all the strings from 696 name) begins with STRING, until a valid, exact completion is found.
697 COLLECTION that match.
698 697
699 If COLLECTION is a list, the elements of the list that are not cons 698 If COLLECTION is a list, the elements of the list that are not cons
700 cells and the cars of the elements of the list that are cons cells 699 cells and the cars of the elements of the list that are cons cells
701 \(which must be strings or symbols) form the set of possible 700 \(which must be strings or symbols) form the set of possible
702 completions. 701 completions.
753 752
754 return ignore_completion_p (XSYMBOL_NAME (lookup), tcc.predicate, 753 return ignore_completion_p (XSYMBOL_NAME (lookup), tcc.predicate,
755 lookup, 0) ? Qnil : Qt; 754 lookup, 0) ? Qnil : Qt;
756 755
757 /* It would be reasonable to do something similar for the hash 756 /* It would be reasonable to do something similar for the hash
758 tables, except, both symbol and string keys are vaild 757 tables, except, both symbol and string keys are valid
759 completions there. So a negative #'gethash for the string 758 completions there. So a negative #'gethash for the string
760 (with #'equal as the hash table tests) still means you have 759 (with #'equal as the hash table tests) still means you have
761 to do the linear search, for any symbols with that string 760 to do the linear search, for any symbols with that string
762 name, which hash very differently; returning t is a little 761 name, which hash very differently; returning t is a little
763 quicker, but returning nil is just as slow, so our average 762 quicker, but returning nil is just as slow, so our average