Function: todo-find-archive
todo-find-archive is an interactive and byte-compiled function defined
in todo-mode.el.gz.
Signature
(todo-find-archive &optional ASK)
Documentation
Visit the archive of the current todo category, if it exists.
If the category has no archived items, prompt to visit the archive anyway. If there is no archive for this file or with non-nil argument ASK, prompt to visit another archive.
The buffer showing the archive is in Todo Archive mode. The first visit in a session displays the first category in the archive, subsequent visits return to the last category displayed.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
;; -----------------------------------------------------------------------------
;;; Done item archives
;; -----------------------------------------------------------------------------
(defun todo-find-archive (&optional ask)
"Visit the archive of the current todo category, if it exists.
If the category has no archived items, prompt to visit the
archive anyway. If there is no archive for this file or with
non-nil argument ASK, prompt to visit another archive.
The buffer showing the archive is in Todo Archive mode. The
first visit in a session displays the first category in the
archive, subsequent visits return to the last category
displayed."
(interactive)
(if (null (funcall todo-files-function t))
(message "There are no archive files")
(let* ((cat (todo-current-category))
(count (todo-get-count 'archived cat))
(archive (concat (file-name-sans-extension todo-current-todo-file)
".toda"))
(place (cond (ask 'other-archive)
((file-exists-p archive) 'this-archive)
(t (when (todo-y-or-n-p
(concat "This file has no archive; "
"visit another archive? "))
'other-archive)))))
(when (eq place 'other-archive)
(setq archive (todo-read-file-name "Choose a todo archive: " t t)))
(when (and (eq place 'this-archive) (zerop count))
(setq place (when (todo-y-or-n-p
(concat "This category has no archived items;"
" visit archive anyway? "))
'other-cat)))
(when place
(set-window-buffer (selected-window)
(set-buffer (find-file-noselect archive)))
(unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
(if (member place '(other-archive other-cat))
(setq todo-category-number 1)
(todo-category-number cat))
(todo-category-select)))))