Function: todo-reset-nondiary-marker

todo-reset-nondiary-marker is a byte-compiled function defined in todo-mode.el.gz.

Signature

(todo-reset-nondiary-marker SYMBOL VALUE)

Documentation

The :set function for user option todo-nondiary-marker.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
(defun todo-reset-nondiary-marker (symbol value)
  "The :set function for user option `todo-nondiary-marker'."
  (let* ((oldvalue (symbol-value symbol))
	 (files (append todo-files todo-archives
			(directory-files todo-directory t "\\.tod[rty]\\'" t))))
    (custom-set-default symbol value)
    ;; Need to reset these to get font-locking right.
    (setq todo-nondiary-start (nth 0 todo-nondiary-marker)
	  todo-nondiary-end (nth 1 todo-nondiary-marker)
	  todo-date-string-start
	  ;; See comment in defvar of `todo-date-string-start'.
	  (concat "^\\(" (regexp-quote todo-nondiary-start) "\\|"
		  (regexp-quote diary-nonmarking-symbol) "\\)?"))
    (when (not (equal value oldvalue))
      (dolist (f files)
	(let ((buf (find-buffer-visiting f)))
	  (with-current-buffer (find-file-noselect f)
	    (let (buffer-read-only)
	      (widen)
	      (goto-char (point-min))
	      (while (not (eobp))
		(if (re-search-forward
		     (concat "^\\(" todo-done-string-start "[^][]+] \\)?"
			     "\\(?1:" (regexp-quote (car oldvalue))
			     "\\)" todo-date-pattern "\\( "
			     diary-time-regexp "\\)?\\(?2:"
			     (regexp-quote (cadr oldvalue)) "\\)")
		     nil t)
		    (progn
		      (replace-match (nth 0 value) t t nil 1)
		      (replace-match (nth 1 value) t t nil 2))
		  (forward-line)))
	      (if buf
		  (when (derived-mode-p 'todo-mode 'todo-archive-mode)
		    (todo-category-select))
		(save-buffer)
		(kill-buffer)))))))))