emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103674: * lisp/minibuffer.el (comple


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103674: * lisp/minibuffer.el (completion-all-sorted-completions):
Date: Wed, 16 Mar 2011 20:43:54 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103674
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2011-03-16 20:43:54 -0400
message:
  * lisp/minibuffer.el (completion-all-sorted-completions):
  Use :completion-cycle-penalty text property if present.
modified:
  lisp/ChangeLog
  lisp/minibuffer.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-16 19:03:06 +0000
+++ b/lisp/ChangeLog    2011-03-17 00:43:54 +0000
@@ -1,3 +1,8 @@
+2011-03-17  Stefan Monnier  <address@hidden>
+
+       * minibuffer.el (completion-all-sorted-completions):
+       Use :completion-cycle-penalty text property if present.
+
 2011-03-16  Ken Manheimer  <address@hidden>
 
        * allout.el (allout-yank-processing): Adjust for new rebulleting

=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2011-02-12 18:30:13 +0000
+++ b/lisp/minibuffer.el        2011-03-17 00:43:54 +0000
@@ -704,7 +704,15 @@
         (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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]