;;; ibuf-macs.el --- macros for ibuffer
;; Copyright (C) 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006 Free Software Foundation, Inc.
+;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Author: Colin Walters <walters@verbum.org>
;; Maintainer: John Paul Wallington <jpw@gnu.org>
;; This file is part of GNU Emacs.
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation; either version 2, or (at
-;; your option) any later version.
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;; General Public License for more details.
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with this program ; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; (put 'ibuffer-save-marks 'lisp-indent-function 0)
;;;###autoload
-(defmacro* define-ibuffer-column (symbol (&key name inline props
- summarizer) &rest body)
+(defmacro* define-ibuffer-column (symbol (&key name inline props summarizer
+ header-mouse-map) &rest body)
"Define a column SYMBOL for use with `ibuffer-formats'.
BODY will be called with `buffer' bound to the buffer object, and
function which will be passed a list of all the strings in its column;
it should return a string to display at the bottom.
+If HEADER-MOUSE-MAP is given, it will be used as a keymap for the
+title of the column.
+
Note that this macro expands into a `defun' for a function named
ibuffer-make-column-NAME. If INLINE is non-nil, then the form will be
inlined into the compiled format versions. This means that if you
,(if (stringp name)
name
(capitalize (symbol-name symbol))))
+ ,(if header-mouse-map `(put (quote ,sym) 'header-mouse-map ,header-mouse-map))
,(if summarizer
;; Store the name of the summarizing function.
`(put (quote ,sym) 'ibuffer-column-summarizer
,(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))
(provide 'ibuf-macs)
-;;; arch-tag: 2748edce-82c9-4cd9-9d9d-bd73e43c20c5
+;; arch-tag: 2748edce-82c9-4cd9-9d9d-bd73e43c20c5
;;; ibuf-macs.el ends here