[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [PATCH] Change: (org-agenda-bulk-action) Prompt w/number of mark
From: |
Adam Porter |
Subject: |
Re: [O] [PATCH] Change: (org-agenda-bulk-action) Prompt w/number of marked items |
Date: |
Thu, 13 Sep 2018 05:36:12 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
I went ahead and made a patch for that idea.
Thanks,
Adam
>From bba4a705cb028643ee76c9e37b0168e8a1152986 Mon Sep 17 00:00:00 2001
From: Adam Porter <address@hidden>
Date: Sun, 2 Sep 2018 03:53:36 -0500
Subject: [PATCH] org-agenda: Add org-agenda-scatter-days option
The new option sets the number of days to prompt with when scattering
bulk-selected agenda items. It can be set to a number of days, or to
the number of selected items (which scatters the items one-per-day
starting on the next day). The default value is 7, so the default
behavior is unchanged from previous versions.
* lisp/org-agenda.el (org-agenda-scatter-days): Add option.
(org-agenda-bulk-action): Use option.
* etc/ORG-NEWS: Add entry.
---
etc/ORG-NEWS | 9 +++++++++
lisp/org-agenda.el | 10 +++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 2a22be0..e489dbc 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -312,6 +312,15 @@ beginning of a headline when using Org speed commands.
Now, if there
is already a restriction at point, hitting =<= again (or =C-x C-x <=) will
remove it.
+*** Option =org-agenda-scatter-days=
+
+The new option, =org-agenda-scatter-days=, sets the number of days to
+prompt with when scattering bulk-selected agenda items. It can be set
+to a number of days, or to the number of selected items (which
+scatters the items one-per-day starting on the next day). The default
+value is 7, so the default behavior is unchanged from previous
+versions.
+
** New commands and functions
*** ~org-insert-structure-template~
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index eaeddb6..6d3799c 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2042,6 +2042,12 @@ Note that functions in this alist don't need to be
quoted."
:version "24.1"
:group 'org-agenda)
+(defcustom org-agenda-scatter-days 7
+ "Number of days to scatter bulk-selected items across, by default."
+ :type '(choice (integer :tag "Number of days")
+ (const :tag "Number of bulk-selected items"
org-agenda-bulk-marked-entries))
+ :group 'org-agenda)
+
(defmacro org-agenda-with-point-at-orig-entry (string &rest body)
"Execute BODY with point at location given by `org-hd-marker' property.
If STRING is non-nil, the text property will be fetched from position 0
@@ -9967,7 +9973,9 @@ The prefix arg is passed through to the command if
possible."
(let ((days (read-number
(format "Scatter tasks across how many %sdays: "
(if arg "week" ""))
- 7)))
+ (pcase org-agenda-scatter-days
+ ((pred integerp) org-agenda-scatter-days)
+ ('org-agenda-bulk-marked-entries (length
org-agenda-bulk-marked-entries))))))
(setq cmd
`(lambda ()
(let ((distance (1+ (random ,days))))
--
2.7.4