diff options
| -rw-r--r-- | lisp/minibuffer.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index c8b84b0e947..b757eb8a5a6 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -1244,12 +1244,16 @@ scroll the window of possible completions." | |||
| 1244 | (setq all (if sort-fun (funcall sort-fun all) | 1244 | (setq all (if sort-fun (funcall sort-fun all) |
| 1245 | ;; Prefer shorter completions, by default. | 1245 | ;; Prefer shorter completions, by default. |
| 1246 | (sort all (lambda (c1 c2) (< (length c1) (length c2)))))) | 1246 | (sort all (lambda (c1 c2) (< (length c1) (length c2)))))) |
| 1247 | ;; Prefer recently used completions. | 1247 | ;; Prefer recently used completions and put the default, if |
| 1248 | ;; it exists, on top. | ||
| 1248 | (when (minibufferp) | 1249 | (when (minibufferp) |
| 1249 | (let ((hist (symbol-value minibuffer-history-variable))) | 1250 | (let ((hist (symbol-value minibuffer-history-variable))) |
| 1250 | (setq all (sort all (lambda (c1 c2) | 1251 | (setq all (sort all |
| 1251 | (> (length (member c1 hist)) | 1252 | (lambda (c1 c2) |
| 1252 | (length (member c2 hist)))))))) | 1253 | (cond ((equal c1 minibuffer-default) t) |
| 1254 | ((equal c2 minibuffer-default) nil) | ||
| 1255 | (t (> (length (member c1 hist)) | ||
| 1256 | (length (member c2 hist)))))))))) | ||
| 1253 | ;; Cache the result. This is not just for speed, but also so that | 1257 | ;; Cache the result. This is not just for speed, but also so that |
| 1254 | ;; repeated calls to minibuffer-force-complete can cycle through | 1258 | ;; repeated calls to minibuffer-force-complete can cycle through |
| 1255 | ;; all possibilities. | 1259 | ;; all possibilities. |