From 7e4228a1373ca72f7f66877be21258d692c8d7c0 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Fri, 6 Feb 2015 09:52:25 +0100 Subject: [PATCH] org-agenda: Fix logging with bulk agenda commands * lisp/org-agenda.el (org-agenda-new-marker): Make sure data inserted inserted in the heading above marker updates it. (org-agenda-bulk-action): Enforce calling `org-add-log-note' after each action. Reported-by: Maxim Baz --- lisp/org-agenda.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 5d18a00b3..e7cfd278a 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3941,9 +3941,9 @@ functions do." (defun org-agenda-new-marker (&optional pos) "Return a new agenda marker. -Org-mode keeps a list of these markers and resets them when they are -no longer in use." - (let ((m (copy-marker (or pos (point))))) +Maker is at point, or at POS if non-nil. Org mode keeps a list of +these markers and resets them when they are no longer in use." + (let ((m (copy-marker (or pos (point)) t))) (setq org-agenda-last-marker-time (org-float-time)) (if org-agenda-buffer (with-current-buffer org-agenda-buffer @@ -9928,6 +9928,11 @@ The prefix arg is passed through to the command if possible." (goto-char pos) (let (org-loop-over-headlines-in-active-region) (eval cmd)) + ;; `post-command-hook' is not run yet. We make sure any + ;; pending log note is processed. + (when (or (memq 'org-add-log-note (default-value 'post-command-hook)) + (memq 'org-add-log-note post-command-hook)) + (org-add-log-note)) (setq cnt (1+ cnt)))) (when redo-at-end (org-agenda-redo)) (unless org-agenda-persistent-marks -- 2.11.4.GIT