From 9fa64073386ba6607afdddd773be9aed2a85370d Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Fri, 31 May 2013 15:43:25 +0200 Subject: [PATCH] * todos.el (todos-edit-quit): After editing an item, make sure to return to its category. --- lisp/calendar/ChangeLog | 5 +++++ lisp/calendar/todos.el | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/calendar/ChangeLog b/lisp/calendar/ChangeLog index fe8f83e2df..43fbbf2ec4 100644 --- a/lisp/calendar/ChangeLog +++ b/lisp/calendar/ChangeLog @@ -1,3 +1,8 @@ +2013-05-31 Stephen Berman + + * todos.el (todos-edit-quit): After editing an item, make sure to + return to its category. + 2013-05-31 Stephen Berman * todos.el: Clean up code. Uncapitalize file name in first line. diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el index 2e28e9e9bf..0bbf139b7e 100644 --- a/lisp/calendar/todos.el +++ b/lisp/calendar/todos.el @@ -1385,7 +1385,8 @@ in the number or names of categories." (if (> (buffer-size) (- (point-max) (point-min))) ;; We got here via `e m'. (let ((item (buffer-string)) - (regex "\\(\n\\)[^[:blank:]]")) + (regex "\\(\n\\)[^[:blank:]]") + (buf (buffer-base-buffer))) (while (not (string-match (concat todos-date-string-start todos-date-pattern) item)) (setq item (read-from-minibuffer @@ -1395,7 +1396,9 @@ in the number or names of categories." (setq item (replace-regexp-in-string regex "\n\t" item nil nil 1)) (delete-region (point-min) (point-max)) (insert item)) - (kill-buffer)) + (kill-buffer) + (unless (eq (current-buffer) buf) + (set-window-buffer (selected-window) (set-buffer buf)))) ;; We got here via `F e'. (when (todos-check-format) ;; FIXME: separate out sexp check? -- 2.20.1