emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Best way to implement project specific captures


From: Bastien
Subject: Re: [O] Best way to implement project specific captures
Date: Thu, 23 Aug 2012 17:08:30 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux)

Hi Carsten,

Carsten Dominik <address@hidden> writes:

> I am wondering if the following feature would be useful as well: Context
> sensitivity sounds most interesting to me if the same key would do
> different things in different contexts.  I am not sure if this is possible
> with the current implementation?  For example, I might want to have a bug
> recording key which creates an entry in a bug tracker file, but the file is
> different for different source files, and also the template and target type
> definitions might be different in different contexts.
>
> That would require a setup which defines a selection letter, and then an a
> list of (sets of) conditions and the corresponding template
> definition.

I implemented this, relying on the existing contexts options.

Please have a go with the attached patch.  I copy the comment
from the commit log:

In the setup below, X is not a real capture template, it is just
an alias to templates A and B in .txt and .el files.  A and B are
deactivated by default in all files.

(setq org-capture-templates
      '(("X" "Nothing but an alias")
        ("A" "AAAA" entry (file+headline [...]))
        ("B" "BBBB" entry (file+headline [...]))))

(setq org-capture-templates-contexts
      '(("A" "A" ((not-in-file . ".*")))
        ("B" "B" ((not-in-file . ".*")))
        ("X" "A" ((in-file . "\\.txt")))
        ("X" "B" ((in-file . "\\.el")))))

I find this quite handy...  let me know what you think!

Attachment: 0001-Implement-key-replacement-depending-on-the-contexts.patch
Description: Text Data

-- 
 Bastien

reply via email to

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