* [PATCH] Change: (org-agenda-bulk-action) Prompt w/number of marked items
@ 2018-09-02 9:00 Adam Porter
2018-09-06 19:32 ` Nicolas Goaziou
0 siblings, 1 reply; 5+ messages in thread
From: Adam Porter @ 2018-09-02 9:00 UTC (permalink / raw)
To: emacs-orgmode
* lisp/org-agenda.el (org-agenda-bulk-action): When scattering, prompt
for number of days with number of marked items.
A typical pattern for me is to mark a significant number of items
scheduled in the past and scatter them into the future. Usually I
want to schedule one item per day, i.e. across a number of days equal
to the number of marked items. The default prompt is 7 days, and
counting the number of items is tedious. This uses the number of
marked items as the initial prompt for the number of days.
Alternatively, the number of marked items could be indicated in the
prompt string, e.g. "Scatter X tasks across how many days:". A
customizeable default could also be provided.
---
lisp/org-agenda.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index eaeddb6..44ecd70 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9967,7 +9967,7 @@ 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)))
+ (length org-agenda-bulk-marked-entries))))
(setq cmd
`(lambda ()
(let ((distance (1+ (random ,days))))
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Change: (org-agenda-bulk-action) Prompt w/number of marked items
2018-09-02 9:00 [PATCH] Change: (org-agenda-bulk-action) Prompt w/number of marked items Adam Porter
@ 2018-09-06 19:32 ` Nicolas Goaziou
2018-09-13 9:55 ` Adam Porter
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2018-09-06 19:32 UTC (permalink / raw)
To: Adam Porter; +Cc: emacs-orgmode
Hello,
Adam Porter <adam@alphapapa.net> writes:
> * lisp/org-agenda.el (org-agenda-bulk-action): When scattering, prompt
> for number of days with number of marked items.
Thank you.
> A typical pattern for me is to mark a significant number of items
> scheduled in the past and scatter them into the future. Usually I
> want to schedule one item per day, i.e. across a number of days equal
> to the number of marked items. The default prompt is 7 days, and
> counting the number of items is tedious. This uses the number of
> marked items as the initial prompt for the number of days.
>
> Alternatively, the number of marked items could be indicated in the
> prompt string, e.g. "Scatter X tasks across how many days:". A
> customizeable default could also be provided.
FWIW, I slightly prefer the second option. Would you want to provide
a patch for that?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Change: (org-agenda-bulk-action) Prompt w/number of marked items
2018-09-06 19:32 ` Nicolas Goaziou
@ 2018-09-13 9:55 ` Adam Porter
2018-09-13 10:36 ` Adam Porter
0 siblings, 1 reply; 5+ messages in thread
From: Adam Porter @ 2018-09-13 9:55 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
Hi Nicolas,
>> Alternatively, the number of marked items could be indicated in the
>> prompt string, e.g. "Scatter X tasks across how many days:". A
>> customizeable default could also be provided.
>
> FWIW, I slightly prefer the second option. Would you want to provide
> a patch for that?
Sure. What if I add a customization option like this:
- N days
- Number of selected items
It could default to the first option, specifically 7, so the default
behavior would not change.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Change: (org-agenda-bulk-action) Prompt w/number of marked items
2018-09-13 9:55 ` Adam Porter
@ 2018-09-13 10:36 ` Adam Porter
2018-09-13 21:12 ` Nicolas Goaziou
0 siblings, 1 reply; 5+ messages in thread
From: Adam Porter @ 2018-09-13 10:36 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 58 bytes --]
I went ahead and made a patch for that idea.
Thanks,
Adam
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 2749 bytes --]
From bba4a705cb028643ee76c9e37b0168e8a1152986 Mon Sep 17 00:00:00 2001
From: Adam Porter <adam@alphapapa.net>
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-09-13 21:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-02 9:00 [PATCH] Change: (org-agenda-bulk-action) Prompt w/number of marked items Adam Porter
2018-09-06 19:32 ` Nicolas Goaziou
2018-09-13 9:55 ` Adam Porter
2018-09-13 10:36 ` Adam Porter
2018-09-13 21:12 ` Nicolas Goaziou
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).