aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStephen Berman2014-05-23 18:54:35 +0200
committerStephen Berman2014-05-23 18:54:35 +0200
commit903204bb53d1c05a9726316134e145d8bd34664e (patch)
tree32f17f5475e9ab9e96746c458e9b5f103290b3d3 /lisp
parent15ad4013c44d19125fde6bbb704797d4a7a185b3 (diff)
downloademacs-903204bb53d1c05a9726316134e145d8bd34664e.tar.gz
emacs-903204bb53d1c05a9726316134e145d8bd34664e.zip
todo-mode.el: Remove dependence on auto-mode-alist.
* calendar/todo-mode.el: Remove dependence on auto-mode-alist, to avoid errors when trying to create or visit a file foo.todo located outside to todo-directory, and to allow having such files without them being tied to Todo mode. (todo-show, todo-move-category, todo-merge-category, todo-find-archive) (todo-archive-done-item, todo-find-filtered-items-file) (todo-filter-items, todo-find-item, todo-diary-goto-entry) (todo-category-completions, todo-read-category): When visiting a Todo file, make sure we're in the right mode and the buffer local variables are set. (todo-make-categories-list, todo-reset-nondiary-marker) (todo-reset-done-string, todo-reset-comment-string): After processing all Todo files, kill the buffers of those files that weren't being visited before the processing. (todo-display-as-todo-file, todo-add-to-buffer-list) (todo-visit-files-commands): Comment out. (todo-modes-set-3, todo-mode): Comment out additions to find-file-hook. (auto-mode-alist): Remove add-to-list calls making Todo file extensions unrestrictedly tied to Todo modes. * doc/misc/todo-mode.texi: Update in light of changes due to bug#17482. Replace numerous mistaken uses of literal quotes with proper Texinfo markup. (Todo Mode Entry Points): Comment out reference to using find-file or Dired to visit Todo files, since this has been disabled (bug#17482).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog22
-rw-r--r--lisp/calendar/todo-mode.el220
2 files changed, 153 insertions, 89 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 57cf0490fea..1d450e3d5d5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,25 @@
12014-05-23 Stephen Berman <stephen.berman@gmx.net>
2
3 * calendar/todo-mode.el: Remove dependence on auto-mode-alist,
4 to avoid errors when trying to create or visit a file foo.todo
5 located outside to todo-directory, and to allow having such files
6 without them being tied to Todo mode (bug#17482).
7 (todo-show, todo-move-category, todo-merge-category, todo-find-archive)
8 (todo-archive-done-item, todo-find-filtered-items-file)
9 (todo-filter-items, todo-find-item, todo-diary-goto-entry)
10 (todo-category-completions, todo-read-category): When visiting a
11 Todo file, make sure we're in the right mode and the buffer local
12 variables are set.
13 (todo-make-categories-list, todo-reset-nondiary-marker)
14 (todo-reset-done-string, todo-reset-comment-string): After
15 processing all Todo files, kill the buffers of those files that
16 weren't being visited before the processing.
17 (todo-display-as-todo-file, todo-add-to-buffer-list)
18 (todo-visit-files-commands): Comment out.
19 (todo-modes-set-3, todo-mode): Comment out additions to find-file-hook.
20 (auto-mode-alist): Remove add-to-list calls making Todo file
21 extensions unrestrictedly tied to Todo modes.
22
12014-05-23 Stefan Monnier <monnier@iro.umontreal.ca> 232014-05-23 Stefan Monnier <monnier@iro.umontreal.ca>
2 24
3 * emacs-lisp/nadvice.el (advice--member-p): Change second arg. 25 * emacs-lisp/nadvice.el (advice--member-p): Change second arg.
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 1b15317ffc6..ab2ab3e4cb8 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -566,13 +566,13 @@ less than or equal the category's top priority setting."
566;;; Entering and exiting 566;;; Entering and exiting
567;; ----------------------------------------------------------------------------- 567;; -----------------------------------------------------------------------------
568 568
569(defcustom todo-visit-files-commands (list 'find-file 'dired-find-file) 569;; (defcustom todo-visit-files-commands (list 'find-file 'dired-find-file)
570 "List of file finding commands for `todo-display-as-todo-file'. 570;; "List of file finding commands for `todo-display-as-todo-file'.
571Invoking these commands to visit a todo file or todo archive file 571;; Invoking these commands to visit a todo file or todo archive file
572calls `todo-show' or `todo-find-archive', so that the file is 572;; calls `todo-show' or `todo-find-archive', so that the file is
573displayed correctly." 573;; displayed correctly."
574 :type '(repeat function) 574;; :type '(repeat function)
575 :group 'todo) 575;; :group 'todo)
576 576
577(defun todo-short-file-name (file) 577(defun todo-short-file-name (file)
578 "Return the short form of todo file FILE's name. 578 "Return the short form of todo file FILE's name.
@@ -740,9 +740,12 @@ corresponding todo file, displaying the corresponding category."
740 "Choose a regexp items file: " 740 "Choose a regexp items file: "
741 rxf) 'regexp)))))) 741 rxf) 'regexp))))))
742 (if (file-exists-p fi-file) 742 (if (file-exists-p fi-file)
743 (set-window-buffer 743 (progn
744 (selected-window) 744 (set-window-buffer
745 (set-buffer (find-file-noselect fi-file 'nowarn))) 745 (selected-window)
746 (set-buffer (find-file-noselect fi-file 'nowarn)))
747 (unless (derived-mode-p 'todo-filtered-items-mode)
748 (todo-filtered-items-mode)))
746 (message "There is no %s file for %s" 749 (message "There is no %s file for %s"
747 (cond ((eq todo-show-first 'top) 750 (cond ((eq todo-show-first 'top)
748 "top priorities") 751 "top priorities")
@@ -757,6 +760,9 @@ corresponding todo file, displaying the corresponding category."
757 (unless (todo-check-file file) (throw 'end nil)) 760 (unless (todo-check-file file) (throw 'end nil))
758 (set-window-buffer (selected-window) 761 (set-window-buffer (selected-window)
759 (set-buffer (find-file-noselect file 'nowarn))) 762 (set-buffer (find-file-noselect file 'nowarn)))
763 (if (equal (file-name-extension (buffer-file-name)) "toda")
764 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
765 (unless (derived-mode-p 'todo-mode) (todo-mode)))
760 ;; When quitting an archive file, show the corresponding 766 ;; When quitting an archive file, show the corresponding
761 ;; category in the corresponding todo file, if it exists. 767 ;; category in the corresponding todo file, if it exists.
762 (when (assoc cat todo-categories) 768 (when (assoc cat todo-categories)
@@ -1449,6 +1455,10 @@ the archive of the file moved to, creating it if it does not exist."
1449 (if (member buf (funcall todo-files-function t)) 1455 (if (member buf (funcall todo-files-function t))
1450 (concat (file-name-sans-extension nfile) ".toda") 1456 (concat (file-name-sans-extension nfile) ".toda")
1451 nfile)) 1457 nfile))
1458 (if (equal (file-name-extension (buffer-file-name)) "toda")
1459 (unless (derived-mode-p 'todo-archive-mode)
1460 (todo-archive-mode))
1461 (unless (derived-mode-p 'todo-mode) (todo-mode)))
1452 (let* ((nfile-short (todo-short-file-name nfile)) 1462 (let* ((nfile-short (todo-short-file-name nfile))
1453 (prompt (concat 1463 (prompt (concat
1454 (format "Todo file \"%s\" already has " 1464 (format "Todo file \"%s\" already has "
@@ -1564,6 +1574,7 @@ archive file and the source category is deleted."
1564 (done-count (todo-get-count 'done cat))) 1574 (done-count (todo-get-count 'done cat)))
1565 ;; Merge into goal todo category. 1575 ;; Merge into goal todo category.
1566 (with-current-buffer (get-buffer (find-file-noselect gfile)) 1576 (with-current-buffer (get-buffer (find-file-noselect gfile))
1577 (unless (derived-mode-p 'todo-mode) (todo-mode))
1567 (widen) 1578 (widen)
1568 (goto-char (point-min)) 1579 (goto-char (point-min))
1569 (let ((buffer-read-only nil)) 1580 (let ((buffer-read-only nil))
@@ -2995,6 +3006,7 @@ displayed."
2995 (when place 3006 (when place
2996 (set-window-buffer (selected-window) 3007 (set-window-buffer (selected-window)
2997 (set-buffer (find-file-noselect archive))) 3008 (set-buffer (find-file-noselect archive)))
3009 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
2998 (if (member place '(other-archive other-cat)) 3010 (if (member place '(other-archive other-cat))
2999 (setq todo-category-number 1) 3011 (setq todo-category-number 1)
3000 (todo-category-number cat)) 3012 (todo-category-number cat))
@@ -3070,6 +3082,7 @@ this category does not exist in the archive, it is created."
3070 (if (not (or marked all item)) 3082 (if (not (or marked all item))
3071 (throw 'end (message "Only done items can be archived")) 3083 (throw 'end (message "Only done items can be archived"))
3072 (with-current-buffer archive 3084 (with-current-buffer archive
3085 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
3073 (let (buffer-read-only) 3086 (let (buffer-read-only)
3074 (widen) 3087 (widen)
3075 (goto-char (point-min)) 3088 (goto-char (point-min))
@@ -3091,12 +3104,12 @@ this category does not exist in the archive, it is created."
3091 (todo-update-categories-sexp) 3104 (todo-update-categories-sexp)
3092 ;; If archive is new, save to file now (with 3105 ;; If archive is new, save to file now (with
3093 ;; write-region to avoid prompt for file to save to) 3106 ;; write-region to avoid prompt for file to save to)
3094 ;; to update todo-archives, and to let auto-mode-alist 3107 ;; to update todo-archives, and set the mode for
3095 ;; take effect below on visiting the archive. 3108 ;; visiting the archive below.
3096 (unless (nth 7 (file-attributes afile)) 3109 (unless (nth 7 (file-attributes afile))
3097 (write-region nil nil afile t t) 3110 (write-region nil nil afile t t)
3098 (setq todo-archives (funcall todo-files-function t)) 3111 (setq todo-archives (funcall todo-files-function t))
3099 (kill-buffer)))) 3112 (todo-archive-mode))))
3100 (with-current-buffer tbuf 3113 (with-current-buffer tbuf
3101 (cond 3114 (cond
3102 (all 3115 (all
@@ -3957,7 +3970,9 @@ regexp items."
3957 (setq file (completing-read "Choose a filtered items file: " 3970 (setq file (completing-read "Choose a filtered items file: "
3958 falist nil t nil nil (car falist))) 3971 falist nil t nil nil (car falist)))
3959 (setq file (cdr (assoc-string file falist))) 3972 (setq file (cdr (assoc-string file falist)))
3960 (find-file file))) 3973 (find-file file)
3974 (unless (derived-mode-p 'todo-filtered-items-mode)
3975 (todo-filtered-items-mode))))
3961 3976
3962(defun todo-go-to-source-item () 3977(defun todo-go-to-source-item ()
3963 "Display the file and category of the filtered item at point." 3978 "Display the file and category of the filtered item at point."
@@ -4088,6 +4103,8 @@ multifile commands for further details."
4088 (completing-read "Choose a regexp items file: " 4103 (completing-read "Choose a regexp items file: "
4089 rxf) 'regexp)))) 4104 rxf) 'regexp))))
4090 (find-file fname) 4105 (find-file fname)
4106 (unless (derived-mode-p 'todo-filtered-items-mode)
4107 (todo-filtered-items-mode))
4091 (todo-prefix-overlays) 4108 (todo-prefix-overlays)
4092 (todo-check-filtered-items-file)) 4109 (todo-check-filtered-items-file))
4093 (t 4110 (t
@@ -4341,6 +4358,9 @@ its priority has changed, and `same' otherwise."
4341 todo-global-current-todo-file))) 4358 todo-global-current-todo-file)))
4342 (find-file-noselect file) 4359 (find-file-noselect file)
4343 (with-current-buffer (find-buffer-visiting file) 4360 (with-current-buffer (find-buffer-visiting file)
4361 (if archive
4362 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
4363 (unless (derived-mode-p 'todo-mode) (todo-mode)))
4344 (save-restriction 4364 (save-restriction
4345 (widen) 4365 (widen)
4346 (goto-char (point-min)) 4366 (goto-char (point-min))
@@ -4917,23 +4937,28 @@ the file."
4917 ;; Make sure to include newly created archives, e.g. due to 4937 ;; Make sure to include newly created archives, e.g. due to
4918 ;; todo-move-category. 4938 ;; todo-move-category.
4919 (when (member archive (funcall todo-files-function t)) 4939 (when (member archive (funcall todo-files-function t))
4920 (let ((archive-count 0)) 4940 (let ((archive-count 0)
4921 (with-current-buffer (find-file-noselect archive) 4941 (visiting (find-buffer-visiting archive)))
4922 (widen) 4942 (with-current-buffer (or visiting
4923 (goto-char (point-min)) 4943 (find-file-noselect archive))
4924 (when (re-search-forward 4944 (save-excursion
4925 (concat "^" (regexp-quote todo-category-beg) 4945 (save-restriction
4926 cat "$") 4946 (widen)
4927 (point-max) t) 4947 (goto-char (point-min))
4928 (forward-line) 4948 (when (re-search-forward
4929 (while (not (or (looking-at 4949 (concat "^" (regexp-quote todo-category-beg)
4930 (concat 4950 cat "$")
4931 (regexp-quote todo-category-beg) 4951 (point-max) t)
4932 "\\(.*\\)\n")) 4952 (forward-line)
4933 (eobp))) 4953 (while (not (or (looking-at
4934 (when (looking-at todo-done-string-start) 4954 (concat
4935 (setq archive-count (1+ archive-count))) 4955 (regexp-quote todo-category-beg)
4936 (forward-line)))) 4956 "\\(.*\\)\n"))
4957 (eobp)))
4958 (when (looking-at todo-done-string-start)
4959 (setq archive-count (1+ archive-count)))
4960 (forward-line)))))
4961 (unless visiting (kill-buffer)))
4937 (todo-update-count 'archived archive-count cat)))) 4962 (todo-update-count 'archived archive-count cat))))
4938 ((looking-at todo-done-string-start) 4963 ((looking-at todo-done-string-start)
4939 (todo-update-count 'done 1 cat)) 4964 (todo-update-count 'done 1 cat))
@@ -5157,6 +5182,11 @@ Overrides `diary-goto-entry'."
5157 (if (not (and (file-exists-p file) 5182 (if (not (and (file-exists-p file)
5158 (find-file-other-window file))) 5183 (find-file-other-window file)))
5159 (message "Unable to locate this diary entry") 5184 (message "Unable to locate this diary entry")
5185 ;; If it's a Todo file, make sure it's in Todo mode.
5186 (when (and (equal (file-name-directory (file-truename file))
5187 (file-truename todo-directory))
5188 (not (derived-mode-p 'todo-mode)))
5189 (todo-mode))
5160 (when (eq major-mode 'todo-mode) (widen)) 5190 (when (eq major-mode 'todo-mode) (widen))
5161 (goto-char (point-min)) 5191 (goto-char (point-min))
5162 (when (re-search-forward (format "%s.*\\(%s\\)" date content) nil t) 5192 (when (re-search-forward (format "%s.*\\(%s\\)" date content) nil t)
@@ -5596,6 +5626,9 @@ have been removed."
5596 (add-to-list 'files curfile)) 5626 (add-to-list 'files curfile))
5597 (dolist (f files listall) 5627 (dolist (f files listall)
5598 (with-current-buffer (find-file-noselect f 'nowarn) 5628 (with-current-buffer (find-file-noselect f 'nowarn)
5629 (if archive
5630 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
5631 (unless (derived-mode-p 'todo-mode) (todo-mode)))
5599 ;; Ensure category is properly displayed in case user 5632 ;; Ensure category is properly displayed in case user
5600 ;; switches to file via a non-Todo mode command. And if 5633 ;; switches to file via a non-Todo mode command. And if
5601 ;; done items in category are visible, keep them visible. 5634 ;; done items in category are visible, keep them visible.
@@ -5681,6 +5714,7 @@ categories from `todo-category-completions-files'."
5681 (categories (cond (file0 5714 (categories (cond (file0
5682 (with-current-buffer 5715 (with-current-buffer
5683 (find-file-noselect file0 'nowarn) 5716 (find-file-noselect file0 'nowarn)
5717 (unless (derived-mode-p 'todo-mode) (todo-mode))
5684 (let ((todo-current-todo-file file0)) 5718 (let ((todo-current-todo-file file0))
5685 todo-categories))) 5719 todo-categories)))
5686 ((and add (not file)) 5720 ((and add (not file))
@@ -5960,23 +5994,28 @@ the empty string (i.e., no time string)."
5960 (regexp-quote diary-nonmarking-symbol) "\\)?")) 5994 (regexp-quote diary-nonmarking-symbol) "\\)?"))
5961 (when (not (equal value oldvalue)) 5995 (when (not (equal value oldvalue))
5962 (dolist (f files) 5996 (dolist (f files)
5963 (with-current-buffer (find-file-noselect f) 5997 (let ((buf (find-buffer-visiting f)))
5964 (let (buffer-read-only) 5998 (with-current-buffer (find-file-noselect f)
5965 (widen) 5999 (let (buffer-read-only)
5966 (goto-char (point-min)) 6000 (widen)
5967 (while (not (eobp)) 6001 (goto-char (point-min))
5968 (if (re-search-forward 6002 (while (not (eobp))
5969 (concat "^\\(" todo-done-string-start "[^][]+] \\)?" 6003 (if (re-search-forward
5970 "\\(?1:" (regexp-quote (car oldvalue)) 6004 (concat "^\\(" todo-done-string-start "[^][]+] \\)?"
5971 "\\)" todo-date-pattern "\\( " 6005 "\\(?1:" (regexp-quote (car oldvalue))
5972 diary-time-regexp "\\)?\\(?2:" 6006 "\\)" todo-date-pattern "\\( "
5973 (regexp-quote (cadr oldvalue)) "\\)") 6007 diary-time-regexp "\\)?\\(?2:"
5974 nil t) 6008 (regexp-quote (cadr oldvalue)) "\\)")
5975 (progn 6009 nil t)
5976 (replace-match (nth 0 value) t t nil 1) 6010 (progn
5977 (replace-match (nth 1 value) t t nil 2)) 6011 (replace-match (nth 0 value) t t nil 1)
5978 (forward-line))) 6012 (replace-match (nth 1 value) t t nil 2))
5979 (todo-category-select))))))) 6013 (forward-line)))
6014 (if buf
6015 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
6016 (todo-category-select))
6017 (save-buffer)
6018 (kill-buffer)))))))))
5980 6019
5981(defun todo-reset-done-separator-string (symbol value) 6020(defun todo-reset-done-separator-string (symbol value)
5982 "The :set function for `todo-done-separator-string'." 6021 "The :set function for `todo-done-separator-string'."
@@ -6004,18 +6043,23 @@ the empty string (i.e., no time string)."
6004 (concat "^\\[" (regexp-quote todo-done-string))) 6043 (concat "^\\[" (regexp-quote todo-done-string)))
6005 (when (not (equal value oldvalue)) 6044 (when (not (equal value oldvalue))
6006 (dolist (f files) 6045 (dolist (f files)
6007 (with-current-buffer (find-file-noselect f) 6046 (let ((buf (find-buffer-visiting f)))
6008 (let (buffer-read-only) 6047 (with-current-buffer (find-file-noselect f)
6009 (widen) 6048 (let (buffer-read-only)
6010 (goto-char (point-min)) 6049 (widen)
6011 (while (not (eobp)) 6050 (goto-char (point-min))
6012 (if (re-search-forward 6051 (while (not (eobp))
6013 (concat "^" (regexp-quote todo-nondiary-start) 6052 (if (re-search-forward
6014 "\\(" (regexp-quote oldvalue) "\\)") 6053 (concat "^" (regexp-quote todo-nondiary-start)
6015 nil t) 6054 "\\(" (regexp-quote oldvalue) "\\)")
6016 (replace-match value t t nil 1) 6055 nil t)
6017 (forward-line))) 6056 (replace-match value t t nil 1)
6018 (todo-category-select))))))) 6057 (forward-line)))
6058 (if buf
6059 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
6060 (todo-category-select))
6061 (save-buffer)
6062 (kill-buffer)))))))))
6019 6063
6020(defun todo-reset-comment-string (symbol value) 6064(defun todo-reset-comment-string (symbol value)
6021 "The :set function for user option `todo-comment-string'." 6065 "The :set function for user option `todo-comment-string'."
@@ -6025,19 +6069,23 @@ the empty string (i.e., no time string)."
6025 (custom-set-default symbol value) 6069 (custom-set-default symbol value)
6026 (when (not (equal value oldvalue)) 6070 (when (not (equal value oldvalue))
6027 (dolist (f files) 6071 (dolist (f files)
6028 (with-current-buffer (find-file-noselect f) 6072 (let ((buf (find-buffer-visiting f)))
6029 (let (buffer-read-only) 6073 (with-current-buffer (find-file-noselect f)
6030 (save-excursion 6074 (let (buffer-read-only)
6031 (widen) 6075 (widen)
6032 (goto-char (point-min)) 6076 (goto-char (point-min))
6033 (while (not (eobp)) 6077 (while (not (eobp))
6034 (if (re-search-forward 6078 (if (re-search-forward
6035 (concat 6079 (concat "\\[\\(" (regexp-quote oldvalue)
6036 "\\[\\(" (regexp-quote oldvalue) "\\): [^]]*\\]") 6080 "\\): [^]]*\\]")
6037 nil t) 6081 nil t)
6038 (replace-match value t t nil 1) 6082 (replace-match value t t nil 1)
6039 (forward-line))) 6083 (forward-line)))
6040 (todo-category-select)))))))) 6084 (if buf
6085 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
6086 (todo-category-select))
6087 (save-buffer)
6088 (kill-buffer)))))))))
6041 6089
6042(defun todo-reset-highlight-item (symbol value) 6090(defun todo-reset-highlight-item (symbol value)
6043 "The :set function for user option `todo-highlight-item'." 6091 "The :set function for user option `todo-highlight-item'."
@@ -6435,20 +6483,20 @@ Added to `pre-command-hook' in Todo mode when user option
6435`todo-show-current-file' is set to non-nil." 6483`todo-show-current-file' is set to non-nil."
6436 (setq todo-global-current-todo-file todo-current-todo-file)) 6484 (setq todo-global-current-todo-file todo-current-todo-file))
6437 6485
6438(defun todo-display-as-todo-file () 6486;; (defun todo-display-as-todo-file ()
6439 "Show todo files correctly when visited from outside of Todo mode. 6487;; "Show todo files correctly when visited from outside of Todo mode.
6440Added to `find-file-hook' in Todo mode and Todo Archive mode." 6488;; Added to `find-file-hook' in Todo mode and Todo Archive mode."
6441 (and (member this-command todo-visit-files-commands) 6489;; (and (member this-command todo-visit-files-commands)
6442 (= (- (point-max) (point-min)) (buffer-size)) 6490;; (= (- (point-max) (point-min)) (buffer-size))
6443 (member major-mode '(todo-mode todo-archive-mode)) 6491;; (member major-mode '(todo-mode todo-archive-mode))
6444 (todo-category-select))) 6492;; (todo-category-select)))
6445 6493
6446(defun todo-add-to-buffer-list () 6494;; (defun todo-add-to-buffer-list ()
6447 "Add name of just visited todo file to `todo-file-buffers'. 6495;; "Add name of just visited todo file to `todo-file-buffers'.
6448This function is added to `find-file-hook' in Todo mode." 6496;; This function is added to `find-file-hook' in Todo mode."
6449 (let ((filename (file-truename (buffer-file-name)))) 6497;; (let ((filename (file-truename (buffer-file-name))))
6450 (when (member filename todo-files) 6498;; (when (member filename todo-files)
6451 (add-to-list 'todo-file-buffers filename)))) 6499;; (add-to-list 'todo-file-buffers filename))))
6452 6500
6453(defun todo-update-buffer-list () 6501(defun todo-update-buffer-list ()
6454 "Make current Todo mode buffer file car of `todo-file-buffers'. 6502 "Make current Todo mode buffer file car of `todo-file-buffers'.
@@ -6503,7 +6551,8 @@ Added to `window-configuration-change-hook' in Todo mode."
6503 "Make some settings that apply to multiple Todo modes." 6551 "Make some settings that apply to multiple Todo modes."
6504 (setq-local todo-categories (todo-set-categories)) 6552 (setq-local todo-categories (todo-set-categories))
6505 (setq-local todo-category-number 1) 6553 (setq-local todo-category-number 1)
6506 (add-hook 'find-file-hook 'todo-display-as-todo-file nil t)) 6554 ;; (add-hook 'find-file-hook 'todo-display-as-todo-file nil t)
6555 )
6507 6556
6508(put 'todo-mode 'mode-class 'special) 6557(put 'todo-mode 'mode-class 'special)
6509 6558
@@ -6522,7 +6571,7 @@ Added to `window-configuration-change-hook' in Todo mode."
6522 (setq-local todo-current-todo-file (file-truename (buffer-file-name)))) 6571 (setq-local todo-current-todo-file (file-truename (buffer-file-name))))
6523 (setq-local todo-show-done-only nil) 6572 (setq-local todo-show-done-only nil)
6524 (setq-local todo-categories-with-marks nil) 6573 (setq-local todo-categories-with-marks nil)
6525 (add-hook 'find-file-hook 'todo-add-to-buffer-list nil t) 6574 ;; (add-hook 'find-file-hook 'todo-add-to-buffer-list nil t)
6526 (add-hook 'post-command-hook 'todo-update-buffer-list nil t) 6575 (add-hook 'post-command-hook 'todo-update-buffer-list nil t)
6527 (when todo-show-current-file 6576 (when todo-show-current-file
6528 (add-hook 'pre-command-hook 'todo-show-current-file nil t)) 6577 (add-hook 'pre-command-hook 'todo-show-current-file nil t))
@@ -6591,13 +6640,6 @@ Added to `window-configuration-change-hook' in Todo mode."
6591 (todo-modes-set-1) 6640 (todo-modes-set-1)
6592 (todo-modes-set-2)) 6641 (todo-modes-set-2))
6593 6642
6594;;;###autoload
6595(add-to-list 'auto-mode-alist '("\\.todo\\'" . todo-mode))
6596;;;###autoload
6597(add-to-list 'auto-mode-alist '("\\.toda\\'" . todo-archive-mode))
6598;;;###autoload
6599(add-to-list 'auto-mode-alist '("\\.tod[tyr]\\'" . todo-filtered-items-mode))
6600
6601;; ----------------------------------------------------------------------------- 6643;; -----------------------------------------------------------------------------
6602(provide 'todo-mode) 6644(provide 'todo-mode)
6603 6645