forked from mirrors/org-mode
Allow to contextualize capture and agenda commands by checking the name of the buffer
* org.el (org-contextualize-validate-key): Check against two new context predicates [not-]in-buffer. * org-capture.el (org-capture-templates-contexts): * org-agenda.el (org-agenda-custom-commands-contexts): Document the new [not-]in-buffer context predicates. Thanks to Paul Sexton for triggering this and for proposing a patch.
This commit is contained in:
parent
b9c506b41e
commit
bbea8d348b
|
@ -2423,6 +2423,8 @@ Here are the available contexts definitions:
|
|||
in-mode: command displayed only in matching modes
|
||||
not-in-file: command not displayed in matching files
|
||||
not-in-mode: command not displayed in matching modes
|
||||
in-buffer: command displayed only in matching buffers
|
||||
not-in-buffer: command not displayed in matching buffers
|
||||
[function]: a custom function taking no argument
|
||||
|
||||
If you define several checks, the agenda command will be
|
||||
|
@ -2448,6 +2450,8 @@ duplicates.)"
|
|||
(choice
|
||||
(const :tag "In file" in-file)
|
||||
(const :tag "Not in file" not-in-file)
|
||||
(const :tag "In buffer" in-buffer)
|
||||
(const :tag "Not in buffer" not-in-buffer)
|
||||
(const :tag "In mode" in-mode)
|
||||
(const :tag "Not in mode" not-in-mode))
|
||||
(regexp))
|
||||
|
|
|
@ -461,6 +461,8 @@ Here are the available contexts definitions:
|
|||
in-mode: command displayed only in matching modes
|
||||
not-in-file: command not displayed in matching files
|
||||
not-in-mode: command not displayed in matching modes
|
||||
in-buffer: command displayed only in matching buffers
|
||||
not-in-buffer: command not displayed in matching buffers
|
||||
[function]: a custom function taking no argument
|
||||
|
||||
If you define several checks, the agenda command will be
|
||||
|
@ -486,6 +488,8 @@ to avoid duplicates.)"
|
|||
(choice
|
||||
(const :tag "In file" in-file)
|
||||
(const :tag "Not in file" not-in-file)
|
||||
(const :tag "In buffer" in-buffer)
|
||||
(const :tag "Not in buffer" not-in-buffer)
|
||||
(const :tag "In mode" in-mode)
|
||||
(const :tag "Not in mode" not-in-mode))
|
||||
(regexp))
|
||||
|
|
|
@ -8729,11 +8729,15 @@ definitions."
|
|||
(string-match (cdr rr) (buffer-file-name)))
|
||||
(and (eq (car rr) 'in-mode)
|
||||
(string-match (cdr rr) (symbol-name major-mode)))
|
||||
(and (eq (car rr) 'in-buffer)
|
||||
(string-match (cdr rr) (buffer-name)))
|
||||
(when (and (eq (car rr) 'not-in-file)
|
||||
(buffer-file-name))
|
||||
(not (string-match (cdr rr) (buffer-file-name))))
|
||||
(when (eq (car rr) 'not-in-mode)
|
||||
(not (string-match (cdr rr) (symbol-name major-mode)))))))
|
||||
(not (string-match (cdr rr) (symbol-name major-mode))))
|
||||
(when (eq (car rr) 'not-in-buffer)
|
||||
(not (string-match (cdr rr) (buffer-name)))))))
|
||||
(push r res)))
|
||||
(car (last r))))
|
||||
(delete-dups (delq nil res))))
|
||||
|
|
Loading…
Reference in a new issue