diff options
| author | Paul Eggert | 2015-06-19 16:45:50 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-06-19 16:45:50 -0700 |
| commit | f95211e9a40b1c7d1beff0e15aa67450f80bd8bb (patch) | |
| tree | bd52fe0f6c5c04834f99759917137edf836e83cc | |
| parent | b9373ac26ad75fe38638a51eea54944163cc1c38 (diff) | |
| parent | a5e6f33b4c8222ad62fdd7ff4bb0f8c5fac432c1 (diff) | |
| download | emacs-f95211e9a40b1c7d1beff0e15aa67450f80bd8bb.tar.gz emacs-f95211e9a40b1c7d1beff0e15aa67450f80bd8bb.zip | |
Merge from origin/emacs-24
a5e6f33 Fixes: debbugs:20832
b9f02cf Fixes: debbugs:20832
| -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." | |||
| 672 | todo-filtered-items-mode)))) | 672 | todo-filtered-items-mode)))) |
| 673 | (if (funcall todo-files-function) | 673 | (if (funcall todo-files-function) |
| 674 | (todo-read-file-name "Choose a todo file to visit: " | 674 | (todo-read-file-name "Choose a todo file to visit: " |
| 675 | nil t) | 675 | nil t) |
| 676 | (user-error "There are no todo files"))) | 676 | (user-error "There are no todo files"))) |
| 677 | ((and (eq major-mode 'todo-archive-mode) | 677 | ((and (eq major-mode 'todo-archive-mode) |
| 678 | ;; Called noninteractively via todo-quit | 678 | ;; Called noninteractively via todo-quit |
| @@ -732,7 +732,10 @@ corresponding todo file, displaying the corresponding category." | |||
| 732 | (when (or (member file todo-visited) | 732 | (when (or (member file todo-visited) |
| 733 | (eq todo-show-first 'first)) | 733 | (eq todo-show-first 'first)) |
| 734 | (unless (todo-check-file file) (throw 'end nil)) | 734 | (unless (todo-check-file file) (throw 'end nil)) |
| 735 | (set-window-buffer (selected-window) | 735 | ;; If todo-show is called from the minibuffer, don't visit |
| 736 | ;; the todo file there. | ||
| 737 | (set-window-buffer (if (minibufferp) (minibuffer-selected-window) | ||
| 738 | (selected-window)) | ||
| 736 | (set-buffer (find-file-noselect file 'nowarn))) | 739 | (set-buffer (find-file-noselect file 'nowarn))) |
| 737 | (if (equal (file-name-extension (buffer-file-name)) "toda") | 740 | (if (equal (file-name-extension (buffer-file-name)) "toda") |
| 738 | (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode)) | 741 | (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode)) |
| @@ -743,6 +746,11 @@ corresponding todo file, displaying the corresponding category." | |||
| 743 | (setq todo-category-number (todo-category-number cat))) | 746 | (setq todo-category-number (todo-category-number cat))) |
| 744 | ;; If this is a new todo file, add its first category. | 747 | ;; If this is a new todo file, add its first category. |
| 745 | (when (zerop (buffer-size)) | 748 | (when (zerop (buffer-size)) |
| 749 | ;; Don't confuse an erased buffer with a fresh buffer for | ||
| 750 | ;; adding a new todo file -- it might have been erased by | ||
| 751 | ;; mistake or due to a bug (e.g. Bug#20832). | ||
| 752 | (when (buffer-modified-p) | ||
| 753 | (error "Buffer is empty but modified, please report a bug")) | ||
| 746 | (let (cat-added) | 754 | (let (cat-added) |
| 747 | (unwind-protect | 755 | (unwind-protect |
| 748 | (setq todo-category-number | 756 | (setq todo-category-number |