Function: todo-reset-comment-string

todo-reset-comment-string is a byte-compiled function defined in todo-mode.el.gz.

Signature

(todo-reset-comment-string SYMBOL VALUE)

Documentation

The :set function for user option todo-comment-string.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
(defun todo-reset-comment-string (symbol value)
  "The :set function for user option `todo-comment-string'."
  (let ((oldvalue (symbol-value symbol))
        (files (append todo-files todo-archives
		       (directory-files todo-directory t "\\.todr\\'" t))))
    (custom-set-default symbol value)
    (when (not (equal value oldvalue))
      (dolist (f files)
	(let ((buf (find-buffer-visiting f)))
	  (with-current-buffer (find-file-noselect f)
	    (let ((inhibit-read-only t))
	      (widen)
	      (goto-char (point-min))
	      (while (not (eobp))
		(if (re-search-forward
		     (concat "\\[\\(" (regexp-quote oldvalue)
			     "\\): [^]]*\\]")
		     nil t)
		    (replace-match value t t nil 1)
		  (forward-line)))
	      (if buf
		  (when (derived-mode-p '(todo-mode todo-archive-mode))
		    (todo-category-select))
		(save-buffer)
		(kill-buffer)))))))))