From 1ed2086a03a5f33482d2f184e57dad9e6a9d25d8 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Tue, 20 Jun 2017 22:19:51 -0400 Subject: [PATCH] Keep order of completion candidates (Bug#25995, Bug#24676) * lisp/minibuffer.el (completion-pcm--filename-try-filter) (completion-pcm--all-completions): Use nreverse to undo the reversing caused by using push in the loop. --- lisp/minibuffer.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 0377cd549a2..c3480cd6c64 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3006,7 +3006,7 @@ PATTERN is as returned by `completion-pcm--string->pattern'." (let ((poss ())) (dolist (c compl) (when (string-match-p regex c) (push c poss))) - poss))))) + (nreverse poss)))))) (defun completion-pcm--hilit-commonality (pattern completions) (when completions @@ -3258,7 +3258,7 @@ the same set of elements." "\\)\\'"))) (dolist (f all) (unless (string-match-p re f) (push f try))) - (or try all)))) + (or (nreverse try) all)))) (defun completion-pcm--merge-try (pattern all prefix suffix) -- 2.39.2