Function: todo-insert-sort-button
todo-insert-sort-button is a byte-compiled function defined in
todo-mode.el.gz.
Signature
(todo-insert-sort-button LABEL)
Documentation
Insert button for displaying categories sorted by item counts.
LABEL determines which type of count is sorted.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
(defun todo-insert-sort-button (label)
"Insert button for displaying categories sorted by item counts.
LABEL determines which type of count is sorted."
(let* ((str (if (string= label todo-categories-category-label)
(todo-padded-string label)
label))
(beg (point))
(end (+ beg (length str)))
ov)
(insert-button str 'face nil
'action
(lambda (_button)
(let ((key (todo-label-to-key label)))
(if (and (member key todo-descending-counts)
(eq key 'alpha))
(progn
;; If display is alphabetical, switch back to
;; category priority order.
(todo-display-sorted nil)
(setq todo-descending-counts
(delete key todo-descending-counts)))
(todo-display-sorted key)))))
(setq ov (make-overlay beg end))
(overlay-put ov 'face 'todo-button)))