Function: todo-toggle-item-header

todo-toggle-item-header is an interactive and byte-compiled function defined in todo-mode.el.gz.

Signature

(todo-toggle-item-header)

Documentation

Hide or show item date-time headers in the current file.

With done items, this hides only the done date-time string, not the original date-time string.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
(defun todo-toggle-item-header ()
  "Hide or show item date-time headers in the current file.
With done items, this hides only the done date-time string, not
the original date-time string."
  (interactive)
  (unless (catch 'nonempty
	    (dolist (type '(todo done))
              (dolist (c todo-categories)
                (let ((count (todo-get-count type (car c))))
                  (unless (zerop count)
                    (throw 'nonempty t))))))
    (user-error "This file has no items"))
  (if todo--item-headers-hidden
      (progn
        (remove-overlays 1 (1+ (buffer-size)) 'todo 'header)
        (setq todo--item-headers-hidden nil))
    (save-excursion
      (save-restriction
        (widen)
        (goto-char (point-min))
        (let (ov)
          (while (not (eobp))
            (when (re-search-forward
                   (concat todo-item-start
                           "\\( " diary-time-regexp "\\)?"
                           (regexp-quote todo-nondiary-end) "? ")
                   nil t)
              (setq ov (make-overlay (match-beginning 0) (match-end 0) nil t))
              (overlay-put ov 'todo 'header)
              (overlay-put ov 'display ""))
            (forward-line)))
        (setq todo--item-headers-hidden t)))))