diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2015-06-19 16:45:50 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-06-19 16:45:50 -0700 |
commit | f95211e9a40b1c7d1beff0e15aa67450f80bd8bb (patch) | |
tree | bd52fe0f6c5c04834f99759917137edf836e83cc /lisp/calendar/todo-mode.el | |
parent | b9373ac26ad75fe38638a51eea54944163cc1c38 (diff) | |
parent | a5e6f33b4c8222ad62fdd7ff4bb0f8c5fac432c1 (diff) | |
download | emacs-f95211e9a40b1c7d1beff0e15aa67450f80bd8bb.tar.gz emacs-f95211e9a40b1c7d1beff0e15aa67450f80bd8bb.tar.bz2 emacs-f95211e9a40b1c7d1beff0e15aa67450f80bd8bb.zip |
Merge from origin/emacs-24
a5e6f33 Fixes: debbugs:20832
b9f02cf Fixes: debbugs:20832
Diffstat (limited to 'lisp/calendar/todo-mode.el')
-rw-r--r-- | lisp/calendar/todo-mode.el | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 7369ec28c29..962f425ecf5 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -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 |