Implement key replacement depending on the contexts.
commit6c94ea051824edea55356351600875d456325b49
authorBastien Guerry <bzg@altern.org>
Thu, 23 Aug 2012 15:04:43 +0000 (23 17:04 +0200)
committerBastien Guerry <bzg@altern.org>
Fri, 24 Aug 2012 10:17:58 +0000 (24 12:17 +0200)
tree492b5d701830c2bfed6dc428010818f838511e8c
parentbe70cfd0840c43e1d07fe90031330e425c1e2733
Implement key replacement depending on the contexts.

* org.el (org-contextualize-agenda-or-capture): Handle key
replacement depending on the contexts.

* org-capture.el (org-capture-templates-contexts): Allow to
use the context as a way to replace one capture template by
another one.

* org-agenda.el (org-agenda-custom-commands-contexts): Allow
to use the context as a way to replace one agenda custom
command by another one.

* org.texi (Templates in contexts): Document the new structure
of the variables `org-agenda-custom-commands-contexts' and
`org-capture-templates-contexts'.

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")))))

Thanks to Carsten for suggesting this "key-replacement" idea!
doc/org.texi
lisp/org-agenda.el
lisp/org-capture.el
lisp/org.el