Function: todo-quit

todo-quit is an interactive and byte-compiled function defined in todo-mode.el.gz.

Signature

(todo-quit)

Documentation

Exit the current Todo-related buffer.

Depending on the specific mode, this either kills the buffer or buries it and restores state as needed.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
(defun todo-quit ()
  "Exit the current Todo-related buffer.
Depending on the specific mode, this either kills the buffer or
buries it and restores state as needed."
  (interactive)
  (let ((buf (current-buffer)))
    (cond ((eq major-mode 'todo-categories-mode)
	   ;; Postpone killing buffer till after calling todo-show, to
	   ;; prevent killing todo-mode buffer.
	   (setq todo-descending-counts nil)
	   ;; Ensure todo-show calls todo-show-categories-table only on
	   ;; first invocation per file.
	   (when (eq todo-show-first 'table)
	     (add-to-list 'todo-visited todo-current-todo-file))
	   (todo-show)
	   (kill-buffer buf))
	  ((eq major-mode 'todo-filtered-items-mode)
	   (kill-buffer)
	   (unless (eq major-mode 'todo-mode) (todo-show)))
	  ((eq major-mode 'todo-archive-mode)
	   ;; Have to write a newly created archive to file to avoid
	   ;; subsequent errors.
	   (todo-save)
	   (let ((todo-file (concat todo-directory
				    (todo-short-file-name todo-current-todo-file)
				    ".todo")))
	     (if (todo-check-file todo-file)
		 (todo-show)
	       (message "There is no todo file for this archive")))
	   ;; When todo-check-file runs in todo-show, it kills the
	   ;; buffer if the archive file was deleted externally.
	   (when (buffer-live-p buf) (kill-buffer buf)))
	  ((eq major-mode 'todo-mode)
	   (todo-save)
           (quit-window)))))