diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 18 | ||||
| -rw-r--r-- | lisp/calendar/todos.el | 262 |
2 files changed, 176 insertions, 104 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6f41ead73ee..198361e4822 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,23 @@ | |||
| 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: (todos-set-show-current-file): Rename from | ||
| 4 | todos-toggle-show-current-file and adjust callers. | ||
| 5 | (todos-number-priorities): Rename from todos-number-prefix and | ||
| 6 | adjust users. | ||
| 7 | (todos-update-count): Rename from todos-set-count and adjust | ||
| 8 | callers. | ||
| 9 | (todos-hide-show-item-numbering): Rename from | ||
| 10 | todos-toggle-item-numbering and adjust callers. | ||
| 11 | (todos-hide-show-done-items): Rename from | ||
| 12 | todos-toggle-view-done-items and adjust callers. | ||
| 13 | (todos-show-done-only): Rename from todos-toggle-show-done-only. | ||
| 14 | (todos-view-archived-items): Comment out. | ||
| 15 | (todos-show-archive): Prompt to choose another archive file if | ||
| 16 | current Todos file lacks an archive; prompt to visit archive | ||
| 17 | anyway when current category has no archived items. | ||
| 18 | |||
| 19 | 2012-09-21 Stephen Berman <stephen.berman@gmx.net> | ||
| 20 | |||
| 3 | * calendar/todos.el: Further comment revision and code | 21 | * calendar/todos.el: Further comment revision and code |
| 4 | rearrangement. | 22 | rearrangement. |
| 5 | (todos-item-end): Revert last change. | 23 | (todos-item-end): Revert last change. |
diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el index 266e87c47b5..4e7e19d9556 100644 --- a/lisp/calendar/todos.el +++ b/lisp/calendar/todos.el | |||
| @@ -94,10 +94,10 @@ Called after adding or deleting a Todos file." | |||
| 94 | Otherwise, `todos-show' always visits `todos-default-todos-file'." | 94 | Otherwise, `todos-show' always visits `todos-default-todos-file'." |
| 95 | :type 'boolean | 95 | :type 'boolean |
| 96 | :initialize 'custom-initialize-default | 96 | :initialize 'custom-initialize-default |
| 97 | :set 'todos-toggle-show-current-file | 97 | :set 'todos-set-show-current-file |
| 98 | :group 'todos) | 98 | :group 'todos) |
| 99 | 99 | ||
| 100 | (defun todos-toggle-show-current-file (symbol value) | 100 | (defun todos-set-show-current-file (symbol value) |
| 101 | "The :set function for user option `todos-show-current-file'." | 101 | "The :set function for user option `todos-show-current-file'." |
| 102 | (custom-set-default symbol value) | 102 | (custom-set-default symbol value) |
| 103 | (if value | 103 | (if value |
| @@ -134,7 +134,7 @@ displayed correctly." | |||
| 134 | :set 'todos-reset-prefix | 134 | :set 'todos-reset-prefix |
| 135 | :group 'todos) | 135 | :group 'todos) |
| 136 | 136 | ||
| 137 | (defcustom todos-number-prefix t | 137 | (defcustom todos-number-priorities t |
| 138 | "Non-nil to prefix items with consecutively increasing integers. | 138 | "Non-nil to prefix items with consecutively increasing integers. |
| 139 | These reflect the priorities of the items in each category." | 139 | These reflect the priorities of the items in each category." |
| 140 | :type 'boolean | 140 | :type 'boolean |
| @@ -143,7 +143,7 @@ These reflect the priorities of the items in each category." | |||
| 143 | :group 'todos) | 143 | :group 'todos) |
| 144 | 144 | ||
| 145 | (defun todos-reset-prefix (symbol value) | 145 | (defun todos-reset-prefix (symbol value) |
| 146 | "The :set function for `todos-prefix' and `todos-number-prefix'." | 146 | "The :set function for `todos-prefix' and `todos-number-priorities'." |
| 147 | (let ((oldvalue (symbol-value symbol)) | 147 | (let ((oldvalue (symbol-value symbol)) |
| 148 | (files (append todos-files todos-archives))) | 148 | (files (append todos-files todos-archives))) |
| 149 | (custom-set-default symbol value) | 149 | (custom-set-default symbol value) |
| @@ -165,14 +165,15 @@ These reflect the priorities of the items in each category." | |||
| 165 | ;; window-configuration-change-hook in todos-mode? But this depends on the | 165 | ;; window-configuration-change-hook in todos-mode? But this depends on the |
| 166 | ;; value being window-width instead of a constant length. | 166 | ;; value being window-width instead of a constant length. |
| 167 | (defcustom todos-done-separator (make-string (window-width) ?_) | 167 | (defcustom todos-done-separator (make-string (window-width) ?_) |
| 168 | "String used to visual separate done from not done items. | 168 | "String used to visually separate done from not done items. |
| 169 | Displayed in a before-string overlay by `todos-toggle-view-done-items'." | 169 | Displayed as an overlay instead of `todos-done-separator' when |
| 170 | done items are shown." | ||
| 170 | :type 'string | 171 | :type 'string |
| 171 | :initialize 'custom-initialize-default | 172 | :initialize 'custom-initialize-default |
| 172 | :set 'todos-reset-separator | 173 | :set 'todos-reset-separator |
| 173 | :group 'todos) | 174 | :group 'todos) |
| 174 | 175 | ||
| 175 | ;; (defun todos-reset-separator (symbol value) | 176 | ;; (defun todos-reset-done-separator (symbol value) |
| 176 | ;; "The :set function for `todos-done-separator' | 177 | ;; "The :set function for `todos-done-separator' |
| 177 | ;; Also added to `window-configuration-change-hook' in Todos mode." | 178 | ;; Also added to `window-configuration-change-hook' in Todos mode." |
| 178 | ;; (let ((oldvalue (symbol-value symbol))) | 179 | ;; (let ((oldvalue (symbol-value symbol))) |
| @@ -484,7 +485,8 @@ The amount of indentation is given by user option | |||
| 484 | (unless (member '(continuation) fringe-indicator-alist) | 485 | (unless (member '(continuation) fringe-indicator-alist) |
| 485 | (push '(continuation) fringe-indicator-alist))) | 486 | (push '(continuation) fringe-indicator-alist))) |
| 486 | 487 | ||
| 487 | ;; FIXME: :set function (otherwise change takes effect only after revisiting) | 488 | ;; FIXME: :set function (otherwise change takes effect only after killing and |
| 489 | ;; revisiting file) | ||
| 488 | (defcustom todos-indent-to-here 6 | 490 | (defcustom todos-indent-to-here 6 |
| 489 | "Number of spaces `todos-line-wrapping-function' indents to." | 491 | "Number of spaces `todos-line-wrapping-function' indents to." |
| 490 | :type '(integer :validate | 492 | :type '(integer :validate |
| @@ -896,8 +898,6 @@ mode following todo (not done) items." | |||
| 896 | This function is added to `pre-command-hook' when user option | 898 | This function is added to `pre-command-hook' when user option |
| 897 | `todos-show-current-file' is set to non-nil." | 899 | `todos-show-current-file' is set to non-nil." |
| 898 | (setq todos-global-current-todos-file todos-current-todos-file)) | 900 | (setq todos-global-current-todos-file todos-current-todos-file)) |
| 899 | ;; (and (eq major-mode 'todos-mode) | ||
| 900 | ;; (setq todos-global-current-todos-file (buffer-file-name)))) | ||
| 901 | 901 | ||
| 902 | (defun todos-after-find-file () | 902 | (defun todos-after-find-file () |
| 903 | "Show Todos files correctly when visited from outside of Todos mode." | 903 | "Show Todos files correctly when visited from outside of Todos mode." |
| @@ -929,8 +929,8 @@ This function is added to `kill-buffer-hook' in Todos mode." | |||
| 929 | "Alist of categories in the current Todos file. | 929 | "Alist of categories in the current Todos file. |
| 930 | The elements are cons cells whose car is a category name and | 930 | The elements are cons cells whose car is a category name and |
| 931 | whose cdr is a vector of the category's item counts. These are, | 931 | whose cdr is a vector of the category's item counts. These are, |
| 932 | in order, the numbers of todo items, todo items included in the | 932 | in order, the numbers of todo items, of todo items included in |
| 933 | Diary, done items and archived items.") | 933 | the Diary, of done items and of archived items.") |
| 934 | 934 | ||
| 935 | (defvar todos-categories-full nil | 935 | (defvar todos-categories-full nil |
| 936 | "Variable holding non-truncated copy of `todos-categories'. | 936 | "Variable holding non-truncated copy of `todos-categories'. |
| @@ -951,7 +951,7 @@ See `todos-display-categories-first'.") | |||
| 951 | 951 | ||
| 952 | (defvar todos-show-done-only nil | 952 | (defvar todos-show-done-only nil |
| 953 | "If non-nil display only done items in current category. | 953 | "If non-nil display only done items in current category. |
| 954 | Set by `todos-toggle-show-done-only' and used by | 954 | Set by the command `todos-show-done-only' and used by |
| 955 | `todos-category-select'.") | 955 | `todos-category-select'.") |
| 956 | 956 | ||
| 957 | ;; --------------------------------------------------------------------------- | 957 | ;; --------------------------------------------------------------------------- |
| @@ -964,7 +964,7 @@ current Todos file rather than the default Todos file (i.e. when | |||
| 964 | users option `todos-show-current-file' is non-nil).") | 964 | users option `todos-show-current-file' is non-nil).") |
| 965 | 965 | ||
| 966 | (defun todos-reevaluate-defcustoms () | 966 | (defun todos-reevaluate-defcustoms () |
| 967 | "Reevaluate defcustoms that show list of Todos files." | 967 | "Reevaluate defcustoms that provide choice list of Todos files." |
| 968 | (custom-set-default 'todos-default-todos-file | 968 | (custom-set-default 'todos-default-todos-file |
| 969 | (symbol-value 'todos-default-todos-file)) | 969 | (symbol-value 'todos-default-todos-file)) |
| 970 | (todos-reevaluate-default-file-defcustom) | 970 | (todos-reevaluate-default-file-defcustom) |
| @@ -1094,10 +1094,9 @@ If CATEGORY is nil, default to the current category." | |||
| 1094 | ((eq type 'archived) 3)))) | 1094 | ((eq type 'archived) 3)))) |
| 1095 | (aref counts idx))) | 1095 | (aref counts idx))) |
| 1096 | 1096 | ||
| 1097 | ;; FIXME: rename to todos-increment-count | 1097 | (defun todos-update-count (type increment &optional category) |
| 1098 | (defun todos-set-count (type increment &optional category) | 1098 | "Change count of TYPE items in CATEGORY by integer INCREMENT. |
| 1099 | "Increment count of TYPE items in CATEGORY by INCREMENT. | 1099 | With nil or omitted CATEGORY, default to the current category." |
| 1100 | If CATEGORY is nil, default to the current category." | ||
| 1101 | (let* ((cat (or category (todos-current-category))) | 1100 | (let* ((cat (or category (todos-current-category))) |
| 1102 | (counts (cdr (assoc cat todos-categories))) | 1101 | (counts (cdr (assoc cat todos-categories))) |
| 1103 | (idx (cond ((eq type 'todo) 0) | 1102 | (idx (cond ((eq type 'todo) 0) |
| @@ -1187,16 +1186,16 @@ the file." | |||
| 1187 | (when (looking-at todos-done-string-start) | 1186 | (when (looking-at todos-done-string-start) |
| 1188 | (setq archive-count (1+ archive-count))) | 1187 | (setq archive-count (1+ archive-count))) |
| 1189 | (forward-line)))) | 1188 | (forward-line)))) |
| 1190 | (todos-set-count 'archived archive-count cat)))) | 1189 | (todos-update-count 'archived archive-count cat)))) |
| 1191 | ((looking-at todos-done-string-start) | 1190 | ((looking-at todos-done-string-start) |
| 1192 | (todos-set-count 'done 1 cat)) | 1191 | (todos-update-count 'done 1 cat)) |
| 1193 | ((looking-at (concat "^\\(" | 1192 | ((looking-at (concat "^\\(" |
| 1194 | (regexp-quote diary-nonmarking-symbol) | 1193 | (regexp-quote diary-nonmarking-symbol) |
| 1195 | "\\)?" todos-date-pattern)) | 1194 | "\\)?" todos-date-pattern)) |
| 1196 | (todos-set-count 'diary 1 cat) | 1195 | (todos-update-count 'diary 1 cat) |
| 1197 | (todos-set-count 'todo 1 cat)) | 1196 | (todos-update-count 'todo 1 cat)) |
| 1198 | ((looking-at (concat todos-date-string-start todos-date-pattern)) | 1197 | ((looking-at (concat todos-date-string-start todos-date-pattern)) |
| 1199 | (todos-set-count 'todo 1 cat)) | 1198 | (todos-update-count 'todo 1 cat)) |
| 1200 | ;; If first line is todos-categories list, use it and end loop | 1199 | ;; If first line is todos-categories list, use it and end loop |
| 1201 | ;; -- unless FORCEd to scan whole file. | 1200 | ;; -- unless FORCEd to scan whole file. |
| 1202 | ((bobp) | 1201 | ((bobp) |
| @@ -1306,10 +1305,9 @@ editing or a bug in todos.el." | |||
| 1306 | (delete-region beg end))) | 1305 | (delete-region beg end))) |
| 1307 | 1306 | ||
| 1308 | (defun todos-diary-item-p () | 1307 | (defun todos-diary-item-p () |
| 1309 | "Return non-nil if item at point is marked for diary inclusion." | 1308 | "Return non-nil if item at point has diary entry format." |
| 1310 | (save-excursion | 1309 | (save-excursion |
| 1311 | (todos-item-start) | 1310 | (todos-item-start) |
| 1312 | ;; (looking-at todos-date-pattern))) | ||
| 1313 | (not (looking-at (regexp-quote todos-nondiary-start))))) | 1311 | (not (looking-at (regexp-quote todos-nondiary-start))))) |
| 1314 | 1312 | ||
| 1315 | (defun todos-done-item-p () | 1313 | (defun todos-done-item-p () |
| @@ -1323,7 +1321,7 @@ editing or a bug in todos.el." | |||
| 1323 | "String used to mark items.") | 1321 | "String used to mark items.") |
| 1324 | 1322 | ||
| 1325 | (defun todos-marked-item-p () | 1323 | (defun todos-marked-item-p () |
| 1326 | "If this item is marked, return mark overlay." | 1324 | "If this item begins with `todos-item-mark', return mark overlay." |
| 1327 | (let ((ovs (overlays-in (line-beginning-position) (line-beginning-position))) | 1325 | (let ((ovs (overlays-in (line-beginning-position) (line-beginning-position))) |
| 1328 | (mark todos-item-mark) | 1326 | (mark todos-item-mark) |
| 1329 | ov marked) | 1327 | ov marked) |
| @@ -1344,11 +1342,11 @@ editing or a bug in todos.el." | |||
| 1344 | (defun todos-prefix-overlays () | 1342 | (defun todos-prefix-overlays () |
| 1345 | "Put before-string overlay in front of this category's items. | 1343 | "Put before-string overlay in front of this category's items. |
| 1346 | The overlay's value is the string `todos-prefix' or with non-nil | 1344 | The overlay's value is the string `todos-prefix' or with non-nil |
| 1347 | `todos-number-prefix' an integer in the sequence from 1 to the | 1345 | `todos-number-priorities' an integer in the sequence from 1 to |
| 1348 | number of todo or done items in the category indicating the | 1346 | the number of todo or done items in the category indicating the |
| 1349 | item's priority. Todo and done items are numbered independently | 1347 | item's priority. Todo and done items are numbered independently |
| 1350 | of each other." | 1348 | of each other." |
| 1351 | (when (or todos-number-prefix | 1349 | (when (or todos-number-priorities |
| 1352 | (not (string-match "^[[:space:]]*$" todos-prefix))) | 1350 | (not (string-match "^[[:space:]]*$" todos-prefix))) |
| 1353 | (let ((prefix (propertize (concat todos-prefix " ") | 1351 | (let ((prefix (propertize (concat todos-prefix " ") |
| 1354 | 'face 'todos-prefix-string)) | 1352 | 'face 'todos-prefix-string)) |
| @@ -1359,7 +1357,7 @@ of each other." | |||
| 1359 | (when (or (todos-date-string-matcher (line-end-position)) | 1357 | (when (or (todos-date-string-matcher (line-end-position)) |
| 1360 | (todos-done-string-matcher (line-end-position))) | 1358 | (todos-done-string-matcher (line-end-position))) |
| 1361 | (goto-char (match-beginning 0)) | 1359 | (goto-char (match-beginning 0)) |
| 1362 | (when todos-number-prefix | 1360 | (when todos-number-priorities |
| 1363 | (setq num (1+ num)) | 1361 | (setq num (1+ num)) |
| 1364 | ;; Reset number to 1 for first done item. | 1362 | ;; Reset number to 1 for first done item. |
| 1365 | (when (and (looking-at todos-done-string-start) | 1363 | (when (and (looking-at todos-done-string-start) |
| @@ -2184,7 +2182,7 @@ which is the value of the user option | |||
| 2184 | (arg3 (nth 3 args)) | 2182 | (arg3 (nth 3 args)) |
| 2185 | (arg4 (nth 4 args))) | 2183 | (arg4 (nth 4 args))) |
| 2186 | `(defun ,name (&optional arg) | 2184 | `(defun ,name (&optional arg) |
| 2187 | "Todos item insertion command." | 2185 | "Todos item insertion command generated from ARGS." |
| 2188 | (interactive) | 2186 | (interactive) |
| 2189 | (todos-insert-item arg ',arg0 ',arg1 ',arg2 ',arg3 ',arg4)))) | 2187 | (todos-insert-item arg ',arg0 ',arg1 ',arg2 ',arg3 ',arg4)))) |
| 2190 | 2188 | ||
| @@ -2236,15 +2234,15 @@ which is the value of the user option | |||
| 2236 | ("Cd" . todos-display-categories) ;FIXME: Cs todos-show-categories? | 2234 | ("Cd" . todos-display-categories) ;FIXME: Cs todos-show-categories? |
| 2237 | ;("" . todos-display-categories-alphabetically) | 2235 | ;("" . todos-display-categories-alphabetically) |
| 2238 | ("H" . todos-highlight-item) | 2236 | ("H" . todos-highlight-item) |
| 2239 | ("N" . todos-toggle-item-numbering) | 2237 | ("N" . todos-hide-show-item-numbering) |
| 2240 | ("D" . todos-hide-show-date-time) | 2238 | ("D" . todos-hide-show-date-time) |
| 2241 | ("*" . todos-mark-unmark-item) | 2239 | ("*" . todos-mark-unmark-item) |
| 2242 | ("C*" . todos-mark-category) | 2240 | ("C*" . todos-mark-category) |
| 2243 | ("Cu" . todos-unmark-category) | 2241 | ("Cu" . todos-unmark-category) |
| 2244 | ("PP" . todos-print) | 2242 | ("PP" . todos-print) |
| 2245 | ("PF" . todos-print-to-file) | 2243 | ("PF" . todos-print-to-file) |
| 2246 | ("v" . todos-toggle-view-done-items) | 2244 | ("v" . todos-hide-show-done-items) |
| 2247 | ("V" . todos-toggle-show-done-only) | 2245 | ("V" . todos-show-done-only) |
| 2248 | ("Av" . todos-view-archived-items) | 2246 | ("Av" . todos-view-archived-items) |
| 2249 | ("As" . todos-show-archive) | 2247 | ("As" . todos-show-archive) |
| 2250 | ("Ac" . todos-choose-archive) | 2248 | ("Ac" . todos-choose-archive) |
| @@ -2252,7 +2250,7 @@ which is the value of the user option | |||
| 2252 | ;;("" . todos-update-filter-files) | 2250 | ;;("" . todos-update-filter-files) |
| 2253 | ("Fe" . todos-edit-multiline) | 2251 | ("Fe" . todos-edit-multiline) |
| 2254 | ("Fh" . todos-highlight-item) | 2252 | ("Fh" . todos-highlight-item) |
| 2255 | ("Fn" . todos-toggle-item-numbering) | 2253 | ("Fn" . todos-hide-show-item-numbering) |
| 2256 | ("Fd" . todos-hide-show-date-time) | 2254 | ("Fd" . todos-hide-show-date-time) |
| 2257 | ("Ftt" . todos-top-priorities) | 2255 | ("Ftt" . todos-top-priorities) |
| 2258 | ("Ftm" . todos-top-priorities-multifile) | 2256 | ("Ftm" . todos-top-priorities-multifile) |
| @@ -2343,9 +2341,9 @@ which is the value of the user option | |||
| 2343 | ["List Current Categories" todos-display-categories t] | 2341 | ["List Current Categories" todos-display-categories t] |
| 2344 | ;; ["List Categories Alphabetically" todos-display-categories-alphabetically t] | 2342 | ;; ["List Categories Alphabetically" todos-display-categories-alphabetically t] |
| 2345 | ["Turn Item Highlighting on/off" todos-highlight-item t] | 2343 | ["Turn Item Highlighting on/off" todos-highlight-item t] |
| 2346 | ["Turn Item Numbering on/off" todos-toggle-item-numbering t] | 2344 | ["Turn Item Numbering on/off" todos-hide-show-item-numbering t] |
| 2347 | ["Turn Item Time Stamp on/off" todos-hide-show-date-time t] | 2345 | ["Turn Item Time Stamp on/off" todos-hide-show-date-time t] |
| 2348 | ["View/Hide Done Items" todos-toggle-view-done-items t] | 2346 | ["View/Hide Done Items" todos-hide-show-done-items t] |
| 2349 | "---" | 2347 | "---" |
| 2350 | ["View Diary Items" todos-diary-items t] | 2348 | ["View Diary Items" todos-diary-items t] |
| 2351 | ["View Top Priority Items" todos-top-priorities t] | 2349 | ["View Top Priority Items" todos-top-priorities t] |
| @@ -2397,7 +2395,7 @@ which is the value of the user option | |||
| 2397 | ;; display commands | 2395 | ;; display commands |
| 2398 | (define-key map "C" 'todos-display-categories) | 2396 | (define-key map "C" 'todos-display-categories) |
| 2399 | (define-key map "H" 'todos-highlight-item) | 2397 | (define-key map "H" 'todos-highlight-item) |
| 2400 | (define-key map "N" 'todos-toggle-item-numbering) | 2398 | (define-key map "N" 'todos-hide-show-item-numbering) |
| 2401 | ;; (define-key map "" 'todos-hide-show-date-time) | 2399 | ;; (define-key map "" 'todos-hide-show-date-time) |
| 2402 | (define-key map "P" 'todos-print) | 2400 | (define-key map "P" 'todos-print) |
| 2403 | (define-key map "q" 'todos-quit) | 2401 | (define-key map "q" 'todos-quit) |
| @@ -2445,7 +2443,7 @@ which is the value of the user option | |||
| 2445 | (define-key map "n" 'todos-forward-item) | 2443 | (define-key map "n" 'todos-forward-item) |
| 2446 | (define-key map "p" 'todos-backward-item) | 2444 | (define-key map "p" 'todos-backward-item) |
| 2447 | (define-key map "H" 'todos-highlight-item) | 2445 | (define-key map "H" 'todos-highlight-item) |
| 2448 | (define-key map "N" 'todos-toggle-item-numbering) | 2446 | (define-key map "N" 'todos-hide-show-item-numbering) |
| 2449 | (define-key map "D" 'todos-hide-show-date-time) | 2447 | (define-key map "D" 'todos-hide-show-date-time) |
| 2450 | (define-key map "P" 'todos-print) | 2448 | (define-key map "P" 'todos-print) |
| 2451 | (define-key map "q" 'todos-quit) | 2449 | (define-key map "q" 'todos-quit) |
| @@ -2478,7 +2476,7 @@ which is the value of the user option | |||
| 2478 | 2476 | ||
| 2479 | (defun todos-modes-set-3 () | 2477 | (defun todos-modes-set-3 () |
| 2480 | (set (make-local-variable 'todos-categories-full) nil) | 2478 | (set (make-local-variable 'todos-categories-full) nil) |
| 2481 | ;; todos-set-categories sets todos-categories-full. | 2479 | ;; todos-set-categories also sets todos-categories-full. |
| 2482 | (set (make-local-variable 'todos-categories) (todos-set-categories)) | 2480 | (set (make-local-variable 'todos-categories) (todos-set-categories)) |
| 2483 | (set (make-local-variable 'todos-category-number) 1) | 2481 | (set (make-local-variable 'todos-category-number) 1) |
| 2484 | (set (make-local-variable 'todos-first-visit) t) | 2482 | (set (make-local-variable 'todos-first-visit) t) |
| @@ -2622,7 +2620,7 @@ categories in the current Todos file. | |||
| 2622 | 2620 | ||
| 2623 | In Todos mode just the category's unfinished todo items are shown | 2621 | In Todos mode just the category's unfinished todo items are shown |
| 2624 | by default. The done items are hidden, but typing | 2622 | by default. The done items are hidden, but typing |
| 2625 | `\\[todos-toggle-view-done-items]' displays them below the todo | 2623 | `\\[todos-hide-show-done-items]' displays them below the todo |
| 2626 | items. With non-nil user option `todos-show-with-done' both todo | 2624 | items. With non-nil user option `todos-show-with-done' both todo |
| 2627 | and done items are always shown on visiting a category." | 2625 | and done items are always shown on visiting a category." |
| 2628 | (interactive "P") | 2626 | (interactive "P") |
| @@ -2711,12 +2709,12 @@ are shown in `todos-archived-only' face." | |||
| 2711 | ;; (interactive) | 2709 | ;; (interactive) |
| 2712 | ;; (todos-display-sorted 'archived)) | 2710 | ;; (todos-display-sorted 'archived)) |
| 2713 | 2711 | ||
| 2714 | (defun todos-toggle-item-numbering () | 2712 | (defun todos-hide-show-item-numbering () |
| 2715 | "" | 2713 | "" |
| 2716 | (interactive) | 2714 | (interactive) |
| 2717 | (todos-reset-prefix 'todos-number-prefix (not todos-number-prefix))) | 2715 | (todos-reset-prefix 'todos-number-priorities (not todos-number-priorities))) |
| 2718 | 2716 | ||
| 2719 | (defun todos-toggle-view-done-items () | 2717 | (defun todos-hide-show-done-items () |
| 2720 | "Show hidden or hide visible done items in current category." | 2718 | "Show hidden or hide visible done items in current category." |
| 2721 | (interactive) | 2719 | (interactive) |
| 2722 | (if (zerop (todos-get-count 'done (todos-current-category))) | 2720 | (if (zerop (todos-get-count 'done (todos-current-category))) |
| @@ -2727,43 +2725,99 @@ are shown in `todos-archived-only' face." | |||
| 2727 | todos-done-string-start nil t)))) | 2725 | todos-done-string-start nil t)))) |
| 2728 | (todos-category-select))))) | 2726 | (todos-category-select))))) |
| 2729 | 2727 | ||
| 2730 | (defun todos-toggle-show-done-only () | 2728 | (defun todos-show-done-only () |
| 2731 | "Switch between displaying only done or only todo items." | 2729 | "Switch between displaying only done or only todo items." |
| 2732 | (interactive) | 2730 | (interactive) |
| 2733 | (setq todos-show-done-only (not todos-show-done-only)) | 2731 | (setq todos-show-done-only (not todos-show-done-only)) |
| 2734 | (todos-category-select)) | 2732 | (todos-category-select)) |
| 2735 | 2733 | ||
| 2736 | (defun todos-view-archived-items () | 2734 | ;; (defun todos-view-archived-items () |
| 2737 | "Display the archived items of the current category. | 2735 | ;; "Display the archived items of the current category. |
| 2738 | The buffer showing these items is in Todos Archive mode." | 2736 | ;; The buffer showing these items is in Todos Archive mode." |
| 2739 | (interactive) | 2737 | ;; (interactive) |
| 2740 | (let ((cat (todos-current-category))) | 2738 | ;; (let ((cat (todos-current-category))) |
| 2741 | (if (zerop (todos-get-count 'archived cat)) | 2739 | ;; (if (zerop (todos-get-count 'archived cat)) |
| 2742 | (message "There are no archived items from this category.") | 2740 | ;; (message "There are no archived items from this category.") |
| 2743 | (let* ((tfile-base (file-name-sans-extension todos-current-todos-file)) | 2741 | ;; (let* ((tfile-base (file-name-sans-extension todos-current-todos-file)) |
| 2744 | (afile (concat tfile-base ".toda"))) | 2742 | ;; (afile (concat tfile-base ".toda"))) |
| 2745 | (set-window-buffer (selected-window) (set-buffer | 2743 | ;; (set-window-buffer (selected-window) (set-buffer |
| 2746 | (find-file-noselect afile))) | 2744 | ;; (find-file-noselect afile))) |
| 2747 | (todos-category-number cat) | 2745 | ;; (todos-category-number cat) |
| 2748 | (todos-jump-to-category cat))))) | 2746 | ;; (todos-jump-to-category cat))))) |
| 2747 | |||
| 2748 | ;; (defun todos-show-archive (&optional ask) | ||
| 2749 | ;; "Visit the archive of the current Todos category, if it exists. | ||
| 2750 | ;; If the category has no archived items, prompt to visit the | ||
| 2751 | ;; archive anyway. If there is no archive for this file or with | ||
| 2752 | ;; non-nil argument ASK, prompt to visit another archive. | ||
| 2753 | |||
| 2754 | ;; With non-nil argument ASK prompt to choose an archive to visit; | ||
| 2755 | ;; see `todos-choose-archive'. The buffer showing the archive is in | ||
| 2756 | ;; Todos Archive mode. The first visit in a session displays the | ||
| 2757 | ;; first category in the archive, subsequent visits return to the | ||
| 2758 | ;; last category displayed." ;FIXME | ||
| 2759 | ;; (interactive) | ||
| 2760 | ;; (let* ((cat (todos-current-category)) | ||
| 2761 | ;; (count (todos-get-count 'archived cat)) | ||
| 2762 | ;; (tfile-base (file-name-sans-extension todos-current-todos-file)) | ||
| 2763 | ;; (afile (if ask | ||
| 2764 | ;; (todos-read-file-name "Choose a Todos archive: " t t) | ||
| 2765 | ;; (concat tfile-base ".toda"))) | ||
| 2766 | ;; (answer t)) | ||
| 2767 | ;; (when (not (file-exists-p afile)) | ||
| 2768 | ;; (if (y-or-n-p "This file has no archive; visit another archive? ") | ||
| 2769 | ;; (setq afile (todos-read-file-name "Choose a Todos archive: " t t)) | ||
| 2770 | ;; (setq answer nil))) | ||
| 2771 | ;; (when answer | ||
| 2772 | ;; (if (zerop count) | ||
| 2773 | ;; (when (y-or-n-p (concat "This category has no archived items; " | ||
| 2774 | ;; "visit archive anyway? ")) | ||
| 2775 | ;; (set-window-buffer (selected-window) | ||
| 2776 | ;; (set-buffer (find-file-noselect afile))) | ||
| 2777 | ;; (todos-category-select)) | ||
| 2778 | ;; (set-window-buffer (selected-window) | ||
| 2779 | ;; (set-buffer (find-file-noselect afile))) | ||
| 2780 | ;; (todos-category-number cat) | ||
| 2781 | ;; (todos-jump-to-category cat))))) | ||
| 2749 | 2782 | ||
| 2750 | (defun todos-show-archive (&optional ask) | 2783 | (defun todos-show-archive (&optional ask) |
| 2751 | "Visit the archive of the current Todos file, if it exists. | 2784 | "Visit the archive of the current Todos category, if it exists. |
| 2785 | If the category has no archived items, prompt to visit the | ||
| 2786 | archive anyway. If there is no archive for this file or with | ||
| 2787 | non-nil argument ASK, prompt to visit another archive. | ||
| 2788 | |||
| 2752 | With non-nil argument ASK prompt to choose an archive to visit; | 2789 | With non-nil argument ASK prompt to choose an archive to visit; |
| 2753 | see `todos-choose-archive'. The buffer showing the archive is in | 2790 | see `todos-choose-archive'. The buffer showing the archive is in |
| 2754 | Todos Archive mode. The first visit in a session displays the | 2791 | Todos Archive mode. The first visit in a session displays the |
| 2755 | first category in the archive, subsequent visits return to the | 2792 | first category in the archive, subsequent visits return to the |
| 2756 | last category displayed." | 2793 | last category displayed." ;FIXME |
| 2757 | (interactive) | 2794 | (interactive) |
| 2758 | (let* ((tfile-base (file-name-sans-extension todos-current-todos-file)) | 2795 | (let* ((cat (todos-current-category)) |
| 2759 | (afile (if ask | 2796 | (count (todos-get-count 'archived cat)) |
| 2760 | (todos-read-file-name "Choose a Todos archive: " t t) | 2797 | (archive (concat (file-name-sans-extension todos-current-todos-file) |
| 2761 | (concat tfile-base ".toda")))) | 2798 | ".toda")) |
| 2762 | (if (not (file-exists-p afile)) | 2799 | (answer 'this-archive)) |
| 2763 | (message "There is currently no Todos archive for this file.") | 2800 | (when (or ask |
| 2764 | (set-window-buffer (selected-window) (set-buffer | 2801 | (and (not (file-exists-p archive)) |
| 2765 | (find-file-noselect afile))) | 2802 | (y-or-n-p (concat "This file has no archive; " |
| 2766 | (todos-category-select)))) | 2803 | "visit another archive? ")))) |
| 2804 | (setq archive (todos-read-file-name | ||
| 2805 | "Choose a Todos archive: " t t)) | ||
| 2806 | 'other-archive)) | ||
| 2807 | (when (and (eq answer 'this-archive) | ||
| 2808 | (zerop count)) | ||
| 2809 | (setq answer (if (y-or-n-p | ||
| 2810 | (concat "This category has no archived items;" | ||
| 2811 | " visit archive anyway? ")) | ||
| 2812 | 'other-cat | ||
| 2813 | 'same-cat))) | ||
| 2814 | (when answer | ||
| 2815 | (set-window-buffer (selected-window) | ||
| 2816 | (set-buffer (find-file-noselect archive))) | ||
| 2817 | (if (eq answer 'same-cat) | ||
| 2818 | (todos-category-number cat) | ||
| 2819 | (setq todos-category-number 1)) | ||
| 2820 | (todos-category-select))) | ||
| 2767 | 2821 | ||
| 2768 | (defun todos-choose-archive () | 2822 | (defun todos-choose-archive () |
| 2769 | "Choose an archive and visit it." | 2823 | "Choose an archive and visit it." |
| @@ -2978,7 +3032,7 @@ otherwise, send it to the default printer." | |||
| 2978 | (while (not (eobp)) | 3032 | (while (not (eobp)) |
| 2979 | (let ((beg (point)) | 3033 | (let ((beg (point)) |
| 2980 | (end (save-excursion (todos-item-end)))) | 3034 | (end (save-excursion (todos-item-end)))) |
| 2981 | (when todos-number-prefix | 3035 | (when todos-number-priorities |
| 2982 | (setq num (1+ num)) | 3036 | (setq num (1+ num)) |
| 2983 | (setq prefix (propertize (concat (number-to-string num) " ") | 3037 | (setq prefix (propertize (concat (number-to-string num) " ") |
| 2984 | 'face 'todos-prefix-string))) | 3038 | 'face 'todos-prefix-string))) |
| @@ -3341,7 +3395,7 @@ face." | |||
| 3341 | (todos-category-number cat) | 3395 | (todos-category-number cat) |
| 3342 | (todos-category-select) | 3396 | (todos-category-select) |
| 3343 | (if in-done | 3397 | (if in-done |
| 3344 | (unless todos-show-with-done (todos-toggle-view-done-items))) | 3398 | (unless todos-show-with-done (todos-hide-show-done-items))) |
| 3345 | (goto-char match) | 3399 | (goto-char match) |
| 3346 | (setq ov (make-overlay (- (point) (length regex)) (point))) | 3400 | (setq ov (make-overlay (- (point) (length regex)) (point))) |
| 3347 | (overlay-put ov 'face 'todos-search) | 3401 | (overlay-put ov 'face 'todos-search) |
| @@ -3721,8 +3775,8 @@ deleted." | |||
| 3721 | (insert done) | 3775 | (insert done) |
| 3722 | (remove-overlays cbeg cend) | 3776 | (remove-overlays cbeg cend) |
| 3723 | (delete-region cbeg cend) | 3777 | (delete-region cbeg cend) |
| 3724 | (todos-set-count 'todo (todos-get-count 'todo cat) goal) | 3778 | (todos-update-count 'todo (todos-get-count 'todo cat) goal) |
| 3725 | (todos-set-count 'done (todos-get-count 'done cat) goal) | 3779 | (todos-update-count 'done (todos-get-count 'done cat) goal) |
| 3726 | (setq todos-categories (delete (assoc cat todos-categories) | 3780 | (setq todos-categories (delete (assoc cat todos-categories) |
| 3727 | todos-categories)) | 3781 | todos-categories)) |
| 3728 | (todos-update-categories-sexp) | 3782 | (todos-update-categories-sexp) |
| @@ -3910,8 +3964,8 @@ the priority is not given by HERE but by prompting." | |||
| 3910 | (t | 3964 | (t |
| 3911 | (todos-insert-with-overlays new-item))) | 3965 | (todos-insert-with-overlays new-item))) |
| 3912 | (todos-set-item-priority new-item (todos-current-category) t)) | 3966 | (todos-set-item-priority new-item (todos-current-category) t)) |
| 3913 | (todos-set-count 'todo 1) | 3967 | (todos-update-count 'todo 1) |
| 3914 | (if (or diary todos-include-in-diary) (todos-set-count 'diary 1)) | 3968 | (if (or diary todos-include-in-diary) (todos-update-count 'diary 1)) |
| 3915 | (todos-update-categories-sexp))))) | 3969 | (todos-update-categories-sexp))))) |
| 3916 | 3970 | ||
| 3917 | (defvar todos-date-from-calendar nil | 3971 | (defvar todos-date-from-calendar nil |
| @@ -3959,9 +4013,9 @@ the item at point." | |||
| 3959 | (if (or (and marked (todos-marked-item-p)) item) | 4013 | (if (or (and marked (todos-marked-item-p)) item) |
| 3960 | (progn | 4014 | (progn |
| 3961 | (if (todos-done-item-p) | 4015 | (if (todos-done-item-p) |
| 3962 | (todos-set-count 'done -1) | 4016 | (todos-update-count 'done -1) |
| 3963 | (todos-set-count 'todo -1 cat) | 4017 | (todos-update-count 'todo -1 cat) |
| 3964 | (and (todos-diary-item-p) (todos-set-count 'diary -1))) | 4018 | (and (todos-diary-item-p) (todos-update-count 'diary -1))) |
| 3965 | (delete-overlay ov) | 4019 | (delete-overlay ov) |
| 3966 | (todos-remove-item) | 4020 | (todos-remove-item) |
| 3967 | ;; Don't leave point below last item. | 4021 | ;; Don't leave point below last item. |
| @@ -4175,12 +4229,12 @@ point." | |||
| 4175 | (replace-match "") | 4229 | (replace-match "") |
| 4176 | (search-forward todos-nondiary-end (1+ end) t) | 4230 | (search-forward todos-nondiary-end (1+ end) t) |
| 4177 | (replace-match "") | 4231 | (replace-match "") |
| 4178 | (todos-set-count 'diary 1)) | 4232 | (todos-update-count 'diary 1)) |
| 4179 | (when end | 4233 | (when end |
| 4180 | (insert todos-nondiary-start) | 4234 | (insert todos-nondiary-start) |
| 4181 | (goto-char (1+ end)) | 4235 | (goto-char (1+ end)) |
| 4182 | (insert todos-nondiary-end) | 4236 | (insert todos-nondiary-end) |
| 4183 | (todos-set-count 'diary -1))))) | 4237 | (todos-update-count 'diary -1))))) |
| 4184 | (unless marked (throw 'stop nil)) | 4238 | (unless marked (throw 'stop nil)) |
| 4185 | (todos-forward-item))))) | 4239 | (todos-forward-item))))) |
| 4186 | (todos-update-categories-sexp))) | 4240 | (todos-update-categories-sexp))) |
| @@ -4215,7 +4269,7 @@ items." | |||
| 4215 | (replace-match ""))))) | 4269 | (replace-match ""))))) |
| 4216 | (todos-forward-item)) | 4270 | (todos-forward-item)) |
| 4217 | (unless (if arg (zerop diary-count) (= diary-count todo-count)) | 4271 | (unless (if arg (zerop diary-count) (= diary-count todo-count)) |
| 4218 | (todos-set-count 'diary (if arg | 4272 | (todos-update-count 'diary (if arg |
| 4219 | (- diary-count) | 4273 | (- diary-count) |
| 4220 | (- todo-count diary-count)))) | 4274 | (- todo-count diary-count)))) |
| 4221 | (todos-update-categories-sexp))))) | 4275 | (todos-update-categories-sexp))))) |
| @@ -4422,8 +4476,8 @@ entry/entries in that category." | |||
| 4422 | (unless (assoc cat2 todos-categories) (todos-add-category cat2)) | 4476 | (unless (assoc cat2 todos-categories) (todos-add-category cat2)) |
| 4423 | (todos-set-item-priority item cat2 t) | 4477 | (todos-set-item-priority item cat2 t) |
| 4424 | (setq nmark (point-marker)) | 4478 | (setq nmark (point-marker)) |
| 4425 | (todos-set-count 'todo count) | 4479 | (todos-update-count 'todo count) |
| 4426 | (todos-set-count 'diary count-diary) | 4480 | (todos-update-count 'diary count-diary) |
| 4427 | (todos-update-categories-sexp) | 4481 | (todos-update-categories-sexp) |
| 4428 | (with-current-buffer (get-file-buffer file1) | 4482 | (with-current-buffer (get-file-buffer file1) |
| 4429 | (save-excursion | 4483 | (save-excursion |
| @@ -4446,8 +4500,8 @@ entry/entries in that category." | |||
| 4446 | (todos-remove-item) | 4500 | (todos-remove-item) |
| 4447 | (todos-forward-item)))) | 4501 | (todos-forward-item)))) |
| 4448 | (todos-remove-item)))) | 4502 | (todos-remove-item)))) |
| 4449 | (todos-set-count 'todo (- count) cat1) | 4503 | (todos-update-count 'todo (- count) cat1) |
| 4450 | (todos-set-count 'diary (- count-diary) cat1) | 4504 | (todos-update-count 'diary (- count-diary) cat1) |
| 4451 | (todos-update-categories-sexp)) | 4505 | (todos-update-categories-sexp)) |
| 4452 | (set-window-buffer (selected-window) | 4506 | (set-window-buffer (selected-window) |
| 4453 | (set-buffer (find-file-noselect file2))) | 4507 | (set-buffer (find-file-noselect file2))) |
| @@ -4529,9 +4583,9 @@ relocated to the category's (by default hidden) done section." | |||
| 4529 | (concat "^" (regexp-quote todos-category-done)) nil t) | 4583 | (concat "^" (regexp-quote todos-category-done)) nil t) |
| 4530 | (forward-char) | 4584 | (forward-char) |
| 4531 | (insert done-item "\n")) | 4585 | (insert done-item "\n")) |
| 4532 | (todos-set-count 'todo (- item-count)) | 4586 | (todos-update-count 'todo (- item-count)) |
| 4533 | (todos-set-count 'done item-count) | 4587 | (todos-update-count 'done item-count) |
| 4534 | (todos-set-count 'diary (- diary-count)) | 4588 | (todos-update-count 'diary (- diary-count)) |
| 4535 | (todos-update-categories-sexp) | 4589 | (todos-update-categories-sexp) |
| 4536 | (save-excursion (todos-category-select)))))) | 4590 | (save-excursion (todos-category-select)))))) |
| 4537 | 4591 | ||
| @@ -4569,9 +4623,9 @@ relocated to the category's (by default hidden) done section." | |||
| 4569 | (progn | 4623 | (progn |
| 4570 | (todos-set-item-priority item (todos-current-category) t) | 4624 | (todos-set-item-priority item (todos-current-category) t) |
| 4571 | (setq undone t) | 4625 | (setq undone t) |
| 4572 | (todos-set-count 'todo 1) | 4626 | (todos-update-count 'todo 1) |
| 4573 | (todos-set-count 'done -1) | 4627 | (todos-update-count 'done -1) |
| 4574 | (and (todos-diary-item-p) (todos-set-count 'diary 1)) | 4628 | (and (todos-diary-item-p) (todos-update-count 'diary 1)) |
| 4575 | (todos-update-categories-sexp)) | 4629 | (todos-update-categories-sexp)) |
| 4576 | (unless undone | 4630 | (unless undone |
| 4577 | (widen) | 4631 | (widen) |
| @@ -4665,7 +4719,7 @@ this category does not exist in the archive, it is created." | |||
| 4665 | (insert (cond (marked marked-items) | 4719 | (insert (cond (marked marked-items) |
| 4666 | (all all-done) | 4720 | (all all-done) |
| 4667 | (item))) | 4721 | (item))) |
| 4668 | (todos-set-count 'done (if (or marked all) count 1)) | 4722 | (todos-update-count 'done (if (or marked all) count 1)) |
| 4669 | (todos-update-categories-sexp) | 4723 | (todos-update-categories-sexp) |
| 4670 | ;; Save to file now (using write-region in order not to visit | 4724 | ;; Save to file now (using write-region in order not to visit |
| 4671 | ;; afile) so we can visit it later with todos-view-archived-items | 4725 | ;; afile) so we can visit it later with todos-view-archived-items |
| @@ -4680,8 +4734,8 @@ this category does not exist in the archive, it is created." | |||
| 4680 | (if (or (and marked (todos-marked-item-p)) item) | 4734 | (if (or (and marked (todos-marked-item-p)) item) |
| 4681 | (progn | 4735 | (progn |
| 4682 | (todos-remove-item) | 4736 | (todos-remove-item) |
| 4683 | (todos-set-count 'done -1) | 4737 | (todos-update-count 'done -1) |
| 4684 | (todos-set-count 'archived 1) | 4738 | (todos-update-count 'archived 1) |
| 4685 | ;; Don't leave point below last item. | 4739 | ;; Don't leave point below last item. |
| 4686 | (and item (bolp) (eolp) (< (point-min) (point-max)) | 4740 | (and item (bolp) (eolp) (< (point-min) (point-max)) |
| 4687 | (todos-backward-item)) | 4741 | (todos-backward-item)) |
| @@ -4691,8 +4745,8 @@ this category does not exist in the archive, it is created." | |||
| 4691 | (all | 4745 | (all |
| 4692 | (remove-overlays beg end) | 4746 | (remove-overlays beg end) |
| 4693 | (delete-region beg end) | 4747 | (delete-region beg end) |
| 4694 | (todos-set-count 'done (- count)) | 4748 | (todos-update-count 'done (- count)) |
| 4695 | (todos-set-count 'archived count))) | 4749 | (todos-update-count 'archived count))) |
| 4696 | (when marked | 4750 | (when marked |
| 4697 | (remove-overlays (point-min) (point-max) | 4751 | (remove-overlays (point-min) (point-max) |
| 4698 | 'before-string todos-item-mark) | 4752 | 'before-string todos-item-mark) |
| @@ -4760,20 +4814,20 @@ archive, the archive file is deleted." | |||
| 4760 | (goto-char (point-max))) | 4814 | (goto-char (point-max))) |
| 4761 | (cond (marked | 4815 | (cond (marked |
| 4762 | (insert marked-items) | 4816 | (insert marked-items) |
| 4763 | (todos-set-count 'done marked-count) | 4817 | (todos-update-count 'done marked-count) |
| 4764 | (todos-set-count 'archived (- marked-count))) | 4818 | (todos-update-count 'archived (- marked-count))) |
| 4765 | (all | 4819 | (all |
| 4766 | (if (y-or-n-p (concat "Restore this category's items " | 4820 | (if (y-or-n-p (concat "Restore this category's items " |
| 4767 | "to Todos file as done items " | 4821 | "to Todos file as done items " |
| 4768 | "and delete this category? ")) | 4822 | "and delete this category? ")) |
| 4769 | (progn (insert all-items) | 4823 | (progn (insert all-items) |
| 4770 | (todos-set-count 'done all-count) | 4824 | (todos-update-count 'done all-count) |
| 4771 | (todos-set-count 'archived (- all-count))) | 4825 | (todos-update-count 'archived (- all-count))) |
| 4772 | (throw 'end nil))) | 4826 | (throw 'end nil))) |
| 4773 | (t | 4827 | (t |
| 4774 | (insert item) | 4828 | (insert item) |
| 4775 | (todos-set-count 'done 1) | 4829 | (todos-update-count 'done 1) |
| 4776 | (todos-set-count 'archived -1))) | 4830 | (todos-update-count 'archived -1))) |
| 4777 | (todos-update-categories-sexp))) | 4831 | (todos-update-categories-sexp))) |
| 4778 | ;; Delete restored items from archive. | 4832 | ;; Delete restored items from archive. |
| 4779 | (cond ((or marked item) | 4833 | (cond ((or marked item) |
| @@ -4783,7 +4837,7 @@ archive, the archive file is deleted." | |||
| 4783 | (if (or (and marked (todos-marked-item-p)) item) | 4837 | (if (or (and marked (todos-marked-item-p)) item) |
| 4784 | (progn | 4838 | (progn |
| 4785 | (todos-remove-item) | 4839 | (todos-remove-item) |
| 4786 | (todos-set-count 'done -1) | 4840 | (todos-update-count 'done -1) |
| 4787 | ;; Don't leave point below last item. | 4841 | ;; Don't leave point below last item. |
| 4788 | (and item (bolp) (eolp) (< (point-min) (point-max)) | 4842 | (and item (bolp) (eolp) (< (point-min) (point-max)) |
| 4789 | (todos-backward-item)) | 4843 | (todos-backward-item)) |
| @@ -4793,7 +4847,7 @@ archive, the archive file is deleted." | |||
| 4793 | (all | 4847 | (all |
| 4794 | (remove-overlays (point-min) (point-max)) | 4848 | (remove-overlays (point-min) (point-max)) |
| 4795 | (delete-region (point-min) (point-max)) | 4849 | (delete-region (point-min) (point-max)) |
| 4796 | (todos-set-count 'done (- all-count)))) | 4850 | (todos-update-count 'done (- all-count)))) |
| 4797 | ;; If that was the last category in the archive, delete the whole file. | 4851 | ;; If that was the last category in the archive, delete the whole file. |
| 4798 | (if (= (length todos-categories) 1) | 4852 | (if (= (length todos-categories) 1) |
| 4799 | (progn | 4853 | (progn |