emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Change: (org-agenda-bulk-action) Prompt w/number of marked items
Date: Thu, 13 Sep 2018 05:36:12 -0500	[thread overview]
Message-ID: <87tvmtn0pv.fsf@alphapapa.net> (raw)
In-Reply-To: 87bm91oh62.fsf@alphapapa.net

[-- 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


  reply	other threads:[~2018-09-13 10:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2018-09-13 21:12       ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tvmtn0pv.fsf@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).