]> code.delx.au - gnu-emacs/blobdiff - lisp/ibuf-macs.el
(define-ibuffer-sorter): Define the sorter to reverse sorting order if
[gnu-emacs] / lisp / ibuf-macs.el
index 1ea7e0ba6be2d9bb9e28ab80757e7d146d59dda1..947c2b7040af8856025ea2e622de4d87864aa3c8 100644 (file)
@@ -150,7 +150,10 @@ value if and only if `a' is \"less than\" `b'.
        ,(or documentation "No :documentation specified for this sorting method.")
        (interactive)
        (setq ibuffer-sorting-mode ',name)
-       (ibuffer-redisplay t))
+       (when (eq ibuffer-sorting-mode ibuffer-last-sorting-mode)
+        (setq ibuffer-sorting-reversep (not ibuffer-sorting-reversep)))
+       (ibuffer-redisplay t)
+       (setq ibuffer-last-sorting-mode ',name))
      (push (list ',name ,description
                 #'(lambda (a b)
                     ,@body))
@@ -299,5 +302,5 @@ bound to the current value of the filter.
 
 (provide 'ibuf-macs)
 
-;;; arch-tag: 2748edce-82c9-4cd9-9d9d-bd73e43c20c5
+;; arch-tag: 2748edce-82c9-4cd9-9d9d-bd73e43c20c5
 ;;; ibuf-macs.el ends here