all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Setting a parametric org-agenda-skip-function?
@ 2013-06-21 16:42 Alan Schmitt
  2013-06-23 14:19 ` Alan Schmitt
  2013-06-27 14:09 ` Bastien
  0 siblings, 2 replies; 7+ messages in thread
From: Alan Schmitt @ 2013-06-21 16:42 UTC (permalink / raw)
  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))))
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Setting a parametric org-agenda-skip-function?
  2013-06-21 16:42 Setting a parametric org-agenda-skip-function? Alan Schmitt
@ 2013-06-23 14:19 ` Alan Schmitt
  2013-06-24 15:12   ` Alan Schmitt
  2013-06-27 14:09 ` Bastien
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Schmitt @ 2013-06-23 14:19 UTC (permalink / raw)
  To: Org Mode

Hello,

alan.schmitt@polytechnique.org writes:

> 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'm still trying to investigate this, but I can't find out how to step
in the debugger for this. I tried using a "skip everything" function,
defined as:

(defun as/skip-everything ()
  (let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))))
    next-headline))
)

and it is taken into account. However, I can't seem to debug this
function (if I C-u C-M-x it, running the agenda generation command
works, and everything is skipped, but I don't get into the
debugger). This is quite strange because I can debug skipping functions
for tags-todo blocks, but for some reason I cannot debug skipping
functions for agenda blocks.

Is there something special about how skipping functions work with agenda
blocks? I'd appreciate any hint on how to try to debug this.

Thanks,

Alan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Setting a parametric org-agenda-skip-function?
  2013-06-23 14:19 ` Alan Schmitt
@ 2013-06-24 15:12   ` Alan Schmitt
  2013-06-24 16:42     ` Achim Gratz
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Schmitt @ 2013-06-24 15:12 UTC (permalink / raw)
  To: Org Mode

Hello,

I'm making some progress, but things are getting stranger.

First, the reason I could not debug the function is because it is called
either using "eval" or "apply", and it seems that in that case one does
not enter the debugger. However, if one is already in the debugger, then
the function will be debugged.

It would be great except for the following: as soon as I use the
debugger, my function works as intended. Is there any reason why using
the debugger would change the behavior of a function?

Thanks,

Alan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Setting a parametric org-agenda-skip-function?
  2013-06-24 15:12   ` Alan Schmitt
@ 2013-06-24 16:42     ` Achim Gratz
  2013-06-25  6:30       ` Alan Schmitt
  0 siblings, 1 reply; 7+ messages in thread
From: Achim Gratz @ 2013-06-24 16:42 UTC (permalink / raw)
  To: emacs-orgmode

Alan Schmitt writes:
> It would be great except for the following: as soon as I use the
> debugger, my function works as intended. Is there any reason why using
> the debugger would change the behavior of a function?

Sorry to be of no actual help, but if it's any consolation to you, this
is common enough to have its own name: what you have there is called a
Heisenbug.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Terratec KOMPLEXER:
http://Synth.Stromeko.net/Downloads.html#KomplexerWaves

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Setting a parametric org-agenda-skip-function?
  2013-06-24 16:42     ` Achim Gratz
@ 2013-06-25  6:30       ` Alan Schmitt
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Schmitt @ 2013-06-25  6:30 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Stromeko@nexgo.de writes:

> Alan Schmitt writes:
>> It would be great except for the following: as soon as I use the
>> debugger, my function works as intended. Is there any reason why using
>> the debugger would change the behavior of a function?
>
> Sorry to be of no actual help, but if it's any consolation to you, this
> is common enough to have its own name: what you have there is called a
> Heisenbug.

Thanks Achim and Anthony. If I ever make progress on this, I'll let you
know.

Alan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Setting a parametric org-agenda-skip-function?
  2013-06-21 16:42 Setting a parametric org-agenda-skip-function? Alan Schmitt
  2013-06-23 14:19 ` Alan Schmitt
@ 2013-06-27 14:09 ` Bastien
  2013-06-27 17:25   ` Alan Schmitt
  1 sibling, 1 reply; 7+ messages in thread
From: Bastien @ 2013-06-27 14:09 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: Org Mode

Hi Alan,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> 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'd try edebug-defun'ing `org-agenda-skip-eval' and track what's wrong
from there.

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Setting a parametric org-agenda-skip-function?
  2013-06-27 14:09 ` Bastien
@ 2013-06-27 17:25   ` Alan Schmitt
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Schmitt @ 2013-06-27 17:25 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode

Hi Bastien,

bzg@gnu.org writes:

> Hi Alan,
>
> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> 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'd try edebug-defun'ing `org-agenda-skip-eval' and track what's wrong
> from there.

Thank you for the suggestion. Unfortunately I don't know how to step
inside the '(eval form)' bit: if I hit 'i' edebug tells me "eval is a
built-in function". So I could just skip over it but I won't see what
the problem is.

Alan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-27 17:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-21 16:42 Setting a parametric org-agenda-skip-function? Alan Schmitt
2013-06-23 14:19 ` Alan Schmitt
2013-06-24 15:12   ` Alan Schmitt
2013-06-24 16:42     ` Achim Gratz
2013-06-25  6:30       ` Alan Schmitt
2013-06-27 14:09 ` Bastien
2013-06-27 17:25   ` Alan Schmitt

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.