From c7fdf8688388f137dbfab2f372fa33c24241b83a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 28 Dec 2020 14:58:39 -0500 Subject: [PATCH] * lisp/minibuffer.el: Avoid consecutive `any` in completion patterns (completion-pcm--optimize-pattern): Turn multiple consecutive occurrences of `any` into just a single one. Suggested by Dario Gjorgjevski . --- lisp/minibuffer.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 7d05f7704e9..c8c106c336a 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -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 -- 2.39.5