changeset 94507:f72e4491c400

(ibuffer-last-sorting-mode): New variable. (ibuffer-do-sort-by-recency): Reverse sorting order if last sorting mode was recency.
author John Paul Wallington <jpw@pobox.com>
date Thu, 01 May 2008 01:17:35 +0000
parents 7bff87bfc341
children 4d31120b081e
files lisp/ibuffer.el
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ibuffer.el	Thu May 01 00:53:35 2008 +0000
+++ b/lisp/ibuffer.el	Thu May 01 01:17:35 2008 +0000
@@ -214,6 +214,7 @@
 		 (const :tag "Major mode" :value major-mode))
   :group 'ibuffer)
 (defvar ibuffer-sorting-mode nil)
+(defvar ibuffer-last-sorting-mode nil)
 
 (defcustom ibuffer-default-sorting-reversep nil
   "If non-nil, reverse the default sorting order."
@@ -1997,7 +1998,10 @@
   "Sort the buffers by last view time."
   (interactive)
   (setq ibuffer-sorting-mode 'recency)
-  (ibuffer-update nil t))
+  (when (eq ibuffer-last-sorting-mode 'recency)
+    (setq ibuffer-sorting-reversep (not ibuffer-sorting-reversep)))
+  (ibuffer-update nil t)
+  (setq ibuffer-last-sorting-mode 'recency))
 
 (defun ibuffer-update-format ()
   (when (null ibuffer-current-format)