From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ABuwFqwPFWAGOAAA0tVLHw (envelope-from ) for ; Sat, 30 Jan 2021 07:50:04 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id GDlvEqwPFWDRZAAAB5/wlQ (envelope-from ) for ; Sat, 30 Jan 2021 07:50:04 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C6A4E9404CE for ; Sat, 30 Jan 2021 07:50:03 +0000 (UTC) Received: from localhost ([::1]:55864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5l18-0002fv-Nr for larch@yhetil.org; Sat, 30 Jan 2021 02:50:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5l08-0002fa-RL for emacs-orgmode@gnu.org; Sat, 30 Jan 2021 02:49:00 -0500 Received: from out2.migadu.com ([188.165.223.204]:53856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5l04-0003aV-Mj for emacs-orgmode@gnu.org; Sat, 30 Jan 2021 02:49:00 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1611992931; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RABn52XnhFXfeFttiafw9V1+D1hu2WBKPZamrJhTstQ=; b=MdRMJagGGKJSdo29ijY2eUaLvp4BZVltR1yHxXOFtb0X6gfeS7JZDt62XoQejWKf4q0Q7p 0a6ppwEeXUQqCtgD8Y3SqzvXwYma9G8iudtUMUbRj8Ilg8MzWtEGhTuCV/TBYobP8zBa0/ gkZulmObrTt5NJpUsYa2nh3a2//uf8CjeQIPLadNVdfES1I9zIm1lV4ck4sZEHI41wURm9 hVMXhRbxE7DsHDPoBUOF00xNaLNLqiJfxmuKGAMdE6A8BmA3al+t4o0SGln0GFUmFooU6T WH0hD3b3ecJ1L6n3mX4o7KyFw2uQWEiIaDKm2fPEVMEImrlGrLapDJq1NM2WRA== From: Kyle Meyer To: Kevin Foley Subject: Re: [PATCH] Org Agenda Support Argument Collection for Custom Bulk Functions (was: Custom Bulk Functions With Prompt) In-Reply-To: References: <871rekxgpf.fsf@localhost> <87lfcrvvro.fsf@localhost> <878s8qwrvb.fsf@localhost> <87v9bsumpb.fsf@localhost> <87zh11sfnu.fsf@kyleam.com> Date: Sat, 30 Jan 2021 02:48:48 -0500 Message-ID: <8735yij25b.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Auth-User: kyle@kyleam.com Received-SPF: pass client-ip=188.165.223.204; envelope-from=kyle@kyleam.com; helo=out2.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org, Ihor Radchenko Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.35 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=kyleam.com header.s=key1 header.b=MdRMJagG; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: C6A4E9404CE X-Spam-Score: -1.35 X-Migadu-Scanner: scn0.migadu.com X-TUID: 9FjR88xYveXd Kevin Foley writes: > Kyle Meyer writes: [...] >> In addition to the NEWS entry that Ihor mentioned, it looks like an >> update to the manual is missing. > > NEWS entry added. With regard to the manual, the custom bulk function > option is only mentioned as a footnote. I'm happy to add a more in > depth explanation, however I'm not sure where it should go, any > recommendations? Ah, okay, thanks for taking a look. I'm okay leaving the details about this functionality to the defcustom then. > Subject: [PATCH] org-agenda.el: Support argument collection for custom bulk > functions [...] > diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS > index 5e5f1954d..4958d2b2e 100644 > --- a/etc/ORG-NEWS > +++ b/etc/ORG-NEWS > @@ -81,8 +81,13 @@ block. ~org-babel-latex-preamble~, ~org-babel-latex-begin-env~ and > the user to specify the preamble and code that preceedes and proceeds > the contents of the source block. > > +*** Option ~org-agenda-bulk-custom-functions~ now supports collecting bulk arguments > + > +When specifying a custom agenda bulk option, you can now also specify a function which collects the arguments to be used with each call to the custom function. Please fill this line (fill-column in .dir-locals.el is set to 70) and... > ** New features > -*** =ob-python= improvements to =:return= header argument > +*** =ob-python= improvements to =:return= header argument ... drop this unrelated space change. > @@ -2080,9 +2080,25 @@ (defcustom org-agenda-bulk-custom-functions nil > [...] > + > +If the custom function accepts arguments which you'd like to > +collect once from the user to be used for each call, you can pass > +a list with the bulk function, and the function which collects > +its arguments and returns them as a list. For example: > + > + \\='((?R (set-category get-category)) > + (?C bulk-cut)) > + Reading this docstring in full, I felt it was a bit odd to repeat the bulk-cut entry from the initial example again, as it stays the same and isn't relevant. So perhaps something like this would be clearer: ... and returns them as a list. For example, the first entry in the above example could be extended as (?R (set-category get-category)) Now, `B R' will ... Or perhaps not. I'm okay with it either way and will leave that up to you. > +Now, `B R' will call the custom `get-category' which would prompt > +the user once for a category. That category is then passed as an > +argument to `set-category' for each entry it's called against. > +" Please drop the new line before the closing quote. > + :type '(alist :key-type character > + :value-type (list (function :tag "Bulk Custom Function") > + (choice (const :tag "No Bulk Custom Argument Function" nil) > + (function :tag "Bulk Custom Argument Function")))) > + :package-version '(Org . "9.5") > :group 'org-agenda) convention nit: It'd be good to reflow the type to not go beyond ~80 columns. This type looks like it's specifying a format that isn't supported by org-agenda-bulk-action: (x . (y z)) => (x y z) This is discussed a bit in (info "(elisp)Composite Types") under the alist entry. To use a concrete example, I believe all of these entries should be valid with this patch: (defun my/bulk-action (&rest args) args) (defun my/args () (list 1 2 3)) (setq org-agenda-bulk-custom-functions '((?D my/bulk-action) (?E (my/bulk-action)) (?F (my/bulk-action my/args)))) However, customize doesn't render the above value properly (customize-option 'org-agenda-bulk-custom-functions) So, you'll need to flesh out the type entry more so that all of the valid cases are handled by the customize interface. I think it'd probably end up a bit cleaner if you go with (key fn [arg-fn]), which is the structure Ihor originally thought you were using, rather than (key (fn [arg-fn])) or (key fn). But I'd say that's dealer's choice.