[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] My first union in an agenda block
From: |
Brady Trainor |
Subject: |
[O] My first union in an agenda block |
Date: |
Tue, 22 Apr 2014 15:39:43 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
I struggled to get union of cases in an agenda block. I was able to work
from examples by Bernt Hansen at
http://doc.norang.ca/org-mode.html#CustomAgendaViewSetup
and
http://doc.norang.ca/org-mode.html#Projects,
and make the following small example, which may be useful to folks just
getting into Org-mode and Emacs, and want to be aware of how you can
combine cases into your agenda block. (Union as opposed to intersection,
OR vs AND.)
It should be straightforward to make various cases, or even finally get
familiar with the agenda filtering commands at
http://orgmode.org/manual/Filtering_002flimiting-agenda-items.html.
#+BEGIN_SRC emacs-lisp
(defun appts-nil-not-appt-next-headline ()
(let ((next-headline (save-excursion (outline-next-heading))))
(if (or ;; (string= "circus-act" (org-get-org-file))
(string= "circus-act" (org-get-category))
(member "appt" (org-get-tags-at))
(member "plans" (org-get-tags-at))
(member "social" (org-get-tags-at)))
nil
next-headline)))
#+END_SRC
(You may need this so that function org-add-agenda-custom-commands does
not create error.)
#+BEGIN_SRC emacs-lisp
(require 'org-agenda)
#+END_SRC
#+BEGIN_SRC emacs-lisp
(org-add-agenda-custom-command
'("c" "calendar"
agenda ""
((org-agenda-skip-function 'appts-nil-not-appt-next-headline)
)))
#+END_SRC
Please let me know if you see any changes I should make in my strategy
or code. (I've not made it a priority, but I think I shouldn't have the
three occurrences of `(member "<a tag>" (org-get-tags-at))'.)
Also, no telling when I'll get the chance to understand the examples at
http://stackoverflow.com/questions/20715106/org-agenda-regexp-search-categories
Brady
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [O] My first union in an agenda block,
Brady Trainor <=