Function: todo-update-categories-display
todo-update-categories-display is a byte-compiled function defined in
todo-mode.el.gz.
Signature
(todo-update-categories-display SORTKEY)
Documentation
Populate table of categories and sort by SORTKEY.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
(defun todo-update-categories-display (sortkey)
"Populate table of categories and sort by SORTKEY."
(let* ((cats0 todo-categories)
(cats (todo-sort cats0 sortkey))
(archive (member todo-current-todo-file todo-archives))
(todo-categories-category-number 0)
;; Find start of Category button if we just entered Todo Categories
;; mode.
(pt (if (eq (point) (point-max))
(save-excursion
(forward-line -2)
(goto-char (next-single-char-property-change
(point) 'face nil (line-end-position))))))
(inhibit-read-only t))
(forward-line 2)
(delete-region (point) (point-max))
;; Fill in the table with buttonized lines, each showing a category and
;; its item counts.
(dolist (cat cats)
(todo-insert-category-line (car cat) sortkey))
(newline)
;; Add a line showing item count totals.
(insert (make-string (+ 4 (length todo-categories-number-separator)) 32)
(todo-padded-string todo-categories-totals-label)
(mapconcat
(lambda (elt)
(concat
(make-string (1+ (/ (length (car elt)) 2)) 32)
(format "%3d" (nth (cdr elt) (todo-total-item-counts)))
;; Add an extra space if label length is odd.
(when (oddp (length (car elt))) " ")))
(if archive
(list (cons todo-categories-done-label 2))
(list (cons todo-categories-todo-label 0)
(cons todo-categories-diary-label 1)
(cons todo-categories-done-label 2)
(cons todo-categories-archived-label 3)))))
;; Put cursor on Category button initially.
(if pt (goto-char pt))
(setq buffer-read-only t)))