From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brady Trainor Subject: My first union in an agenda block Date: Tue, 22 Apr 2014 15:39:43 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcjM8-0003sh-2d for emacs-orgmode@gnu.org; Tue, 22 Apr 2014 18:40:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WcjM2-0003CM-Vu for emacs-orgmode@gnu.org; Tue, 22 Apr 2014 18:39:59 -0400 Received: from plane.gmane.org ([80.91.229.3]:57742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcjM2-0003CI-ON for emacs-orgmode@gnu.org; Tue, 22 Apr 2014 18:39:54 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WcjM1-0006Cv-G0 for emacs-orgmode@gnu.org; Wed, 23 Apr 2014 00:39:53 +0200 Received: from 71-217-24-179.tukw.qwest.net ([71.217.24.179]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Apr 2014 00:39:53 +0200 Received: from algebrat by 71-217-24-179.tukw.qwest.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Apr 2014 00:39:53 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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 "" (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