# HG changeset patch # User John Paul Wallington # Date 1209604655 0 # Node ID f72e4491c400f99896c5a551f4173805a0b1fde2 # Parent 7bff87bfc341ab16c1ed660b5cbc613295c60754 (ibuffer-last-sorting-mode): New variable. (ibuffer-do-sort-by-recency): Reverse sorting order if last sorting mode was recency. diff -r 7bff87bfc341 -r f72e4491c400 lisp/ibuffer.el --- 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)