emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-agenda-custom-commands with org-agenda-filter-by-regexp
@ 2015-08-19 15:57 Tory S. Anderson
  2015-08-20 14:29 ` Matt Lundin
  0 siblings, 1 reply; 2+ messages in thread
From: Tory S. Anderson @ 2015-08-19 15:57 UTC (permalink / raw)
  To: orgmode list

I've previously had success with using 
`org-agenda-tag-filter-preset` in `org-agenda-custom-commands` but 
I wanted to include OR logic on two different tags, which seemed 
beyond th tag-filter (which seems to use AND logic). In my agenda 
view I can use `=` to use a conditional on two tags, but I can't 
seem to duplicate that behavior in a custom command. With no 
errors it simply doesn't seem to work, and googling around has 
proved fruitless for giving examples; I've tried a number of 
different syntax without effect.

--8<---------------cut here---------------start------------->8---
(setq org-agenda-custom-commands
      '(("w"."Work")
	("wd" "Work Day"
	 ((agenda "" ((org-agenda-span 1) 
	 (org-agenda-start-on-weekday nil) 
	 (org-agenda-filter-by-regexp 
	 '(":\\(ODH\)\\|\\(AGENDA\\):"))))))))
--8<---------------cut here---------------end--------------->8---


What's the proper way to get a working regexp filter in my 
custom-command? Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: org-agenda-custom-commands with org-agenda-filter-by-regexp
  2015-08-19 15:57 org-agenda-custom-commands with org-agenda-filter-by-regexp Tory S. Anderson
@ 2015-08-20 14:29 ` Matt Lundin
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Lundin @ 2015-08-20 14:29 UTC (permalink / raw)
  To: Tory S. Anderson; +Cc: orgmode list

torys.anderson@gmail.com (Tory S. Anderson) writes:

> I've previously had success with using 
> `org-agenda-tag-filter-preset` in `org-agenda-custom-commands` but 
> I wanted to include OR logic on two different tags, which seemed 
> beyond th tag-filter (which seems to use AND logic). In my agenda 
> view I can use `=` to use a conditional on two tags, but I can't 
> seem to duplicate that behavior in a custom command. With no 
> errors it simply doesn't seem to work, and googling around has 
> proved fruitless for giving examples; I've tried a number of 
> different syntax without effect.
>
> (setq org-agenda-custom-commands
>       '(("w"."Work")
> 	("wd" "Work Day"
> 	 ((agenda "" ((org-agenda-span 1) 
> 	 (org-agenda-start-on-weekday nil) 
> 	 (org-agenda-filter-by-regexp 
> 	 '(":\\(ODH\)\\|\\(AGENDA\\):"))))))))
>
>
> What's the proper way to get a working regexp filter in my 
> custom-command? Thanks!

I think the regexp above is not correct. It's missing a backward slash
after ODH (and contains an redundant set of parentheses).

But even the regexp were correct, it wouldn't work, since
org-agenda-filter-by-regexp is designed to be used interactively. Its
parameter is a prefix argument, not a list or string.

I think you need a skip function here:

(setq org-agenda-custom-commands
      '(("w"."Work")
	("wd" "Work Day"
	 ((agenda "" ((org-agenda-span 1) 
	 (org-agenda-start-on-weekday nil) 
         (org-agenda-skip-function
          '(org-agenda-skip-entry-if 'notregexp ":\\(ODH\\|AGENDA\\):"))))))))

Matt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-20 14:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-19 15:57 org-agenda-custom-commands with org-agenda-filter-by-regexp Tory S. Anderson
2015-08-20 14:29 ` Matt Lundin

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).