summaryrefslogtreecommitdiff
path: root/lisp/calendar
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-05-05 23:11:11 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-05-05 23:11:11 -0700
commit89ce83b20249dfb4e45f09dfdddf4c4b66d82968 (patch)
tree3d75245a5514df2ad7b17ae6d56727b9629846a9 /lisp/calendar
parentd546ed13b04521308ef7ec8e7e5b68e03f1bbb38 (diff)
parent50650cb6887d99b01eeb1e686fc1f695c2a0c64a (diff)
downloademacs-89ce83b20249dfb4e45f09dfdddf4c4b66d82968.tar.gz
Merge from origin/emacs-25
50650cb Doc fixes for fclist and grep 5e814e0 Minor doc fixes for quoting 3347a73 `nreverse' the marker pairs list 1a4127d Use save-excursion in xref-location-marker more ab3ba91 shell-quote-argument DIR when appropriate 922c7a3 Rework xref-query-replace-in-results 3fe3510 * lisp/replace.el (query-replace-read-from): Use minibuffer-w... 0932b94 Fix todo-mode bug involving archived items (bug#23447) e68ad1f ; * etc/NEWS: Tiny edit. (Bug#23432) adc80b7 ; * test/automated/xref-tests.el: Add copyright and license. 4d8fd9c Handle "empty line" regexp in xref searches f559b37 Add tests for xref-collect-matches 6428aa0 Use grep-find-ignored-directories instead of vc-directory-exc... 6f82d8e Clear buffer-undo-list when showing xrefs c68a091 Note the quote translation in `message' in section "incompati... 52f86a7 * etc/NEWS: Mention (message "%s" (format ...)). 93703c5 (Common Keywords): Correct what missing :group means 79e5800 Improve documentation of Dired's 'A' and 'Q' commands 2ea2a2f Doc fixes for quoting 8544b98 posnp doc clarification 805204f Mention what a missing :group does ec554d7 Fix documentation of dired-aux search/replace commands
Diffstat (limited to 'lisp/calendar')
-rw-r--r--lisp/calendar/todo-mode.el39
1 files changed, 19 insertions, 20 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 0529e970333..8e752586053 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -902,17 +902,19 @@ Categories mode."
(todo-show)
(let* ((archive (eq where 'archive))
(cat (unless archive where))
+ (goto-archive (and cat
+ todo-skip-archived-categories
+ (zerop (todo-get-count 'todo cat))
+ (zerop (todo-get-count 'done cat))
+ (not (zerop (todo-get-count 'archived cat)))))
(file0 (when cat ; We're in Todo Categories mode.
- ;; With non-nil `todo-skip-archived-categories'
- ;; jump to archive file of a category with only
- ;; archived items.
- (if (and todo-skip-archived-categories
- (zerop (todo-get-count 'todo cat))
- (zerop (todo-get-count 'done cat))
- (not (zerop (todo-get-count 'archived cat))))
+ (if goto-archive
+ ;; If the category has only archived items and
+ ;; `todo-skip-archived-categories' is non-nil, jump to
+ ;; the archive category.
(concat (file-name-sans-extension
todo-current-todo-file) ".toda")
- ;; Otherwise, jump to current todo file.
+ ;; Otherwise, jump to the category in the todo file.
todo-current-todo-file)))
(len (length todo-categories))
(cat+file (unless cat
@@ -923,18 +925,15 @@ Categories mode."
(category (or cat (car cat+file))))
(unless cat (setq file0 (cdr cat+file)))
(with-current-buffer (find-file-noselect file0 'nowarn)
- (setq todo-current-todo-file file0)
- ;; If called from Todo Categories mode, clean up before jumping.
- (if (string= (buffer-name) todo-categories-buffer)
- (kill-buffer))
- (set-window-buffer (selected-window)
- (set-buffer (find-buffer-visiting file0)))
- (unless todo-global-current-todo-file
- (setq todo-global-current-todo-file todo-current-todo-file))
- (todo-category-number category)
- (todo-category-select)
- (goto-char (point-min))
- (when add-item (todo-insert-item--basic))))))
+ (when goto-archive (todo-archive-mode))
+ (set-window-buffer (selected-window)
+ (set-buffer (find-buffer-visiting file0)))
+ (unless todo-global-current-todo-file
+ (setq todo-global-current-todo-file todo-current-todo-file))
+ (todo-category-number category)
+ (todo-category-select)
+ (goto-char (point-min))
+ (when add-item (todo-insert-item--basic))))))
(defun todo-next-item (&optional count)
"Move point down to the beginning of the next item.