emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Stefan Kangas <stefan@marxist.se>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] New function org-agenda-filter-set
Date: Sat, 23 May 2020 05:02:34 +0000	[thread overview]
Message-ID: <875zcns0ph.fsf@kyleam.com> (raw)
In-Reply-To: <CADwFkmkDvCAt+Awn9GGadCr5u+YH0mXXJknXn3UT1-AZ+wVm+g@mail.gmail.com>

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	other threads:[~2020-05-23  5:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21  6:23 [PATCH] New function org-agenda-filter-set Stefan Kangas
2020-05-23  5:02 ` Kyle Meyer [this message]
2020-05-23  5:16   ` Stefan Kangas
2020-05-23  9:07 ` Bastien
2020-06-01 12:50 ` Bastien
2020-06-05  3:58   ` Kyle Meyer
2020-09-05  7:45     ` Bastien

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=875zcns0ph.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=stefan@marxist.se \
    /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).