emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* My first union in an agenda block
@ 2014-04-22 22:39 Brady Trainor
  0 siblings, 0 replies; only message in thread
From: Brady Trainor @ 2014-04-22 22:39 UTC (permalink / raw)
  To: emacs-orgmode


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-04-22 22:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-22 22:39 My first union in an agenda block Brady Trainor

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