diff options
| author | Stephen Berman | 2012-05-21 00:23:52 +0100 |
|---|---|---|
| committer | Stephen Berman | 2012-05-21 00:23:52 +0100 |
| commit | 78fe7289230007d19d3044b65a7b20fdc5bc32f1 (patch) | |
| tree | 1a24ce2553ea09c476c89e6fc4232cb1752d2e15 | |
| parent | 520d912ec42980b1c543a87179e293e3dcbd2d55 (diff) | |
| download | emacs-78fe7289230007d19d3044b65a7b20fdc5bc32f1.tar.gz emacs-78fe7289230007d19d3044b65a7b20fdc5bc32f1.zip | |
* calendar/todos.el: Further comment revision and code
rearrangement.
(todos-item-end): Revert last change.
(todos-key-bindings, todos-menu, todos-archive-mode-map)
(todos-filter-items-mode-map): Use renamed commands.
(todos-hide-show-date-time): Rename from
todos-toggle-display-date-time.
(todos-mark-unmark-item): Rename from todos-toggle-mark-item and
adjust caller.
(todos-backward-item): Exempt special handling only from
todos-regexp-items-buffer instead of todos-filter-items-mode.
(todos-raise-item-priority): Don't allow item reprioritizing in
Todos filter items mode except for top priority items.
| -rw-r--r-- | lisp/ChangeLog | 16 | ||||
| -rw-r--r-- | lisp/calendar/todos.el | 239 |
2 files changed, 139 insertions, 116 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1675c86684d..6f41ead73ee 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,21 @@ | |||
| 1 | 2012-09-21 Stephen Berman <stephen.berman@gmx.net> | 1 | 2012-09-21 Stephen Berman <stephen.berman@gmx.net> |
| 2 | 2 | ||
| 3 | * calendar/todos.el: Further comment revision and code | ||
| 4 | rearrangement. | ||
| 5 | (todos-item-end): Revert last change. | ||
| 6 | (todos-key-bindings, todos-menu, todos-archive-mode-map) | ||
| 7 | (todos-filter-items-mode-map): Use renamed commands. | ||
| 8 | (todos-hide-show-date-time): Rename from | ||
| 9 | todos-toggle-display-date-time. | ||
| 10 | (todos-mark-unmark-item): Rename from todos-toggle-mark-item and | ||
| 11 | adjust caller. | ||
| 12 | (todos-backward-item): Exempt special handling only from | ||
| 13 | todos-regexp-items-buffer instead of todos-filter-items-mode. | ||
| 14 | (todos-raise-item-priority): Don't allow item reprioritizing in | ||
| 15 | Todos filter items mode except for top priority items. | ||
| 16 | |||
| 17 | 2012-09-21 Stephen Berman <stephen.berman@gmx.net> | ||
| 18 | |||
| 3 | * calendar/todos.el: Add and revise further doc strings and | 19 | * calendar/todos.el: Add and revise further doc strings and |
| 4 | comments. | 20 | comments. |
| 5 | (todos-filter-function, todos-custom-items) | 21 | (todos-filter-function, todos-custom-items) |
diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el index 88a19b60a57..266e87c47b5 100644 --- a/lisp/calendar/todos.el +++ b/lisp/calendar/todos.el | |||
| @@ -779,6 +779,88 @@ categories display according to priority." | |||
| 779 | :group 'todos-faces) | 779 | :group 'todos-faces) |
| 780 | (defvar todos-done-sep-face 'todos-done-sep) | 780 | (defvar todos-done-sep-face 'todos-done-sep) |
| 781 | 781 | ||
| 782 | (defun todos-date-string-matcher (lim) | ||
| 783 | "Search for Todos date string within LIM for font-locking." | ||
| 784 | (re-search-forward | ||
| 785 | (concat todos-date-string-start "\\(?1:" todos-date-pattern "\\)") lim t)) | ||
| 786 | |||
| 787 | (defun todos-time-string-matcher (lim) | ||
| 788 | "Search for Todos time string within LIM for font-locking." | ||
| 789 | (re-search-forward (concat todos-date-string-start todos-date-pattern | ||
| 790 | " \\(?1:" diary-time-regexp "\\)") lim t)) | ||
| 791 | |||
| 792 | (defun todos-nondiary-marker-matcher (lim) | ||
| 793 | "Search for Todos nondiary markers within LIM for font-locking." | ||
| 794 | (re-search-forward (concat "^\\(?1:" (regexp-quote todos-nondiary-start) "\\)" | ||
| 795 | todos-date-pattern "\\(?: " diary-time-regexp | ||
| 796 | "\\)?\\(?2:" (regexp-quote todos-nondiary-end) "\\)") | ||
| 797 | lim t)) | ||
| 798 | |||
| 799 | (defun todos-diary-nonmarking-matcher (lim) | ||
| 800 | "Search for diary nonmarking symbol within LIM for font-locking." | ||
| 801 | (re-search-forward (concat "^\\(?1:" (regexp-quote diary-nonmarking-symbol) | ||
| 802 | "\\)" todos-date-pattern) lim t)) | ||
| 803 | |||
| 804 | (defun todos-diary-expired-matcher (lim) | ||
| 805 | "Search for expired diary item date within LIM for font-locking." | ||
| 806 | (when (re-search-forward (concat "^\\(?:" | ||
| 807 | (regexp-quote diary-nonmarking-symbol) | ||
| 808 | "\\)?\\(?1:" todos-date-pattern "\\) \\(?2:" | ||
| 809 | diary-time-regexp "\\)?") lim t) | ||
| 810 | (let* ((date (match-string-no-properties 1)) | ||
| 811 | (time (match-string-no-properties 2)) | ||
| 812 | ;; days-between needs a non-empty time string. | ||
| 813 | (date-time (concat date " " (or time "00:00")))) | ||
| 814 | (or (and (not (string-match ".+day\\|\\*" date)) | ||
| 815 | (< (days-between date-time (current-time-string)) 0)) | ||
| 816 | (todos-diary-expired-matcher lim))))) | ||
| 817 | |||
| 818 | (defun todos-done-string-matcher (lim) | ||
| 819 | "Search for Todos done header within LIM for font-locking." | ||
| 820 | (re-search-forward (concat todos-done-string-start | ||
| 821 | "[^][]+]") | ||
| 822 | lim t)) | ||
| 823 | |||
| 824 | (defun todos-comment-string-matcher (lim) | ||
| 825 | "Search for Todos done comment within LIM for font-locking." | ||
| 826 | (re-search-forward (concat "\\[\\(?1:" todos-comment-string "\\):") | ||
| 827 | lim t)) | ||
| 828 | |||
| 829 | ;; (defun todos-category-string-matcher (lim) | ||
| 830 | ;; "Search for Todos category name within LIM for font-locking. | ||
| 831 | ;; This is for fontifying category names appearing in Todos filter | ||
| 832 | ;; mode." | ||
| 833 | ;; (if (eq major-mode 'todos-filter-items-mode) | ||
| 834 | ;; (re-search-forward | ||
| 835 | ;; (concat "^\\(?:" todos-date-string-start "\\)?" todos-date-pattern | ||
| 836 | ;; "\\(?: " diary-time-regexp "\\)?\\(?:" | ||
| 837 | ;; (regexp-quote todos-nondiary-end) "\\)? \\(?1:\\[.+\\]\\)") | ||
| 838 | ;; lim t))) | ||
| 839 | |||
| 840 | (defun todos-category-string-matcher-1 (lim) | ||
| 841 | "Search for Todos category name within LIM for font-locking. | ||
| 842 | This is for fontifying category names appearing in Todos filter | ||
| 843 | mode following done items." | ||
| 844 | (if (eq major-mode 'todos-filter-items-mode) | ||
| 845 | (re-search-forward (concat todos-done-string-start todos-date-pattern | ||
| 846 | "\\(?: " diary-time-regexp | ||
| 847 | ;; Use non-greedy operator to prevent | ||
| 848 | ;; capturing possible following non-diary | ||
| 849 | ;; date string. | ||
| 850 | "\\)?] \\(?1:\\[.+?\\]\\)") | ||
| 851 | lim t))) | ||
| 852 | |||
| 853 | (defun todos-category-string-matcher-2 (lim) | ||
| 854 | "Search for Todos category name within LIM for font-locking. | ||
| 855 | This is for fontifying category names appearing in Todos filter | ||
| 856 | mode following todo (not done) items." | ||
| 857 | (if (eq major-mode 'todos-filter-items-mode) | ||
| 858 | (re-search-forward (concat todos-date-string-start todos-date-pattern | ||
| 859 | "\\(?: " diary-time-regexp "\\)?\\(?:" | ||
| 860 | (regexp-quote todos-nondiary-end) | ||
| 861 | "\\)? \\(?1:\\[.+\\]\\)") | ||
| 862 | lim t))) | ||
| 863 | |||
| 782 | (defvar todos-font-lock-keywords | 864 | (defvar todos-font-lock-keywords |
| 783 | (list | 865 | (list |
| 784 | '(todos-nondiary-marker-matcher 1 todos-done-sep-face t) | 866 | '(todos-nondiary-marker-matcher 1 todos-done-sep-face t) |
| @@ -933,88 +1015,6 @@ users option `todos-show-current-file' is non-nil).") | |||
| 933 | (concat "^\\[" (regexp-quote todos-done-string)) | 1015 | (concat "^\\[" (regexp-quote todos-done-string)) |
| 934 | "Regular expression matching start of done item.") | 1016 | "Regular expression matching start of done item.") |
| 935 | 1017 | ||
| 936 | (defun todos-date-string-matcher (lim) | ||
| 937 | "Search for Todos date string within LIM for font-locking." | ||
| 938 | (re-search-forward | ||
| 939 | (concat todos-date-string-start "\\(?1:" todos-date-pattern "\\)") lim t)) | ||
| 940 | |||
| 941 | (defun todos-time-string-matcher (lim) | ||
| 942 | "Search for Todos time string within LIM for font-locking." | ||
| 943 | (re-search-forward (concat todos-date-string-start todos-date-pattern | ||
| 944 | " \\(?1:" diary-time-regexp "\\)") lim t)) | ||
| 945 | |||
| 946 | (defun todos-nondiary-marker-matcher (lim) | ||
| 947 | "Search for Todos nondiary markers within LIM for font-locking." | ||
| 948 | (re-search-forward (concat "^\\(?1:" (regexp-quote todos-nondiary-start) "\\)" | ||
| 949 | todos-date-pattern "\\(?: " diary-time-regexp | ||
| 950 | "\\)?\\(?2:" (regexp-quote todos-nondiary-end) "\\)") | ||
| 951 | lim t)) | ||
| 952 | |||
| 953 | (defun todos-diary-nonmarking-matcher (lim) | ||
| 954 | "Search for diary nonmarking symbol within LIM for font-locking." | ||
| 955 | (re-search-forward (concat "^\\(?1:" (regexp-quote diary-nonmarking-symbol) | ||
| 956 | "\\)" todos-date-pattern) lim t)) | ||
| 957 | |||
| 958 | (defun todos-diary-expired-matcher (lim) | ||
| 959 | "Search for expired diary item date within LIM for font-locking." | ||
| 960 | (when (re-search-forward (concat "^\\(?:" | ||
| 961 | (regexp-quote diary-nonmarking-symbol) | ||
| 962 | "\\)?\\(?1:" todos-date-pattern "\\) \\(?2:" | ||
| 963 | diary-time-regexp "\\)?") lim t) | ||
| 964 | (let* ((date (match-string-no-properties 1)) | ||
| 965 | (time (match-string-no-properties 2)) | ||
| 966 | ;; days-between needs a non-empty time string. | ||
| 967 | (date-time (concat date " " (or time "00:00")))) | ||
| 968 | (or (and (not (string-match ".+day\\|\\*" date)) | ||
| 969 | (< (days-between date-time (current-time-string)) 0)) | ||
| 970 | (todos-diary-expired-matcher lim))))) | ||
| 971 | |||
| 972 | (defun todos-done-string-matcher (lim) | ||
| 973 | "Search for Todos done header within LIM for font-locking." | ||
| 974 | (re-search-forward (concat todos-done-string-start | ||
| 975 | "[^][]+]") | ||
| 976 | lim t)) | ||
| 977 | |||
| 978 | (defun todos-comment-string-matcher (lim) | ||
| 979 | "Search for Todos done comment within LIM for font-locking." | ||
| 980 | (re-search-forward (concat "\\[\\(?1:" todos-comment-string "\\):") | ||
| 981 | lim t)) | ||
| 982 | |||
| 983 | ;; (defun todos-category-string-matcher (lim) | ||
| 984 | ;; "Search for Todos category name within LIM for font-locking. | ||
| 985 | ;; This is for fontifying category names appearing in Todos filter | ||
| 986 | ;; mode." | ||
| 987 | ;; (if (eq major-mode 'todos-filter-items-mode) | ||
| 988 | ;; (re-search-forward | ||
| 989 | ;; (concat "^\\(?:" todos-date-string-start "\\)?" todos-date-pattern | ||
| 990 | ;; "\\(?: " diary-time-regexp "\\)?\\(?:" | ||
| 991 | ;; (regexp-quote todos-nondiary-end) "\\)? \\(?1:\\[.+\\]\\)") | ||
| 992 | ;; lim t))) | ||
| 993 | |||
| 994 | (defun todos-category-string-matcher-1 (lim) | ||
| 995 | "Search for Todos category name within LIM for font-locking. | ||
| 996 | This is for fontifying category names appearing in Todos filter | ||
| 997 | mode following done items." | ||
| 998 | (if (eq major-mode 'todos-filter-items-mode) | ||
| 999 | (re-search-forward (concat todos-done-string-start todos-date-pattern | ||
| 1000 | "\\(?: " diary-time-regexp | ||
| 1001 | ;; Use non-greedy operator to prevent | ||
| 1002 | ;; capturing possible following non-diary | ||
| 1003 | ;; date string. | ||
| 1004 | "\\)?] \\(?1:\\[.+?\\]\\)") | ||
| 1005 | lim t))) | ||
| 1006 | |||
| 1007 | (defun todos-category-string-matcher-2 (lim) | ||
| 1008 | "Search for Todos category name within LIM for font-locking. | ||
| 1009 | This is for fontifying category names appearing in Todos filter | ||
| 1010 | mode following todo (not done) items." | ||
| 1011 | (if (eq major-mode 'todos-filter-items-mode) | ||
| 1012 | (re-search-forward (concat todos-date-string-start todos-date-pattern | ||
| 1013 | "\\(?: " diary-time-regexp "\\)?\\(?:" | ||
| 1014 | (regexp-quote todos-nondiary-end) | ||
| 1015 | "\\)? \\(?1:\\[.+\\]\\)") | ||
| 1016 | lim t))) | ||
| 1017 | |||
| 1018 | (defun todos-category-number (cat) | 1018 | (defun todos-category-number (cat) |
| 1019 | "Return the number of category CAT in this Todos file. | 1019 | "Return the number of category CAT in this Todos file. |
| 1020 | The buffer-local variable `todos-category-number' holds this | 1020 | The buffer-local variable `todos-category-number' holds this |
| @@ -1282,11 +1282,10 @@ editing or a bug in todos.el." | |||
| 1282 | (unless (looking-at "^$") | 1282 | (unless (looking-at "^$") |
| 1283 | (let ((done (todos-done-item-p))) | 1283 | (let ((done (todos-done-item-p))) |
| 1284 | (todos-forward-item) | 1284 | (todos-forward-item) |
| 1285 | (unless (eq major-mode 'todos-filter-items-mode) | 1285 | ;; Adjust if item is last unfinished one before displayed done items. |
| 1286 | ;; Adjust if item is last unfinished one before displayed done items. | 1286 | (when (and (not done) (todos-done-item-p)) |
| 1287 | (when (and (not done) (todos-done-item-p)) | 1287 | (forward-line -1)) |
| 1288 | (forward-line -1)) | 1288 | (backward-char)) |
| 1289 | (backward-char))) | ||
| 1290 | (point))) | 1289 | (point))) |
| 1291 | 1290 | ||
| 1292 | (defun todos-item-string () | 1291 | (defun todos-item-string () |
| @@ -2238,8 +2237,8 @@ which is the value of the user option | |||
| 2238 | ;("" . todos-display-categories-alphabetically) | 2237 | ;("" . todos-display-categories-alphabetically) |
| 2239 | ("H" . todos-highlight-item) | 2238 | ("H" . todos-highlight-item) |
| 2240 | ("N" . todos-toggle-item-numbering) | 2239 | ("N" . todos-toggle-item-numbering) |
| 2241 | ("D" . todos-toggle-display-date-time) | 2240 | ("D" . todos-hide-show-date-time) |
| 2242 | ("*" . todos-toggle-mark-item) | 2241 | ("*" . todos-mark-unmark-item) |
| 2243 | ("C*" . todos-mark-category) | 2242 | ("C*" . todos-mark-category) |
| 2244 | ("Cu" . todos-unmark-category) | 2243 | ("Cu" . todos-unmark-category) |
| 2245 | ("PP" . todos-print) | 2244 | ("PP" . todos-print) |
| @@ -2254,7 +2253,7 @@ which is the value of the user option | |||
| 2254 | ("Fe" . todos-edit-multiline) | 2253 | ("Fe" . todos-edit-multiline) |
| 2255 | ("Fh" . todos-highlight-item) | 2254 | ("Fh" . todos-highlight-item) |
| 2256 | ("Fn" . todos-toggle-item-numbering) | 2255 | ("Fn" . todos-toggle-item-numbering) |
| 2257 | ("Fd" . todos-toggle-display-date-time) | 2256 | ("Fd" . todos-hide-show-date-time) |
| 2258 | ("Ftt" . todos-top-priorities) | 2257 | ("Ftt" . todos-top-priorities) |
| 2259 | ("Ftm" . todos-top-priorities-multifile) | 2258 | ("Ftm" . todos-top-priorities-multifile) |
| 2260 | ("Fts" . todos-set-top-priorities-in-file) | 2259 | ("Fts" . todos-set-top-priorities-in-file) |
| @@ -2345,7 +2344,7 @@ which is the value of the user option | |||
| 2345 | ;; ["List Categories Alphabetically" todos-display-categories-alphabetically t] | 2344 | ;; ["List Categories Alphabetically" todos-display-categories-alphabetically t] |
| 2346 | ["Turn Item Highlighting on/off" todos-highlight-item t] | 2345 | ["Turn Item Highlighting on/off" todos-highlight-item t] |
| 2347 | ["Turn Item Numbering on/off" todos-toggle-item-numbering t] | 2346 | ["Turn Item Numbering on/off" todos-toggle-item-numbering t] |
| 2348 | ["Turn Item Time Stamp on/off" todos-toggle-display-date-time t] | 2347 | ["Turn Item Time Stamp on/off" todos-hide-show-date-time t] |
| 2349 | ["View/Hide Done Items" todos-toggle-view-done-items t] | 2348 | ["View/Hide Done Items" todos-toggle-view-done-items t] |
| 2350 | "---" | 2349 | "---" |
| 2351 | ["View Diary Items" todos-diary-items t] | 2350 | ["View Diary Items" todos-diary-items t] |
| @@ -2399,7 +2398,7 @@ which is the value of the user option | |||
| 2399 | (define-key map "C" 'todos-display-categories) | 2398 | (define-key map "C" 'todos-display-categories) |
| 2400 | (define-key map "H" 'todos-highlight-item) | 2399 | (define-key map "H" 'todos-highlight-item) |
| 2401 | (define-key map "N" 'todos-toggle-item-numbering) | 2400 | (define-key map "N" 'todos-toggle-item-numbering) |
| 2402 | ;; (define-key map "" 'todos-toggle-display-date-time) | 2401 | ;; (define-key map "" 'todos-hide-show-date-time) |
| 2403 | (define-key map "P" 'todos-print) | 2402 | (define-key map "P" 'todos-print) |
| 2404 | (define-key map "q" 'todos-quit) | 2403 | (define-key map "q" 'todos-quit) |
| 2405 | (define-key map "s" 'todos-save) | 2404 | (define-key map "s" 'todos-save) |
| @@ -2447,7 +2446,7 @@ which is the value of the user option | |||
| 2447 | (define-key map "p" 'todos-backward-item) | 2446 | (define-key map "p" 'todos-backward-item) |
| 2448 | (define-key map "H" 'todos-highlight-item) | 2447 | (define-key map "H" 'todos-highlight-item) |
| 2449 | (define-key map "N" 'todos-toggle-item-numbering) | 2448 | (define-key map "N" 'todos-toggle-item-numbering) |
| 2450 | (define-key map "D" 'todos-toggle-display-date-time) | 2449 | (define-key map "D" 'todos-hide-show-date-time) |
| 2451 | (define-key map "P" 'todos-print) | 2450 | (define-key map "P" 'todos-print) |
| 2452 | (define-key map "q" 'todos-quit) | 2451 | (define-key map "q" 'todos-quit) |
| 2453 | (define-key map "s" 'todos-save) | 2452 | (define-key map "s" 'todos-save) |
| @@ -2637,6 +2636,10 @@ and done items are always shown on visiting a category." | |||
| 2637 | (concat (file-name-sans-extension todos-current-todos-file) | 2636 | (concat (file-name-sans-extension todos-current-todos-file) |
| 2638 | ".todo")) | 2637 | ".todo")) |
| 2639 | (t | 2638 | (t |
| 2639 | ;; FIXME: If an archive is value of | ||
| 2640 | ;; todos-current-todos-file, todos-show will revisit | ||
| 2641 | ;; rather than the corresponding todo file -- ok or make | ||
| 2642 | ;; it customizable? | ||
| 2640 | (or todos-current-todos-file | 2643 | (or todos-current-todos-file |
| 2641 | (and todos-show-current-file | 2644 | (and todos-show-current-file |
| 2642 | todos-global-current-todos-file) | 2645 | todos-global-current-todos-file) |
| @@ -2775,7 +2778,7 @@ last category displayed." | |||
| 2775 | (hl-line-mode -1) | 2778 | (hl-line-mode -1) |
| 2776 | (hl-line-mode 1))) | 2779 | (hl-line-mode 1))) |
| 2777 | 2780 | ||
| 2778 | (defun todos-toggle-display-date-time () ;(&optional all) | 2781 | (defun todos-hide-show-date-time () ;(&optional all) |
| 2779 | "Hide or show date-time header of todo items.";; in current category. | 2782 | "Hide or show date-time header of todo items.";; in current category. |
| 2780 | ;; With non-nil prefix argument ALL do this in the whole file." | 2783 | ;; With non-nil prefix argument ALL do this in the whole file." |
| 2781 | (interactive "P") | 2784 | (interactive "P") |
| @@ -2804,7 +2807,7 @@ last category displayed." | |||
| 2804 | (overlay-put ov 'display ""))) | 2807 | (overlay-put ov 'display ""))) |
| 2805 | (todos-forward-item))))))) | 2808 | (todos-forward-item))))))) |
| 2806 | 2809 | ||
| 2807 | (defun todos-toggle-mark-item (&optional n all) | 2810 | (defun todos-mark-unmark-item (&optional n all) |
| 2808 | "Mark item at point if unmarked, or unmark it if marked. | 2811 | "Mark item at point if unmarked, or unmark it if marked. |
| 2809 | 2812 | ||
| 2810 | With a positive numerical prefix argument N, change the | 2813 | With a positive numerical prefix argument N, change the |
| @@ -2845,7 +2848,7 @@ is \"*\", then the mark is \"@\"." | |||
| 2845 | "Put the \"*\" mark on all items in this category. | 2848 | "Put the \"*\" mark on all items in this category. |
| 2846 | \(If `todos-prefix' is \"*\", then the mark is \"@\".)" | 2849 | \(If `todos-prefix' is \"*\", then the mark is \"@\".)" |
| 2847 | (interactive) | 2850 | (interactive) |
| 2848 | (todos-toggle-mark-item 0 t)) | 2851 | (todos-mark-unmark-item 0 t)) |
| 2849 | 2852 | ||
| 2850 | (defun todos-unmark-category () | 2853 | (defun todos-unmark-category () |
| 2851 | "Remove the \"*\" mark from all items in this category. | 2854 | "Remove the \"*\" mark from all items in this category. |
| @@ -3292,15 +3295,15 @@ With numerical prefix COUNT, move point COUNT items upward," | |||
| 3292 | (todos-item-start) | 3295 | (todos-item-start) |
| 3293 | (unless (bobp) | 3296 | (unless (bobp) |
| 3294 | (re-search-backward todos-item-start nil t (or count 1))) | 3297 | (re-search-backward todos-item-start nil t (or count 1))) |
| 3295 | (unless (eq major-mode 'todos-filter-items-mode) | 3298 | ;; Unless this is a regexp filtered items buffer (which can contain |
| 3296 | ;; If points advances by one from a done to a todo item, go back to the | 3299 | ;; intermixed todo and done items), if points advances by one from a done |
| 3297 | ;; space above todos-done-separator, since that is a legitimate place to | 3300 | ;; to a todo item, go back to the space above todos-done-separator, since |
| 3298 | ;; insert an item. But skip this space if count > 1, since that should | 3301 | ;; that is a legitimate place to insert an item. But skip this space if |
| 3299 | ;; only stop on an item (FIXME: or not?) | 3302 | ;; count > 1, since that should only stop on an item (FIXME: or not?) |
| 3300 | (when (and done (not (todos-done-item-p)) | 3303 | (when (and done (not (todos-done-item-p)) (or (not count) (= count 1)) |
| 3301 | (or (not count) (= count 1))) | 3304 | (not (equal (buffer-name) todos-regexp-items-buffer))) |
| 3302 | (re-search-forward (concat "^" (regexp-quote todos-category-done)) nil t) | 3305 | (re-search-forward (concat "^" (regexp-quote todos-category-done)) nil t) |
| 3303 | (forward-line -1))))) | 3306 | (forward-line -1)))) |
| 3304 | 3307 | ||
| 3305 | ;; FIXME: (i) Extend search to other Todos files. (ii) Allow navigating among | 3308 | ;; FIXME: (i) Extend search to other Todos files. (ii) Allow navigating among |
| 3306 | ;; hits. | 3309 | ;; hits. |
| @@ -3823,16 +3826,16 @@ the new item: | |||
| 3823 | 3826 | ||
| 3824 | To facilitate using these arguments when inserting a new todo | 3827 | To facilitate using these arguments when inserting a new todo |
| 3825 | item, convenience commands have been defined for all admissible | 3828 | item, convenience commands have been defined for all admissible |
| 3826 | combinations (96 in all!) together with mnenomic key bindings | 3829 | combinations together with mnenomic key bindings based on on the |
| 3827 | based on on the name of the arguments and their order in the | 3830 | name of the arguments and their order in the command's argument |
| 3828 | command's argument list: diar_y_ - nonmar_k_ing - _c_alendar or | 3831 | list: diar_y_ - nonmar_k_ing - _c_alendar or _d_ate or day_n_ame |
| 3829 | _d_ate or day_n_ame - _t_ime - _r_egion or _h_ere. These key | 3832 | - _t_ime - _r_egion or _h_ere. These key combinations are |
| 3830 | combinations are appended to the basic insertion key (i) and keys | 3833 | appended to the basic insertion key (i) and keys that allow a |
| 3831 | that allow a following key must be doubled when used finally. | 3834 | following key must be doubled when used finally. For example, |
| 3832 | For example, `iyh' will insert a new item with today's date, | 3835 | `iyh' will insert a new item with today's date, marked according |
| 3833 | marked according to the DIARY argument described above, and with | 3836 | to the DIARY argument described above, and with priority |
| 3834 | priority according to the HERE argument; while `iyy' does the | 3837 | according to the HERE argument; while `iyy' does the same except |
| 3835 | same except the priority is not given by HERE but by prompting." | 3838 | the priority is not given by HERE but by prompting." |
| 3836 | ;; An alternative interface for customizing key | 3839 | ;; An alternative interface for customizing key |
| 3837 | ;; binding is also provided with the function | 3840 | ;; binding is also provided with the function |
| 3838 | ;; `todos-insertion-bindings'." ;FIXME | 3841 | ;; `todos-insertion-bindings'." ;FIXME |
| @@ -4269,6 +4272,10 @@ items in this category." | |||
| 4269 | With non-nil argument LOWER lower item's priority." | 4272 | With non-nil argument LOWER lower item's priority." |
| 4270 | (interactive) | 4273 | (interactive) |
| 4271 | (unless (or (todos-done-item-p) | 4274 | (unless (or (todos-done-item-p) |
| 4275 | (and (eq major-mode 'todos-filter-items-mode) | ||
| 4276 | ;; Items in Top Priorities buffer can be reprioritized. | ||
| 4277 | (not (string-match (regexp-quote todos-top-priorities-buffer) | ||
| 4278 | (buffer-name)))) | ||
| 4272 | ;; Point is between todo and done items. | 4279 | ;; Point is between todo and done items. |
| 4273 | (looking-at "^$")) | 4280 | (looking-at "^$")) |
| 4274 | (let (buffer-read-only) | 4281 | (let (buffer-read-only) |
| @@ -4282,7 +4289,7 @@ With non-nil argument LOWER lower item's priority." | |||
| 4282 | (> (count-lines (point-min) (point)) 0)) | 4289 | (> (count-lines (point-min) (point)) 0)) |
| 4283 | (let ((item (todos-item-string)) | 4290 | (let ((item (todos-item-string)) |
| 4284 | (marked (todos-marked-item-p))) | 4291 | (marked (todos-marked-item-p))) |
| 4285 | ;; In Todos Top Priorities mode, an item's priority can be changed | 4292 | ;; In Top Priorities buffer, an item's priority can be changed |
| 4286 | ;; wrt items in another category, but not wrt items in the same | 4293 | ;; wrt items in another category, but not wrt items in the same |
| 4287 | ;; category. | 4294 | ;; category. |
| 4288 | (when (eq major-mode 'todos-filter-items-mode) | 4295 | (when (eq major-mode 'todos-filter-items-mode) |