aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2023-11-16 00:16:31 -0500
committerStefan Monnier2023-11-16 00:16:31 -0500
commitdc61c0fd3ab1d8a869fd51998762467b09453091 (patch)
tree47e617e5f9cdfaf64707da8738729a4c309ee000
parentd03677343e9a54f76de7e3ac2db6e22df3fa4333 (diff)
downloademacs-dc61c0fd3ab1d8a869fd51998762467b09453091.tar.gz
emacs-dc61c0fd3ab1d8a869fd51998762467b09453091.zip
todo-mode.el: Don't let-bind `buffer-read-only`
Prefer let-binding `inhibit-read-only` so the code can freely change `buffer-read-only`. While at it, prefer #' to quote function names. * lisp/calendar/todo-mode.el (todo-rename-category) (todo-delete-category, todo-delete-item) (todo-edit-item--diary-inclusion, todo-edit-category-diary-inclusion) (todo-edit-category-diary-nonmarking, todo-archive-done-item) (todo-unarchive-items, todo-display-categories) (todo-update-categories-display, todo-filter-items-1) (todo-reset-nondiary-marker, todo-reset-done-separator-string) (todo-reset-done-string, todo-reset-comment-string): Bind `inhibit-read-only` instead of `buffer-read-only`. (todo-mode, todo-archive-mode, todo-edit-mode, todo-categories-mode) (todo-filtered-items-mode): Let `define-derived-mode` take care of adding the keymap to the docstring. (todo-mode, todo-archive-mode, todo-categories-mode) (todo-filtered-items-mode): Let `define-derived-mode` set `mode-class`.
-rw-r--r--lisp/calendar/todo-mode.el137
1 files changed, 60 insertions, 77 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index dbd1388848e..4f6a964eb4d 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -139,8 +139,8 @@ automatically recalculated when the window width changes. If the
139string consists of more (or less) than one character, it will be 139string consists of more (or less) than one character, it will be
140the value of `todo-done-separator'." 140the value of `todo-done-separator'."
141 :type 'string 141 :type 'string
142 :initialize 'custom-initialize-default 142 :initialize #'custom-initialize-default
143 :set 'todo-reset-done-separator-string 143 :set #'todo-reset-done-separator-string
144 :group 'todo-display) 144 :group 'todo-display)
145 145
146(defun todo-done-separator () 146(defun todo-done-separator ()
@@ -170,8 +170,8 @@ have its intended effect. The second string is inserted after
170the diary date." 170the diary date."
171 :type '(list string string) 171 :type '(list string string)
172 :group 'todo-edit 172 :group 'todo-edit
173 :initialize 'custom-initialize-default 173 :initialize #'custom-initialize-default
174 :set 'todo-reset-nondiary-marker) 174 :set #'todo-reset-nondiary-marker)
175 175
176(defconst todo-nondiary-start (nth 0 todo-nondiary-marker) 176(defconst todo-nondiary-start (nth 0 todo-nondiary-marker)
177 "String inserted before item date to block diary inclusion.") 177 "String inserted before item date to block diary inclusion.")
@@ -248,8 +248,8 @@ the date header.")
248(defcustom todo-done-string "DONE " 248(defcustom todo-done-string "DONE "
249 "Identifying string appended to the front of done todo items." 249 "Identifying string appended to the front of done todo items."
250 :type 'string 250 :type 'string
251 :initialize 'custom-initialize-default 251 :initialize #'custom-initialize-default
252 :set 'todo-reset-done-string 252 :set #'todo-reset-done-string
253 :group 'todo-edit) 253 :group 'todo-edit)
254 254
255(defconst todo-done-string-start 255(defconst todo-done-string-start
@@ -275,16 +275,16 @@ the date header.")
275 (format-message 275 (format-message
276 "Invalid value: must be distinct from `todo-item-mark'")) 276 "Invalid value: must be distinct from `todo-item-mark'"))
277 widget))) 277 widget)))
278 :initialize 'custom-initialize-default 278 :initialize #'custom-initialize-default
279 :set 'todo-reset-prefix 279 :set #'todo-reset-prefix
280 :group 'todo-display) 280 :group 'todo-display)
281 281
282(defcustom todo-number-prefix t 282(defcustom todo-number-prefix t
283 "Non-nil to prefix items with consecutively increasing integers. 283 "Non-nil to prefix items with consecutively increasing integers.
284These reflect the priorities of the items in each category." 284These reflect the priorities of the items in each category."
285 :type 'boolean 285 :type 'boolean
286 :initialize 'custom-initialize-default 286 :initialize #'custom-initialize-default
287 :set 'todo-reset-prefix 287 :set #'todo-reset-prefix
288 :group 'todo-display) 288 :group 'todo-display)
289 289
290(defun todo-mode-line-control (cat) 290(defun todo-mode-line-control (cat)
@@ -306,8 +306,8 @@ todo category. The resulting control becomes the local value of
306(defcustom todo-highlight-item nil 306(defcustom todo-highlight-item nil
307 "Non-nil means highlight items at point." 307 "Non-nil means highlight items at point."
308 :type 'boolean 308 :type 'boolean
309 :initialize 'custom-initialize-default 309 :initialize #'custom-initialize-default
310 :set 'todo-reset-highlight-item 310 :set #'todo-reset-highlight-item
311 :group 'todo-display) 311 :group 'todo-display)
312 312
313(defcustom todo-wrap-lines t 313(defcustom todo-wrap-lines t
@@ -605,8 +605,8 @@ This lacks the extension and directory components."
605 "Non-nil to make `todo-show' visit the current todo file. 605 "Non-nil to make `todo-show' visit the current todo file.
606Otherwise, `todo-show' always visits `todo-default-todo-file'." 606Otherwise, `todo-show' always visits `todo-default-todo-file'."
607 :type 'boolean 607 :type 'boolean
608 :initialize 'custom-initialize-default 608 :initialize #'custom-initialize-default
609 :set 'todo-set-show-current-file 609 :set #'todo-set-show-current-file
610 :group 'todo) 610 :group 'todo)
611 611
612(defcustom todo-show-first 'first 612(defcustom todo-show-first 'first
@@ -1367,7 +1367,7 @@ category there as well."
1367 (list archive))))) 1367 (list archive)))))
1368 (dolist (buf buffers) 1368 (dolist (buf buffers)
1369 (with-current-buffer (find-file-noselect buf) 1369 (with-current-buffer (find-file-noselect buf)
1370 (let (buffer-read-only) 1370 (let ((inhibit-read-only t))
1371 (setq todo-categories (todo-set-categories)) 1371 (setq todo-categories (todo-set-categories))
1372 (save-excursion 1372 (save-excursion
1373 (save-restriction 1373 (save-restriction
@@ -1415,7 +1415,7 @@ todo or done items."
1415 "\"" (and arg " and all its entries") 1415 "\"" (and arg " and all its entries")
1416 "? ")))) 1416 "? "))))
1417 (widen) 1417 (widen)
1418 (let ((buffer-read-only) 1418 (let ((inhibit-read-only t)
1419 (beg (re-search-backward 1419 (beg (re-search-backward
1420 (concat "^" (regexp-quote (concat todo-category-beg cat)) 1420 (concat "^" (regexp-quote (concat todo-category-beg cat))
1421 "\n") 1421 "\n")
@@ -1795,8 +1795,8 @@ only when no items are marked."
1795(defcustom todo-comment-string "COMMENT" 1795(defcustom todo-comment-string "COMMENT"
1796 "String inserted before optional comment appended to done item." 1796 "String inserted before optional comment appended to done item."
1797 :type 'string 1797 :type 'string
1798 :initialize 'custom-initialize-default 1798 :initialize #'custom-initialize-default
1799 :set 'todo-reset-comment-string 1799 :set #'todo-reset-comment-string
1800 :group 'todo-edit) 1800 :group 'todo-edit)
1801 1801
1802(defcustom todo-undo-item-omit-comment 'ask 1802(defcustom todo-undo-item-omit-comment 'ask
@@ -2077,7 +2077,7 @@ their associated keys and their effects."
2077 (todo-date-from-calendar 2077 (todo-date-from-calendar
2078 (let (calendar-view-diary-initially-flag) 2078 (let (calendar-view-diary-initially-flag)
2079 (calendar)) ; *Calendar* is now current buffer. 2079 (calendar)) ; *Calendar* is now current buffer.
2080 (define-key calendar-mode-map [remap newline] 'exit-recursive-edit) 2080 (define-key calendar-mode-map [remap newline] #'exit-recursive-edit)
2081 ;; If user exits Calendar before choosing a date, clean up properly. 2081 ;; If user exits Calendar before choosing a date, clean up properly.
2082 (define-key calendar-mode-map 2082 (define-key calendar-mode-map
2083 [remap calendar-exit] (lambda () 2083 [remap calendar-exit] (lambda ()
@@ -2112,7 +2112,7 @@ prompt for a todo file and then for a category in it."
2112 (calendar-exit) 2112 (calendar-exit)
2113 (todo-insert-item--basic arg nil todo-date-from-calendar)) 2113 (todo-insert-item--basic arg nil todo-date-from-calendar))
2114 2114
2115(define-key calendar-mode-map "it" 'todo-insert-item-from-calendar) 2115(define-key calendar-mode-map "it" #'todo-insert-item-from-calendar)
2116 2116
2117(defun todo-delete-item () 2117(defun todo-delete-item ()
2118 "Delete at least one item in this category. 2118 "Delete at least one item in this category.
@@ -2133,7 +2133,7 @@ the item at point."
2133 (save-excursion (todo-item-end)))) 2133 (save-excursion (todo-item-end))))
2134 (overlay-put ov 'face 'todo-search) 2134 (overlay-put ov 'face 'todo-search)
2135 (todo-y-or-n-p "Permanently delete this item? ")))) 2135 (todo-y-or-n-p "Permanently delete this item? "))))
2136 buffer-read-only) 2136 (inhibit-read-only t))
2137 (when answer 2137 (when answer
2138 (and marked (goto-char (point-min))) 2138 (and marked (goto-char (point-min)))
2139 (catch 'done 2139 (catch 'done
@@ -2566,7 +2566,7 @@ made in the number or names of categories."
2566 2566
2567(defun todo-edit-item--diary-inclusion (&optional nonmarking) 2567(defun todo-edit-item--diary-inclusion (&optional nonmarking)
2568 "Function providing diary marking facilities of `todo-edit-item'." 2568 "Function providing diary marking facilities of `todo-edit-item'."
2569 (let ((buffer-read-only) 2569 (let ((inhibit-read-only t)
2570 (marked (assoc (todo-current-category) todo-categories-with-marks))) 2570 (marked (assoc (todo-current-category) todo-categories-with-marks)))
2571 (when marked (todo--user-error-if-marked-done-item)) 2571 (when marked (todo--user-error-if-marked-done-item))
2572 (catch 'stop 2572 (catch 'stop
@@ -2616,7 +2616,7 @@ items."
2616 (goto-char (point-min)) 2616 (goto-char (point-min))
2617 (let ((todo-count (todo-get-count 'todo)) 2617 (let ((todo-count (todo-get-count 'todo))
2618 (diary-count (todo-get-count 'diary)) 2618 (diary-count (todo-get-count 'diary))
2619 (buffer-read-only)) 2619 (inhibit-read-only t))
2620 (catch 'stop 2620 (catch 'stop
2621 (while (not (eobp)) 2621 (while (not (eobp))
2622 (if (todo-done-item-p) ; We've gone too far. 2622 (if (todo-done-item-p) ; We've gone too far.
@@ -2652,7 +2652,7 @@ items in this category."
2652 (interactive "P") 2652 (interactive "P")
2653 (save-excursion 2653 (save-excursion
2654 (goto-char (point-min)) 2654 (goto-char (point-min))
2655 (let (buffer-read-only) 2655 (let ((inhibit-read-only t))
2656 (catch 'stop 2656 (catch 'stop
2657 (while (not (eobp)) 2657 (while (not (eobp))
2658 (if (todo-done-item-p) ; We've gone too far. 2658 (if (todo-done-item-p) ; We've gone too far.
@@ -3322,13 +3322,14 @@ this category does not exist in the archive, it is created."
3322 (with-current-buffer archive 3322 (with-current-buffer archive
3323 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode)) 3323 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
3324 (let ((headers-hidden todo--item-headers-hidden) 3324 (let ((headers-hidden todo--item-headers-hidden)
3325 buffer-read-only) 3325 (inhibit-read-only t))
3326 (if headers-hidden (todo-toggle-item-header)) 3326 (if headers-hidden (todo-toggle-item-header))
3327 (widen) 3327 (widen)
3328 (goto-char (point-min)) 3328 (goto-char (point-min))
3329 (if (and (re-search-forward 3329 (if (and (re-search-forward
3330 (concat "^" (regexp-quote 3330 (concat "^" (regexp-quote
3331 (concat todo-category-beg cat)) "$") 3331 (concat todo-category-beg cat))
3332 "$")
3332 nil t) 3333 nil t)
3333 (re-search-forward (regexp-quote todo-category-done) 3334 (re-search-forward (regexp-quote todo-category-done)
3334 nil t)) 3335 nil t))
@@ -3420,7 +3421,7 @@ the only category in the archive, the archive file is deleted."
3420 (item (concat (todo-item-string) "\n")) 3421 (item (concat (todo-item-string) "\n"))
3421 (marked-count 0) 3422 (marked-count 0)
3422 marked-items 3423 marked-items
3423 buffer-read-only) 3424 (inhibit-read-only t))
3424 (when marked 3425 (when marked
3425 (save-excursion 3426 (save-excursion
3426 (goto-char (point-min)) 3427 (goto-char (point-min))
@@ -3432,7 +3433,7 @@ the only category in the archive, the archive file is deleted."
3432 ;; Restore items to top of category's done section and update counts. 3433 ;; Restore items to top of category's done section and update counts.
3433 (with-current-buffer tbuf 3434 (with-current-buffer tbuf
3434 (let ((headers-hidden todo--item-headers-hidden) 3435 (let ((headers-hidden todo--item-headers-hidden)
3435 buffer-read-only newcat) 3436 (inhibit-read-only t) newcat)
3436 (if headers-hidden (todo-toggle-item-header)) 3437 (if headers-hidden (todo-toggle-item-header))
3437 (widen) 3438 (widen)
3438 (goto-char (point-min)) 3439 (goto-char (point-min))
@@ -3922,7 +3923,7 @@ which is the value of the user option
3922 (kill-all-local-variables) 3923 (kill-all-local-variables)
3923 (todo-categories-mode) 3924 (todo-categories-mode)
3924 (let ((archive (member todo-current-todo-file todo-archives)) 3925 (let ((archive (member todo-current-todo-file todo-archives))
3925 buffer-read-only) 3926 (inhibit-read-only t))
3926 (erase-buffer) 3927 (erase-buffer)
3927 (insert (format (concat "Category counts for todo " 3928 (insert (format (concat "Category counts for todo "
3928 (if archive "archive" "file") 3929 (if archive "archive" "file")
@@ -3961,7 +3962,7 @@ which is the value of the user option
3961 (forward-line -2) 3962 (forward-line -2)
3962 (goto-char (next-single-char-property-change 3963 (goto-char (next-single-char-property-change
3963 (point) 'face nil (line-end-position)))))) 3964 (point) 'face nil (line-end-position))))))
3964 (buffer-read-only)) 3965 (inhibit-read-only t))
3965 (forward-line 2) 3966 (forward-line 2)
3966 (delete-region (point) (point-max)) 3967 (delete-region (point) (point-max))
3967 ;; Fill in the table with buttonized lines, each showing a category and 3968 ;; Fill in the table with buttonized lines, each showing a category and
@@ -4533,7 +4534,7 @@ the values of FILTER and FILE-LIST."
4533 (widen))) 4534 (widen)))
4534 (setq bufstr (buffer-string)) 4535 (setq bufstr (buffer-string))
4535 (with-current-buffer buf 4536 (with-current-buffer buf
4536 (let (buffer-read-only) 4537 (let ((inhibit-read-only t))
4537 (insert bufstr))))))) 4538 (insert bufstr)))))))
4538 (set-window-buffer (selected-window) (set-buffer buf)) 4539 (set-window-buffer (selected-window) (set-buffer buf))
4539 (todo-prefix-overlays) 4540 (todo-prefix-overlays)
@@ -5900,7 +5901,7 @@ Also return t if answer is \"Y\", but unlike `y-or-n-p', allow
5900SPC to affirm the question only if option `todo-y-with-space' is 5901SPC to affirm the question only if option `todo-y-with-space' is
5901non-nil." 5902non-nil."
5902 (unless todo-y-with-space 5903 (unless todo-y-with-space
5903 (define-key query-replace-map " " 'ignore)) 5904 (define-key query-replace-map " " #'ignore))
5904 (prog1 5905 (prog1
5905 (y-or-n-p prompt) 5906 (y-or-n-p prompt)
5906 (define-key query-replace-map " " 'act))) 5907 (define-key query-replace-map " " 'act)))
@@ -6333,7 +6334,7 @@ the empty string (i.e., no time string)."
6333 (dolist (f files) 6334 (dolist (f files)
6334 (let ((buf (find-buffer-visiting f))) 6335 (let ((buf (find-buffer-visiting f)))
6335 (with-current-buffer (find-file-noselect f) 6336 (with-current-buffer (find-file-noselect f)
6336 (let (buffer-read-only) 6337 (let ((inhibit-read-only t))
6337 (widen) 6338 (widen)
6338 (goto-char (point-min)) 6339 (goto-char (point-min))
6339 (while (not (eobp)) 6340 (while (not (eobp))
@@ -6363,7 +6364,7 @@ the empty string (i.e., no time string)."
6363 (when (not (equal value oldvalue)) 6364 (when (not (equal value oldvalue))
6364 (dolist (f files) 6365 (dolist (f files)
6365 (with-current-buffer (find-file-noselect f) 6366 (with-current-buffer (find-file-noselect f)
6366 (let (buffer-read-only) 6367 (let ((inhibit-read-only t))
6367 (setq todo-done-separator (todo-done-separator)) 6368 (setq todo-done-separator (todo-done-separator))
6368 (when (= 1 (length value)) 6369 (when (= 1 (length value))
6369 (todo-reset-done-separator sep))) 6370 (todo-reset-done-separator sep)))
@@ -6382,7 +6383,7 @@ the empty string (i.e., no time string)."
6382 (dolist (f files) 6383 (dolist (f files)
6383 (let ((buf (find-buffer-visiting f))) 6384 (let ((buf (find-buffer-visiting f)))
6384 (with-current-buffer (find-file-noselect f) 6385 (with-current-buffer (find-file-noselect f)
6385 (let (buffer-read-only) 6386 (let ((inhibit-read-only t))
6386 (widen) 6387 (widen)
6387 (goto-char (point-min)) 6388 (goto-char (point-min))
6388 (while (not (eobp)) 6389 (while (not (eobp))
@@ -6408,7 +6409,7 @@ the empty string (i.e., no time string)."
6408 (dolist (f files) 6409 (dolist (f files)
6409 (let ((buf (find-buffer-visiting f))) 6410 (let ((buf (find-buffer-visiting f)))
6410 (with-current-buffer (find-file-noselect f) 6411 (with-current-buffer (find-file-noselect f)
6411 (let (buffer-read-only) 6412 (let ((inhibit-read-only t))
6412 (widen) 6413 (widen)
6413 (goto-char (point-min)) 6414 (goto-char (point-min))
6414 (while (not (eobp)) 6415 (while (not (eobp))
@@ -6643,32 +6644,32 @@ Filtered Items mode following todo (not done) items."
6643 (define-key map (nth 0 kb) (nth 1 kb))) 6644 (define-key map (nth 0 kb) (nth 1 kb)))
6644 (dolist (kb todo-key-bindings-t+a) 6645 (dolist (kb todo-key-bindings-t+a)
6645 (define-key map (nth 0 kb) (nth 1 kb))) 6646 (define-key map (nth 0 kb) (nth 1 kb)))
6646 (define-key map "a" 'todo-jump-to-archive-category) 6647 (define-key map "a" #'todo-jump-to-archive-category)
6647 (define-key map "u" 'todo-unarchive-items) 6648 (define-key map "u" #'todo-unarchive-items)
6648 map) 6649 map)
6649 "Todo Archive mode keymap.") 6650 "Todo Archive mode keymap.")
6650 6651
6651(defvar todo-edit-mode-map 6652(defvar todo-edit-mode-map
6652 (let ((map (make-sparse-keymap))) 6653 (let ((map (make-sparse-keymap)))
6653 (define-key map "\C-x\C-q" 'todo-edit-quit) 6654 (define-key map "\C-x\C-q" #'todo-edit-quit)
6654 map) 6655 map)
6655 "Todo Edit mode keymap.") 6656 "Todo Edit mode keymap.")
6656 6657
6657(defvar todo-categories-mode-map 6658(defvar todo-categories-mode-map
6658 (let ((map (make-sparse-keymap))) 6659 (let ((map (make-sparse-keymap)))
6659 (define-key map "c" 'todo-sort-categories-alphabetically-or-numerically) 6660 (define-key map "c" #'todo-sort-categories-alphabetically-or-numerically)
6660 (define-key map "t" 'todo-sort-categories-by-todo) 6661 (define-key map "t" #'todo-sort-categories-by-todo)
6661 (define-key map "y" 'todo-sort-categories-by-diary) 6662 (define-key map "y" #'todo-sort-categories-by-diary)
6662 (define-key map "d" 'todo-sort-categories-by-done) 6663 (define-key map "d" #'todo-sort-categories-by-done)
6663 (define-key map "a" 'todo-sort-categories-by-archived) 6664 (define-key map "a" #'todo-sort-categories-by-archived)
6664 (define-key map "#" 'todo-set-category-number) 6665 (define-key map "#" #'todo-set-category-number)
6665 (define-key map "l" 'todo-lower-category) 6666 (define-key map "l" #'todo-lower-category)
6666 (define-key map "r" 'todo-raise-category) 6667 (define-key map "r" #'todo-raise-category)
6667 (define-key map "n" 'todo-next-button) 6668 (define-key map "n" #'todo-next-button)
6668 (define-key map "p" 'todo-previous-button) 6669 (define-key map "p" #'todo-previous-button)
6669 (define-key map [tab] 'todo-next-button) 6670 (define-key map [tab] #'todo-next-button)
6670 (define-key map [backtab] 'todo-previous-button) 6671 (define-key map [backtab] #'todo-previous-button)
6671 (define-key map "q" 'todo-quit) 6672 (define-key map "q" #'todo-quit)
6672 map) 6673 map)
6673 "Todo Categories mode keymap.") 6674 "Todo Categories mode keymap.")
6674 6675
@@ -6678,8 +6679,8 @@ Filtered Items mode following todo (not done) items."
6678 (define-key map (nth 0 kb) (nth 1 kb))) 6679 (define-key map (nth 0 kb) (nth 1 kb)))
6679 (dolist (kb todo-key-bindings-t+f) 6680 (dolist (kb todo-key-bindings-t+f)
6680 (define-key map (nth 0 kb) (nth 1 kb))) 6681 (define-key map (nth 0 kb) (nth 1 kb)))
6681 (define-key map "g" 'todo-go-to-source-item) 6682 (define-key map "g" #'todo-go-to-source-item)
6682 (define-key map [remap newline] 'todo-go-to-source-item) 6683 (define-key map [remap newline] #'todo-go-to-source-item)
6683 map) 6684 map)
6684 "Todo Filtered Items mode keymap.") 6685 "Todo Filtered Items mode keymap.")
6685 6686
@@ -6835,13 +6836,9 @@ Added to `window-configuration-change-hook' in Todo mode."
6835 ;; (add-hook 'find-file-hook #'todo-display-as-todo-file nil t) 6836 ;; (add-hook 'find-file-hook #'todo-display-as-todo-file nil t)
6836 ) 6837 )
6837 6838
6838(put 'todo-mode 'mode-class 'special)
6839
6840;;;###autoload 6839;;;###autoload
6841(define-derived-mode todo-mode special-mode "Todo" 6840(define-derived-mode todo-mode special-mode "Todo"
6842 "Major mode for displaying, navigating and editing todo lists. 6841 "Major mode for displaying, navigating and editing todo lists."
6843
6844\\{todo-mode-map}"
6845 (if (called-interactively-p 'any) 6842 (if (called-interactively-p 'any)
6846 (message "%s" 6843 (message "%s"
6847 (substitute-command-keys 6844 (substitute-command-keys
@@ -6863,15 +6860,11 @@ Added to `window-configuration-change-hook' in Todo mode."
6863 #'todo-reset-and-enable-done-separator nil t) 6860 #'todo-reset-and-enable-done-separator nil t)
6864 (add-hook 'kill-buffer-hook #'todo-reset-global-current-todo-file nil t))) 6861 (add-hook 'kill-buffer-hook #'todo-reset-global-current-todo-file nil t)))
6865 6862
6866(put 'todo-archive-mode 'mode-class 'special)
6867
6868;; If todo-mode is parent, all todo-mode key bindings appear to be 6863;; If todo-mode is parent, all todo-mode key bindings appear to be
6869;; available in todo-archive-mode (e.g. shown by C-h m). 6864;; available in todo-archive-mode (e.g. shown by C-h m).
6870;;;###autoload 6865;;;###autoload
6871(define-derived-mode todo-archive-mode special-mode "Todo-Arch" 6866(define-derived-mode todo-archive-mode special-mode "Todo-Arch"
6872 "Major mode for archived todo categories. 6867 "Major mode for archived todo categories."
6873
6874\\{todo-archive-mode-map}"
6875 (todo-modes-set-1) 6868 (todo-modes-set-1)
6876 (todo-modes-set-2) 6869 (todo-modes-set-2)
6877 (todo-modes-set-3) 6870 (todo-modes-set-3)
@@ -6879,9 +6872,7 @@ Added to `window-configuration-change-hook' in Todo mode."
6879 (setq-local todo-show-done-only t)) 6872 (setq-local todo-show-done-only t))
6880 6873
6881(define-derived-mode todo-edit-mode text-mode "Todo-Ed" 6874(define-derived-mode todo-edit-mode text-mode "Todo-Ed"
6882 "Major mode for editing multiline todo items. 6875 "Major mode for editing multiline todo items."
6883
6884\\{todo-edit-mode-map}"
6885 (todo-modes-set-1) 6876 (todo-modes-set-1)
6886 (setq-local indent-line-function #'todo-indent) 6877 (setq-local indent-line-function #'todo-indent)
6887 (if (> (buffer-size) (- (point-max) (point-min))) 6878 (if (> (buffer-size) (- (point-max) (point-min)))
@@ -6894,12 +6885,8 @@ Added to `window-configuration-change-hook' in Todo mode."
6894 (setq-local todo-categories (todo-set-categories))) 6885 (setq-local todo-categories (todo-set-categories)))
6895 (setq buffer-read-only nil)) 6886 (setq buffer-read-only nil))
6896 6887
6897(put 'todo-categories-mode 'mode-class 'special)
6898
6899(define-derived-mode todo-categories-mode special-mode "Todo-Cats" 6888(define-derived-mode todo-categories-mode special-mode "Todo-Cats"
6900 "Major mode for displaying and editing todo categories. 6889 "Major mode for displaying and editing todo categories."
6901
6902\\{todo-categories-mode-map}"
6903 (setq-local todo-current-todo-file todo-global-current-todo-file) 6890 (setq-local todo-current-todo-file todo-global-current-todo-file)
6904 (setq-local todo-categories 6891 (setq-local todo-categories
6905 ;; Can't use find-buffer-visiting when 6892 ;; Can't use find-buffer-visiting when
@@ -6910,13 +6897,9 @@ Added to `window-configuration-change-hook' in Todo mode."
6910 todo-current-todo-file 'nowarn) 6897 todo-current-todo-file 'nowarn)
6911 todo-categories))) 6898 todo-categories)))
6912 6899
6913(put 'todo-filtered-items-mode 'mode-class 'special)
6914
6915;;;###autoload 6900;;;###autoload
6916(define-derived-mode todo-filtered-items-mode special-mode "Todo-Fltr" 6901(define-derived-mode todo-filtered-items-mode special-mode "Todo-Fltr"
6917 "Mode for displaying and reprioritizing top priority Todo. 6902 "Mode for displaying and reprioritizing top priority Todo."
6918
6919\\{todo-filtered-items-mode-map}"
6920 (todo-modes-set-1) 6903 (todo-modes-set-1)
6921 (todo-modes-set-2)) 6904 (todo-modes-set-2))
6922 6905