summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStephen Berman <stephen.berman@gmx.net>2018-08-14 21:39:24 +0200
committerStephen Berman <stephen.berman@gmx.net>2018-08-14 21:39:24 +0200
commita2ec595e5d7cf95715312a9cd0a6f4ef0f6e370f (patch)
tree75f7d6ebf424945177cc972b3b15f3bf86d822b2 /test
parent11c7c2f758f8f07e7b917fbc93267cee236a80e5 (diff)
downloademacs-a2ec595e5d7cf95715312a9cd0a6f4ef0f6e370f.tar.gz
Fix exiting from editing todo archive file (bug#32437)
* lisp/calendar/todo-mode.el (todo-edit-file): Make the warning also suitable for Todo Archive mode, and add more space to it. (todo-edit-quit): On quitting editing an archive file, return to the Todo Archive mode buffer editing was invoked in. (todo-check-format): Display a warning instead of a message when the categories sexp isn't as expected. (todo-mode-external-set): Remove. (todo-edit-mode): Set buffer local values of todo-current-todo-file and todo-categories from the todo or archive file being edited. (todo-categories-mode): Set buffer local values of todo-current-todo-file and todo-categories as before but directly instead of using superfluous todo-mode-external-set function. * test/lisp/calendar/todo-mode-tests.el (todo-test-edit-quit): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/calendar/todo-mode-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/calendar/todo-mode-tests.el b/test/lisp/calendar/todo-mode-tests.el
index 325faeff514..90282045062 100644
--- a/test/lisp/calendar/todo-mode-tests.el
+++ b/test/lisp/calendar/todo-mode-tests.el
@@ -763,6 +763,24 @@ The highlighting should remain enabled."
(ert-simulate-command '(forward-line)) ; Now on first done item.
(should (eq 'hl-line (get-char-property (point) 'face)))))
+(ert-deftest todo-test-edit-quit ()
+ "Test result of exiting todo-edit-mode on a whole file.
+Exiting should return to the same todo-mode or todo-archive-mode
+buffer from which the editing command was invoked."
+ (with-todo-test
+ (todo-test--show 1)
+ (let ((buf (current-buffer)))
+ (todo-edit-file)
+ (todo-edit-quit)
+ (should (eq (current-buffer) buf))
+ (should (eq major-mode 'todo-mode))
+ (todo-find-archive)
+ (let ((buf (current-buffer)))
+ (todo-edit-file)
+ (todo-edit-quit)
+ (should (eq (current-buffer) buf))
+ (should (eq major-mode 'todo-archive-mode))))))
+
(provide 'todo-mode-tests)
;;; todo-mode-tests.el ends here