Bulk scattering agenda items when the user wants to log reschedules does not 
work. 

Steps to reproduce: 
1. Set `org-log-reschedule' to the value `"time"'

   Alternatively, customize “Org Log Reschedule” to “Record timestamp with 
note”.

2. Add an org mode file with the following contents to the agenda file list
   ┌────
   │     Testing scatter 1
   │     SCHEDULED: <2023-08-22 Tue>
   │     Testing scatter 2
   │     SCHEDULED: <2023-08-22 Tue>
   │     Testing scatter 3
   │     SCHEDULED: <2023-08-22 Tue>
   └────
   (As in previous reports, I can’t paste these as actual headings. Their 
structure is irrelevant.)

3. Mark all of previous headings for bulk action in the agenda

4. Bulk scatter the marked headings (`B S', by default)

5. Fill out the prompted note with anything and hit `C-c C-c' to finish

You will note Emacs reports that only `Testing scatter 1' has been rescheduled, 
has a note, and all headings remain marked. Emacs will also /not/ prompt you 
for notes for the other headings or reschedule them- the process terminates 
here. This issue does not occur when `org-log-reschedule' is set to its default 
value: “No logging”.

The expected behavior is that either Emacs will prompt me for more notes for 
the remaining headings, or at the very least will scatter them.

I have written and attached a rudimentary patch which “solves” this problem by 
storing `org-log-reschedule'’s value, scattering with “No logging” set, and 
then restoring it. I think it is up for debate whether or not the logging 
behavior in the case of a bulk scatter should respect the user’s settings, or 
prompt just once at the beginning for a note (copying it to all subsequent 
scattered headlines), or if it should be ignored entirely (as in my patch).


Emacs  : GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, 
cairo version 1.16.0)
 of 2022-05-31
Package: Org mode version 9.7 (9.7-??-6eb773053 @ 
/home/shortcut/.emacs.d/.local/straight/build-28.1/org/)

-/shortcut/
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index bafd8b7f8..609d59a4c 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -11201,8 +11201,12 @@ The prefix arg is passed through to the command if possible."
 		       (let* ((date (calendar-gregorian-from-absolute
 				     (+ (org-today) distance)))
 			      (time (org-encode-time
-                                     0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
-			 (org-agenda-schedule nil time))))))))
+                                     0 0 0 (nth 1 date) (nth 0 date) (nth 2 date)))
+                              (log-state org-log-reschedule))
+                         (setq org-log-reschedule nil)
+			 (org-agenda-schedule nil time)
+                         (setq org-log-reschedule log-state)
+                         )))))))
 
 	(?f
 	 (setq cmd

Reply via email to