Commit f95211e9 authored by Paul Eggert's avatar Paul Eggert
Browse files

Merge from origin/emacs-24

a5e6f33b Fixes: debbugs:20832
b9f02cf6 Fixes: debbugs:20832
parents b9373ac2 a5e6f33b
......@@ -672,7 +672,7 @@ corresponding todo file, displaying the corresponding category."
todo-filtered-items-mode))))
(if (funcall todo-files-function)
(todo-read-file-name "Choose a todo file to visit: "
nil t)
nil t)
(user-error "There are no todo files")))
((and (eq major-mode 'todo-archive-mode)
;; Called noninteractively via todo-quit
......@@ -732,7 +732,10 @@ corresponding todo file, displaying the corresponding category."
(when (or (member file todo-visited)
(eq todo-show-first 'first))
(unless (todo-check-file file) (throw 'end nil))
(set-window-buffer (selected-window)
;; If todo-show is called from the minibuffer, don't visit
;; the todo file there.
(set-window-buffer (if (minibufferp) (minibuffer-selected-window)
(selected-window))
(set-buffer (find-file-noselect file 'nowarn)))
(if (equal (file-name-extension (buffer-file-name)) "toda")
(unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
......@@ -743,6 +746,11 @@ corresponding todo file, displaying the corresponding category."
(setq todo-category-number (todo-category-number cat)))
;; If this is a new todo file, add its first category.
(when (zerop (buffer-size))
;; Don't confuse an erased buffer with a fresh buffer for
;; adding a new todo file -- it might have been erased by
;; mistake or due to a bug (e.g. Bug#20832).
(when (buffer-modified-p)
(error "Buffer is empty but modified, please report a bug"))
(let (cat-added)
(unwind-protect
(setq todo-category-number
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment