Function: define-ibuffer-column
define-ibuffer-column is an autoloaded macro defined in
ibuf-macs.el.gz.
Signature
(define-ibuffer-column SYMBOL (&key NAME INLINE PROPS SUMMARIZER) &rest BODY)
Documentation
Define a column SYMBOL for use with ibuffer-formats.
BODY will be called with buffer bound to the buffer object, and
mark bound to the current mark on the buffer. The original ibuffer
buffer will be bound to ibuffer-buf.
If NAME is given, it will be used as a title for the column.
Otherwise, the title will default to a capitalized version of the
SYMBOL's name. PROPS is a plist of additional properties to add to
the text, such as mouse-face. And SUMMARIZER, if given, is a
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
change its definition, you should explicitly call
ibuffer-recompile-formats.
Source Code
;; Defined in /usr/src/emacs/lisp/ibuf-macs.el.gz
;;;###autoload
(cl-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
`mark' bound to the current mark on the buffer. The original ibuffer
buffer will be bound to `ibuffer-buf'.
If NAME is given, it will be used as a title for the column.
Otherwise, the title will default to a capitalized version of the
SYMBOL's name. PROPS is a plist of additional properties to add to
the text, such as `mouse-face'. And SUMMARIZER, if given, is a
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
change its definition, you should explicitly call
`ibuffer-recompile-formats'.
\(fn SYMBOL (&key NAME INLINE PROPS SUMMARIZER) &rest BODY)"
(declare (indent defun))
(let* ((sym (intern (concat "ibuffer-make-column-"
(symbol-name symbol))))
(bod-1 `(with-current-buffer buffer
,@body))
(bod (if props
`(propertize
,bod-1
,@props)
bod-1)))
`(progn
,(if inline
`(push '(,sym ,bod) ibuffer-inline-columns)
`(defun ,sym (buffer mark)
(ignore mark) ;Silence byte-compiler if mark is unused.
,bod))
(put (quote ,sym) 'ibuffer-column-name
,(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
(quote ,summarizer)))
,(if summarizer
;; This will store the actual values of the column
;; summary.
`(put (quote ,sym) 'ibuffer-column-summary nil))
:autoload-end)))