]> git.eshelyaron.com Git - emacs.git/commitdiff
Robustify a helper function for test/lisp/minibuffer-tests.el
authorJoão Távora <joaotavora@gmail.com>
Mon, 28 Dec 2020 09:10:19 +0000 (09:10 +0000)
committerJoão Távora <joaotavora@gmail.com>
Tue, 29 Dec 2020 13:28:06 +0000 (13:28 +0000)
completion--pcm-first-difference-pos wasn't taking into account the
fact that faces may come in lists.  bug#42149

* test/lisp/minibuffer-tests.el
(completion--pcm-first-difference-pos): Robustify.

test/lisp/minibuffer-tests.el

index d665587ba26b28ef0d33034620491470f3531d81..381096f8c5c48a1e0d3d6e65a5185072a6d26836 100644 (file)
   (get-text-property 0 'completion-score comp))
 
 (defun completion--pcm-first-difference-pos (comp)
-  (cl-loop for pos = (next-single-property-change 0 'face comp)
+  (cl-loop with faces
+           for pos = (next-single-property-change 0 'face comp)
            then (next-single-property-change pos 'face comp)
            while pos
-           when (eq (get-text-property pos 'face comp)
-                    'completions-first-difference)
+           when (or (eq (setq faces (get-text-property pos 'face comp))
+                        'completions-first-difference)
+                    (and (listp faces)
+                         (memq 'completions-first-difference faces)))
            return pos))
 
 (ert-deftest completion-pcm-test-1 ()