emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] org capture contexts not working?


From: Eric Abrahamsen
Subject: [O] org capture contexts not working?
Date: Sun, 20 Apr 2014 13:20:24 +0800
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.3 (gnu/linux)

I've got this for three capture templates that should only work in Gnus:

(setq org-capture-templates-contexts
      '(("M" ((in-mode . "gnus-\\(summary\\|article\\)")))
        ("P" ((in-mode . "gnus-\\(summary\\|article\\)")))
        ("H" ((in-mode . "gnus-\\(summary\\|article\\)")))))

This worked for quite some time, but when I went back to use it again
today I found that these templates aren't filtered out in non-Gnus
settings. I tried stepping through the code of
`org-contextualize-validate-key' and think I've found the problem,
though I'll confess to a little confusion.

When that function checks the predicates (in-mode, not-in-file, etc), it
has this chunk for handling the not-in-file bit:

(if (and (eq (car rr) 'not-in-file)
         (buffer-file-name))
    (not (string-match (cdr rr) (buffer-file-name)))
  t)

This was slightly mis-aligned in the source file, leading me to believe
it's just a nesting error. As it is, any template which *isn't using*
the not-in-file predicate is going to flag as acceptable for the current
context. I think it should just be:

(when (and (eq (car rr) 'not-in-file)
           (buffer-file-name))
  (not (string-match (cdr rr) (buffer-file-name))))

Testing indicates it works, am I missing anything? Pickaxe search for
the string "not-in-file" in git says the last relevant commit was two
years ago, so who knows what's going on...

Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]