summaryrefslogtreecommitdiff
path: root/lisp/calendar/todo-mode.el
diff options
context:
space:
mode:
authorStephen Berman <stephen.berman@gmx.net>2018-08-15 00:14:41 +0200
committerStephen Berman <stephen.berman@gmx.net>2018-08-15 00:14:41 +0200
commit6d24402d6358b2e6ccf78a6cb909723a5d18dd27 (patch)
tree81fb54f8783ed4a6722486433c10da852927b62b /lisp/calendar/todo-mode.el
parent5620d591ee67e5b31ca8d5aa0dcc1a13116b09a7 (diff)
downloademacs-6d24402d6358b2e6ccf78a6cb909723a5d18dd27.tar.gz
Fix last todo-edit-mode change
* lisp/calendar/todo-mode.el (todo-edit-mode): For editing an item instead of the whole file, the current todo-file must be set from todo-global-current-todo-file. * test/lisp/calendar/todo-mode-tests.el (todo-test-current-file-in-edit-mode): New test.
Diffstat (limited to 'lisp/calendar/todo-mode.el')
-rw-r--r--lisp/calendar/todo-mode.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 1623c6e2ec8..08da75dbd60 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -6726,9 +6726,13 @@ Added to `window-configuration-change-hook' in Todo mode."
\\{todo-edit-mode-map}"
(todo-modes-set-1)
- (setq-local todo-current-todo-file (file-truename (buffer-file-name)))
- (when (= (buffer-size) (- (point-max) (point-min)))
- ;; Only need this when editing the whole file not just an item.
+ (if (> (buffer-size) (- (point-max) (point-min)))
+ ;; Editing one item in an indirect buffer, so buffer-file-name is nil.
+ (setq-local todo-current-todo-file todo-global-current-todo-file)
+ ;; When editing archive file, make sure it is current todo file.
+ (setq-local todo-current-todo-file (file-truename (buffer-file-name)))
+ ;; Need this when editing the whole file to return to the category
+ ;; editing was invoked from.
(setq-local todo-categories (todo-set-categories)))
(setq buffer-read-only nil))