mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-02 08:22:16 +00:00
Make file and path accessible in capture templates
* lisp/org-capture.el (org-capture-templates): Add %f and %F escapes (org-capture): Add more information to capture property list (org-capture-fill-template): Handle %f and %F escapes
This commit is contained in:
parent
252d244466
commit
bd11460542
@ -6409,6 +6409,8 @@ dynamic insertion of content:
|
|||||||
%^L @r{Like @code{%^C}, but insert as link.}
|
%^L @r{Like @code{%^C}, but insert as link.}
|
||||||
%k @r{title of the currently clocked task}
|
%k @r{title of the currently clocked task}
|
||||||
%K @r{link to the currently clocked task}
|
%K @r{link to the currently clocked task}
|
||||||
|
%f @r{file visited by current buffer when org-capture was called}
|
||||||
|
%F @r{like @code{%f}, but include full path}
|
||||||
%^g @r{prompt for tags, with completion on tags in target file.}
|
%^g @r{prompt for tags, with completion on tags in target file.}
|
||||||
%^G @r{prompt for tags, with completion all tags in all agenda files.}
|
%^G @r{prompt for tags, with completion all tags in all agenda files.}
|
||||||
%^@{@var{prop}@}p @r{Prompt the user for a value for property @var{prop}}
|
%^@{@var{prop}@}p @r{Prompt the user for a value for property @var{prop}}
|
||||||
|
@ -215,6 +215,8 @@ Furthermore, the following %-escapes will be replaced with content:
|
|||||||
%^L like %^C, but insert as link
|
%^L like %^C, but insert as link
|
||||||
%k title of currently clocked task
|
%k title of currently clocked task
|
||||||
%K link to currently clocked task
|
%K link to currently clocked task
|
||||||
|
%f file visited by current buffer when org-capture was called
|
||||||
|
%F like @code{%f}, but include full path
|
||||||
%^g prompt for tags, with completion on tags in target file
|
%^g prompt for tags, with completion on tags in target file
|
||||||
%^G prompt for tags, with completion on all tags in all agenda files
|
%^G prompt for tags, with completion on all tags in all agenda files
|
||||||
%^{prop}p prompt the user for a value for property `prop'
|
%^{prop}p prompt the user for a value for property `prop'
|
||||||
@ -415,7 +417,13 @@ bypassed."
|
|||||||
(t
|
(t
|
||||||
(org-capture-set-plist entry)
|
(org-capture-set-plist entry)
|
||||||
(org-capture-get-template)
|
(org-capture-get-template)
|
||||||
(org-capture-put :original-buffer orig-buf :annotation annotation
|
(org-capture-put :original-buffer orig-buf
|
||||||
|
:original-file (buffer-file-name orig-buf)
|
||||||
|
:original-file-nondirectory
|
||||||
|
(and (buffer-file-name orig-buf)
|
||||||
|
(file-name-nondirectory
|
||||||
|
(buffer-file-name orig-buf)))
|
||||||
|
:annotation annotation
|
||||||
:initial initial)
|
:initial initial)
|
||||||
(org-capture-put :default-time
|
(org-capture-put :default-time
|
||||||
(or org-overriding-default-time
|
(or org-overriding-default-time
|
||||||
@ -1164,6 +1172,8 @@ The template may still contain \"%?\" for cursor positioning."
|
|||||||
(org-make-link-string
|
(org-make-link-string
|
||||||
(buffer-file-name (marker-buffer org-clock-marker))
|
(buffer-file-name (marker-buffer org-clock-marker))
|
||||||
org-clock-heading)))
|
org-clock-heading)))
|
||||||
|
(v-f (or (org-capture-get :original-file-nondirectory) ""))
|
||||||
|
(v-F (or (org-capture-get :original-file) ""))
|
||||||
v-I
|
v-I
|
||||||
(org-startup-folded nil)
|
(org-startup-folded nil)
|
||||||
(org-inhibit-startup t)
|
(org-inhibit-startup t)
|
||||||
@ -1213,7 +1223,7 @@ The template may still contain \"%?\" for cursor positioning."
|
|||||||
|
|
||||||
;; Simple %-escapes
|
;; Simple %-escapes
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t)
|
(while (re-search-forward "%\\([tTuUaiAcxkKInfF]\\)" nil t)
|
||||||
(unless (org-capture-escaped-%)
|
(unless (org-capture-escaped-%)
|
||||||
(when (and initial (equal (match-string 0) "%i"))
|
(when (and initial (equal (match-string 0) "%i"))
|
||||||
(save-match-data
|
(save-match-data
|
||||||
|
Loading…
Reference in New Issue
Block a user