summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-03-16 20:43:54 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2011-03-16 20:43:54 -0400
commit40c2934bb82fff3c987d0f0451631279dffc0c90 (patch)
treee15b71851c7801b245bb31522367f4c9201bbc00 /lisp/minibuffer.el
parentb091141444a16b1d46a627a76957ab7af2309836 (diff)
downloademacs-40c2934bb82fff3c987d0f0451631279dffc0c90.tar.gz
* lisp/minibuffer.el (completion-all-sorted-completions):
Use :completion-cycle-penalty text property if present.
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 3c8628c9cfa..fa36da01cd9 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -704,7 +704,15 @@ scroll the window of possible completions."
(when last
(setcdr last nil)
;; Prefer shorter completions.
- (setq all (sort all (lambda (c1 c2) (< (length c1) (length c2)))))
+ (setq all (sort all (lambda (c1 c2)
+ (let ((s1 (get-text-property
+ 0 :completion-cycle-penalty c1))
+ (s2 (get-text-property
+ 0 :completion-cycle-penalty c2)))
+ (if (eq s1 s2)
+ (< (length c1) (length c2))
+ (< (or s1 (length c1))
+ (or s2 (length c2))))))))
;; Prefer recently used completions.
(let ((hist (symbol-value minibuffer-history-variable)))
(setq all (sort all (lambda (c1 c2)