]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/minibuffer.el (completion-all-sorted-completions):
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 17 Mar 2011 00:43:54 +0000 (20:43 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 17 Mar 2011 00:43:54 +0000 (20:43 -0400)
Use :completion-cycle-penalty text property if present.

lisp/ChangeLog
lisp/minibuffer.el

index e1bce10b980402c8dd0440223f2723ad6416274b..957038b3e40a2148eb1f7b376bdc636ad74edcdd 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (completion-all-sorted-completions):
+       Use :completion-cycle-penalty text property if present.
+
 2011-03-16  Ken Manheimer  <ken.manheimer@gmail.com>
 
        * allout.el (allout-yank-processing): Adjust for new rebulleting
index 3c8628c9cfaccc32909a37c749f5cf57740f23c1..fa36da01cd9f2d4cc8ee12a9fc77b3338d52f2df 100644 (file)
@@ -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)