Mercurial > emacs
comparison lisp/ibuf-ext.el @ 43379:3fce95e542b1
(ibuffer-toggle-sorting-mode): Make it work. Patch from John Paul
Wallington <jpw@shootybangbang.com>.
author | Colin Walters <walters@gnu.org> |
---|---|
date | Sun, 17 Feb 2002 08:57:24 +0000 |
parents | 280c82e97c2a |
children | a08f4763cba4 |
comparison
equal
deleted
inserted
replaced
43378:5043145dbf59 | 43379:3fce95e542b1 |
---|---|
652 ;;; Sorting | 652 ;;; Sorting |
653 | 653 |
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. |
657 Possible sorting modes are: | 657 Default 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 |
677 (defun ibuffer-invert-sorting () | 674 (defun ibuffer-invert-sorting () |
678 "Toggle whether or not sorting is in reverse order." | 675 "Toggle whether or not sorting is in reverse order." |