* lisp/minibuffer.el: Avoid consecutive `any` in completion patterns
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 28 Dec 2020 19:58:39 +0000 (14:58 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 28 Dec 2020 19:58:39 +0000 (14:58 -0500)
(completion-pcm--optimize-pattern): Turn multiple consecutive
occurrences of `any` into just a single one.
Suggested by Dario Gjorgjevski <dario.gjorgjevski@gmail.com>.

lisp/minibuffer.el

index 7d05f7704e9a28de65dcb9eec941b101d9ed6686..c8c106c336a1e2b2ff65a40e8757a8008d596f7e 100644 (file)
@@ -3159,7 +3159,8 @@ or a symbol, see `completion-pcm--merge-completions'."
   (let ((n '()))
     (while p
       (pcase p
-        (`(,(or 'any 'any-delim) point . ,rest) (setq p `(point . ,rest)))
+        (`(,(or 'any 'any-delim) ,(or 'any 'point) . ,rest)
+         (setq p (cdr p)))
         ;; This is not just a performance improvement: it turns a
         ;; terminating `point' into an implicit `any', which affects
         ;; the final position of point (because `point' gets turned