aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Walters2002-02-17 08:57:24 +0000
committerColin Walters2002-02-17 08:57:24 +0000
commit13e14c5148d111774ee113d2181ef50e43dd90ba (patch)
tree10148d664cc78750fb4c62b0cfb7347cc095b75f
parent9b25ea40c51436aa298f7d4547bd169e8e53b659 (diff)
downloademacs-13e14c5148d111774ee113d2181ef50e43dd90ba.tar.gz
emacs-13e14c5148d111774ee113d2181ef50e43dd90ba.zip
(ibuffer-toggle-sorting-mode): Make it work. Patch from John Paul
Wallington <jpw@shootybangbang.com>.
-rw-r--r--lisp/ibuf-ext.el21
1 files changed, 9 insertions, 12 deletions
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 9d914fae7c8..e5b85fd5a86 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -654,23 +654,20 @@ of replacing the current filters."
654;;;###autoload 654;;;###autoload
655(defun ibuffer-toggle-sorting-mode () 655(defun ibuffer-toggle-sorting-mode ()
656 "Toggle the current sorting mode. 656 "Toggle the current sorting mode.
657Possible sorting modes are: 657Default sorting modes are:
658 Recency - the last time the buffer was viewed 658 Recency - the last time the buffer was viewed
659 Name - the name of the buffer 659 Name - the name of the buffer
660 Major Mode - the name of the major mode of the buffer 660 Major Mode - the name of the major mode of the buffer
661 Size - the size of the buffer" 661 Size - the size of the buffer"
662 (interactive) 662 (interactive)
663 (let* ((keys (mapcar #'car ibuffer-sorting-functions-alist)) 663 (let ((modes (mapcar 'car ibuffer-sorting-functions-alist)))
664 (entry (memq ibuffer-sorting-mode keys)) 664 (add-to-list 'modes 'recency)
665 (next (or (cadr entry) (car keys))) 665 (setq modes (sort modes 'string-lessp))
666 (nextentry (assq next ibuffer-sorting-functions-alist))) 666 (let ((next (or (find-if
667 (if (and entry nextentry) 667 (lambda (x) (string-lessp ibuffer-sorting-mode x)) modes)
668 (progn 668 (car modes))))
669 (setq ibuffer-sorting-mode next) 669 (setq ibuffer-sorting-mode next)
670 (message "Sorting by %s" (cadr nextentry))) 670 (message "Sorting by %s" next)))
671 (progn
672 (setq ibuffer-sorting-mode 'recency)
673 (message "Sorting by last view time"))))
674 (ibuffer-redisplay t)) 671 (ibuffer-redisplay t))
675 672
676;;;###autoload 673;;;###autoload