mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Fix handling of nil PRED2 arg for completion-table-with-predicate
* lisp/minibuffer.el (completion-table-with-predicate): Don't act as if strict is non-nil when pred2 is nil (Bug#27841). * test/lisp/minibuffer-tests.el (completion-table-with-predicate-test): Add a test for Bug#27841.
This commit is contained in:
parent
949b70a7d8
commit
255ba01148
2 changed files with 33 additions and 1 deletions
|
|
@ -42,5 +42,37 @@
|
|||
(should (equal (buffer-string)
|
||||
"test: "))))))
|
||||
|
||||
(ert-deftest completion-table-with-predicate-test ()
|
||||
(let ((full-collection
|
||||
'("apple" ; Has A.
|
||||
"beet" ; Has B.
|
||||
"banana" ; Has A & B.
|
||||
"cherry" ; Has neither.
|
||||
))
|
||||
(no-A (lambda (x) (not (string-match-p "a" x))))
|
||||
(no-B (lambda (x) (not (string-match-p "b" x)))))
|
||||
(should
|
||||
(member "cherry"
|
||||
(completion-table-with-predicate
|
||||
full-collection no-A t "" no-B t)))
|
||||
(should-not
|
||||
(member "banana"
|
||||
(completion-table-with-predicate
|
||||
full-collection no-A t "" no-B t)))
|
||||
;; "apple" should still match when strict is nil.
|
||||
(should (eq t (try-completion
|
||||
"apple"
|
||||
(apply-partially
|
||||
'completion-table-with-predicate
|
||||
full-collection no-A nil)
|
||||
no-B)))
|
||||
;; "apple" should still match when strict is nil and pred2 is nil
|
||||
;; (Bug#27841).
|
||||
(should (eq t (try-completion
|
||||
"apple"
|
||||
(apply-partially
|
||||
'completion-table-with-predicate
|
||||
full-collection no-A nil))))))
|
||||
|
||||
(provide 'completion-tests)
|
||||
;;; completion-tests.el ends here
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue