From: Kyle Meyer <kyle@kyleam.com>
To: Kevin Foley <kevin@kevinjfoley.me>
Cc: emacs-orgmode@gnu.org, Ihor Radchenko <yantar92@gmail.com>
Subject: Re: [PATCH] Org Agenda Support Argument Collection for Custom Bulk Functions (was: Custom Bulk Functions With Prompt)
Date: Sat, 30 Jan 2021 02:48:48 -0500 [thread overview]
Message-ID: <8735yij25b.fsf@kyleam.com> (raw)
In-Reply-To: <m2zh0uvurm.fsf@Kevins-MBP.home.lan>
Kevin Foley writes:
> Kyle Meyer <kyle@kyleam.com> 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.
next prev parent reply other threads:[~2021-01-30 7:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-17 2:31 Custom Bulk Functions With Prompt Kevin Foley
2021-01-17 5:42 ` Ihor Radchenko
2021-01-17 18:06 ` Kevin Foley
2021-01-18 2:11 ` Ihor Radchenko
2021-01-18 2:14 ` Kevin Foley
2021-01-18 8:50 ` Ihor Radchenko
2021-01-19 18:36 ` Kevin Foley
2021-01-20 6:49 ` Ihor Radchenko
2021-01-21 14:01 ` [PATCH] Org Agenda Support Argument Collection for Custom Bulk Functions (was: Custom Bulk Functions With Prompt) Kevin Foley
2021-01-22 5:14 ` Ihor Radchenko
2021-01-22 5:29 ` Kyle Meyer
2021-01-27 23:13 ` Kevin Foley
2021-01-30 7:48 ` Kyle Meyer [this message]
2021-02-13 17:29 ` Kevin Foley
2021-02-14 20:23 ` Kyle Meyer
2021-02-15 2:30 ` Kevin Foley
2021-02-15 3:01 ` Kyle Meyer
2021-02-15 14:04 ` Kevin Foley
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=8735yij25b.fsf@kyleam.com \
--to=kyle@kyleam.com \
--cc=emacs-orgmode@gnu.org \
--cc=kevin@kevinjfoley.me \
--cc=yantar92@gmail.com \
/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).