Stefan Kangas writes:

> Please find attached a patch to add a new function org-agenda-filter-set
> which allows you to specify the same strings as in the org-agenda-filter
> prompt directly from Lisp.  It allows you to do things like:
>
>     (org-agenda-filter-set "-@foo-bar")
>
> Before, this would have involved doing more of the heavy lifting
> manually using org-agenda-filter-apply.

Sounds good to me.

> Subject: [PATCH] New function org-agenda-filter-set
>
> * lisp/org-agenda.el (org-agenda-filter)
> (org-agenda-filter-set): Refactor out from 'org-agenda-filter', to
> create a better interface to filter the agenda from Lisp.
> ---
>  lisp/org-agenda.el | 100 +++++++++++++++++++++++++--------------------
>  1 file changed, 55 insertions(+), 45 deletions(-)

As expected from the description, the bulk of this is code movement, all
of which looked sensible when I inspected it with
--color-moved=default --color-moved-ws=allow-indentation-change

> -(defun org-agenda-filter (&optional strip-or-accumulate)
> +(defun org-agenda-filter-set (str &optional force-keep negate)
> +  "Set agenda filter from string.
> +The string is parsed according to the rules described in
> +the `org-agenda-filter' command.
> +
> +If FORCE-KEEP is non-nil, add the new filter elements to the
> +existing ones."

nitpick: Could you update the docstring to explicitly mention STR and to
describe NEGATE?

Thanks for the patch.

Reply via email to