From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Setting a parametric org-agenda-skip-function? Date: Fri, 21 Jun 2013 18:42:28 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uq4Pw-00039f-Eq for emacs-orgmode@gnu.org; Fri, 21 Jun 2013 12:42:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uq4Pt-000775-Fg for emacs-orgmode@gnu.org; Fri, 21 Jun 2013 12:42:32 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:49685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uq4Pt-00076k-AK for emacs-orgmode@gnu.org; Fri, 21 Jun 2013 12:42:29 -0400 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: Org Mode Hello, I'm trying to have a custom agenda where I say I want to skip some tags. I wrote a function that does what I want (it takes two arguments: the list of tags to keep, and a boolean that says whether entries with no tags should be kept). The function works well, but for some reason it is not called. Here is how I try to call it: ("w" "Work Agenda" ((agenda "" ((org-agenda-skip-function '(org-agenda-skip-entry-unless-tags my-work-tags t)))) I make org-agenda-skip-entry-unless-tags as debugged, and when I call this agenda view, I don't go in the debugger, so I guess it is not called. I tried adding a "lambda ()" at the beginning, or getting rid of the quote, but it does not work. Any suggestion as to what I'm doing wrong? Thanks, Alan PS: here are the functions this depends on (defun as/has-tag (tags-to-test taglist &optional trueifempty) "return true if a tag in TAGS-TO-TEST is in TAGLIST. If TRUEIFEMPTY is non-nil, then returns true if TAGS-TO-TEST is empty." (or (and trueifempty (not tags-to-test)) (catch 'match (mapc (lambda (tag) (when (member tag taglist) (throw 'match t))) tags-to-test) nil)) ) (defun org-agenda-skip-entry-unless-tags (tags &optional keepempty) "Skip entries that do not contain specified tags. TAGS is a list specifying which tags should be displayed. Inherited tags will be considered. If keepempty is non-nil, entries with no tags will be kept." (let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))) (current-headline (or (and (org-at-heading-p) (point)) (save-excursion (org-back-to-heading))))) (let ((atags (org-get-tags-at current-headline))) (if (as/has-tag atags tags keepempty) nil next-headline))))