Function: ibuffer-update-title-and-summary
ibuffer-update-title-and-summary is a byte-compiled function defined
in ibuffer.el.gz.
Signature
(ibuffer-update-title-and-summary FORMAT)
Source Code
;; Defined in /usr/src/emacs/lisp/ibuffer.el.gz
(defun ibuffer-update-title-and-summary (format)
(ibuffer-assert-ibuffer-mode)
;; Don't do funky font-lock stuff here
(let ((inhibit-modification-hooks t))
(if (get-text-property (point-min) 'ibuffer-title)
(delete-region (point-min)
(next-single-property-change
(point-min) 'ibuffer-title)))
(goto-char (point-min))
(add-text-properties
(point)
(progn
(let ((opos (point)))
;; Insert the title names.
(dolist (element format)
(insert
(if (stringp element)
element
(pcase-let ((`(,sym ,min ,_max ,align) element))
;; Ignore a negative min when we're inserting the title
(when (cl-minusp min)
(setq min (- min)))
(let* ((name (or (get sym 'ibuffer-column-name)
(error "Unknown column %s in ibuffer-formats" sym)))
(len (length name))
(hmap (get sym 'header-mouse-map))
(strname (if (< len min)
(ibuffer-format-column name
(- min len)
align)
name)))
(when hmap
(setq
strname
(propertize strname 'mouse-face 'highlight 'keymap hmap)))
strname)))))
(add-text-properties opos (point) '(ibuffer-title-header t))
(insert "\n")
;; Add the underlines
(let ((str (save-excursion
(forward-line -1)
(beginning-of-line)
(buffer-substring (point) (line-end-position)))))
(apply #'insert (mapcar
(lambda (c)
(if (not (or (eq c ?\s)
(eq c ?\n)))
?-
?\s))
str)))
(insert "\n"))
(point))
`(ibuffer-title t font-lock-face ,ibuffer-title-face))
;; Now, insert the summary columns.
(goto-char (point-max))
(if (get-text-property (1- (point-max)) 'ibuffer-summary)
(delete-region (previous-single-property-change
(point-max) 'ibuffer-summary)
(point-max)))
(if ibuffer-display-summary
(add-text-properties
(point)
(progn
(insert "\n")
(dolist (element format)
(insert
(if (stringp element)
(make-string (length element) ?\s)
(pcase-let ((`(,sym ,min ,_max ,align) element))
;; Ignore a negative min when we're inserting the title.
(when (cl-minusp min)
(setq min (- min)))
(let* ((summary
(if (get sym 'ibuffer-column-summarizer)
(funcall (get sym 'ibuffer-column-summarizer)
(get sym 'ibuffer-column-summary))
(make-string
(length (get sym 'ibuffer-column-name))
?\s)))
(len (length summary)))
(if (< len min)
(ibuffer-format-column summary
(- min len)
align)
summary))))))
(point))
'(ibuffer-summary t)))))