Function: todo-category-select
todo-category-select is a byte-compiled function defined in
todo-mode.el.gz.
Signature
(todo-category-select)
Documentation
Display the current category correctly.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
(defun todo-category-select ()
"Display the current category correctly."
(let ((name (todo-current-category))
cat-begin cat-end done-start done-sep-start done-end)
(widen)
(goto-char (point-min))
(re-search-forward
(concat "^" (regexp-quote (concat todo-category-beg name)) "$") nil t)
(setq cat-begin (1+ (line-end-position)))
(setq cat-end (if (re-search-forward
(concat "^" (regexp-quote todo-category-beg)) nil t)
(match-beginning 0)
(point-max)))
(setq mode-line-buffer-identification
(funcall todo-mode-line-function name))
(narrow-to-region cat-begin cat-end)
(todo-prefix-overlays)
(goto-char (point-min))
(if (re-search-forward (concat "\n\\(" (regexp-quote todo-category-done)
"\\)")
nil t)
(progn
(setq done-start (match-beginning 0))
(setq done-sep-start (match-beginning 1))
(setq done-end (match-end 0)))
(error "Category %s is missing todo-category-done string" name))
(if todo-show-done-only
(narrow-to-region (1+ done-end) (point-max))
(when (and todo-show-with-done
(re-search-forward todo-done-string-start nil t))
;; Now we want to see the done items, so reset displayed end to end of
;; done items.
(setq done-start cat-end)
;; Make display overlay for done items separator string, unless there
;; already is one.
(let* ((done-sep todo-done-separator)
(ov (progn (goto-char done-sep-start)
(todo-get-overlay 'separator))))
(unless ov
(setq ov (make-overlay done-sep-start done-end))
(overlay-put ov 'todo 'separator)
(overlay-put ov 'display done-sep))))
(narrow-to-region (point-min) done-start)
;; Loading this from todo-mode, or adding it to the mode hook, causes
;; Emacs to hang in todo-item-start, at (looking-at todo-item-start).
(when todo-highlight-item
(require 'hl-line)
(hl-line-mode 1)))))