emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Brady Trainor <algebrat@uw.edu>
To: emacs-orgmode@gnu.org
Subject: My first union in an agenda block
Date: Tue, 22 Apr 2014 15:39:43 -0700	[thread overview]
Message-ID: <lj6r3f$mbs$1@ger.gmane.org> (raw)


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

                 reply	other threads:[~2014-04-22 22:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='lj6r3f$mbs$1@ger.gmane.org' \
    --to=algebrat@uw.edu \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: My first union in an agenda block' \
    /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

Code repositories for project(s) associated with this 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).