forked from mirrors/org-mode
Fix the bulk scatter command to always schedule
* lisp/org-agenda.el (org-agenda-bulk-action): Allow bulk scatter in all possible agenda views. Use `org-agenda-schedule' instead of `org-agenda-date-later'. The bulk scatter command so far shifted the date that was causing an entry to appear in the agenda. However, the true intend was to reschedule onto dates in the near future. This patch fixes this issue. A side effect is that you can now bulk scatter tasks that to not yet have a date, for example also tasks picked from the TODO list.
This commit is contained in:
parent
2c8e964b70
commit
e20166eb29
|
@ -8079,8 +8079,8 @@ t @r{Change TODO state. This prompts for a single TODO keyword and}
|
|||
s @r{Schedule all items to a new date. To shift existing schedule dates}
|
||||
@r{by a fixed number of days, use something starting with double plus}
|
||||
@r{at the prompt, for example @samp{++8d} or @samp{++2w}.}
|
||||
S @r{Reschedule randomly by N days. N will be prompted for. With prefix}
|
||||
@r{arg (@kbd{C-u B S}), scatter only accross weekdays.}
|
||||
S @r{Reschedule randomly into the coming N days. N will be prompted for.
|
||||
@r{With prefix arg (@kbd{C-u B S}), scatter only accross weekdays.}
|
||||
d @r{Set deadline to a specific date.}
|
||||
f @r{Apply a function to marked entries.}
|
||||
@r{For example, the function below sets the CATEGORY property of the}
|
||||
|
|
|
@ -7933,8 +7933,18 @@ This will remove the markers, and the overlays."
|
|||
"Execute an remote-editing action on all marked entries.
|
||||
The prefix arg is passed through to the command if possible."
|
||||
(interactive "P")
|
||||
(unless org-agenda-bulk-marked-entries
|
||||
(error "No entries are marked"))
|
||||
;; Make sure we have markers, and only valid ones
|
||||
(unless org-agenda-bulk-marked-entries (error "No entries are marked"))
|
||||
(mapc
|
||||
(lambda (m)
|
||||
(unless (and (markerp m)
|
||||
(marker-buffer m)
|
||||
(buffer-live-p (marker-buffer m))
|
||||
(marker-position m))
|
||||
(error "Marker %s for bulk command is invalid" m)))
|
||||
entries)
|
||||
|
||||
;; Prompt for the bulk command
|
||||
(message "Bulk: [r]efile [$]arch [A]rch->sib [t]odo [+/-]tag [s]chd [S]catter [d]eadline [f]unction")
|
||||
(let* ((action (read-char-exclusive))
|
||||
(org-log-refile (if org-log-refile 'time nil))
|
||||
|
@ -7999,7 +8009,7 @@ The prefix arg is passed through to the command if possible."
|
|||
(fmakunbound 'read-string)))))))
|
||||
|
||||
((equal action ?S)
|
||||
(if (not (org-agenda-check-type nil 'agenda 'timeline))
|
||||
(if (not (org-agenda-check-type nil 'agenda 'timeline 'todo))
|
||||
(error "Can't scatter tasks in \"%s\" agenda view" org-agenda-type)
|
||||
(let ((days (read-number
|
||||
(format "Scatter tasks across how many %sdays: "
|
||||
|
@ -8022,7 +8032,9 @@ The prefix arg is passed through to the command if possible."
|
|||
(setq day-of-week 0)))))
|
||||
;; silently fail when try to replan a sexp entry
|
||||
(condition-case nil
|
||||
(org-agenda-date-later distance)
|
||||
(org-agenda-schedule nil
|
||||
(days-to-time
|
||||
(+ (org-today) distance)))
|
||||
(error nil)))))))
|
||||
|
||||
((equal action ?f)
|
||||
|
|
Loading…
Reference in New Issue