From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Porter Subject: Re: [PATCH] Change: (org-agenda-bulk-action) Prompt w/number of marked items Date: Thu, 13 Sep 2018 05:36:12 -0500 Message-ID: <87tvmtn0pv.fsf@alphapapa.net> References: <87r2ic46ke.fsf@alphapapa.net> <87va7i776p.fsf@nicolasgoaziou.fr> <87bm91oh62.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g0Oz7-0006vy-FS for emacs-orgmode@gnu.org; Thu, 13 Sep 2018 06:36:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g0Oz4-0006iH-P8 for emacs-orgmode@gnu.org; Thu, 13 Sep 2018 06:36:29 -0400 Received: from [195.159.176.226] (port=35227 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g0Oz4-0006hD-Du for emacs-orgmode@gnu.org; Thu, 13 Sep 2018 06:36:26 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1g0Owr-0005C1-LO for emacs-orgmode@gnu.org; Thu, 13 Sep 2018 12:34:09 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain I went ahead and made a patch for that idea. Thanks, Adam --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-agenda-Add-org-agenda-scatter-days-option.patch Content-Description: patch >From bba4a705cb028643ee76c9e37b0168e8a1152986 Mon Sep 17 00:00:00 2001 From: Adam Porter 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 --=-=-=--