Function: todo-edit-category-diary-inclusion

todo-edit-category-diary-inclusion is an interactive and byte-compiled function defined in todo-mode.el.gz.

Signature

(todo-edit-category-diary-inclusion ARG)

Documentation

Make all items in this category diary items.

With prefix ARG, make all items in this category non-diary items.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
(defun todo-edit-category-diary-inclusion (arg)
  "Make all items in this category diary items.
With prefix ARG, make all items in this category non-diary
items."
  (interactive "P")
  (save-excursion
    (goto-char (point-min))
    (let ((todo-count (todo-get-count 'todo))
	  (diary-count (todo-get-count 'diary))
	  (buffer-read-only))
      (catch 'stop
	(while (not (eobp))
	  (if (todo-done-item-p)	; We've gone too far.
	      (throw 'stop nil)
	    (let* ((_beg (todo-item-start))
		   (lim (save-excursion (todo-item-end)))
		   (end (save-excursion
			  (or (todo-time-string-matcher lim)
			      (todo-date-string-matcher lim)))))
	      (if arg
		  (unless (looking-at (regexp-quote todo-nondiary-start))
		    (when (looking-at (regexp-quote diary-nonmarking-symbol))
		      (replace-match "")
		      (setq end (1- end))) ; Since we deleted nonmarking symbol.
		    (insert todo-nondiary-start)
		    (goto-char (1+ end))
		    (insert todo-nondiary-end))
		(when (looking-at (regexp-quote todo-nondiary-start))
		  (replace-match "")
		  (search-forward todo-nondiary-end (1+ end) t)
		  (replace-match "")))))
	  (todo-forward-item))
	(unless (if arg (zerop diary-count) (= diary-count todo-count))
	  (todo-update-count 'diary (if arg
				      (- diary-count)
				    (- todo-count diary-count))))
	(todo-update-categories-sexp)))))