org-capture: %F is directory when capture starts in a dired buffer

* lisp/org-capture.el (org-capture): if no file is associated to
  current buffer, check dired buffer and try to retreive a possibly
  directory associated.
This commit is contained in:
Nicolas Goaziou 2011-07-18 17:42:01 +02:00
parent 08fc6384bc
commit 819fbec641
1 changed files with 24 additions and 23 deletions

View File

@ -212,31 +212,31 @@ Furthermore, the following %-escapes will be replaced with content:
%^{prompt} prompt the user for a string and replace this sequence with it.
A default value and a completion table ca be specified like this:
%^{prompt|default|completion2|completion3|...}
%t time stamp, date only
%T time stamp with date and time
%u, %U like the above, but inactive time stamps
%^{prompt|default|completion2|completion3|...}.
%t time stamp, date only.
%T time stamp with date and time.
%u, %U like the above, but inactive time stamps.
%^t like %t, but prompt for date. Similarly %^T, %^u, %^U.
You may define a prompt like %^{Please specify birthday
%<...> the result of format-time-string on the ... format specification
%n user name (taken from `user-full-name')
%a annotation, normally the link created with `org-store-link'
You may define a prompt like %^{Please specify birthday.
%<...> the result of format-time-string on the ... format specification.
%n user name (taken from `user-full-name').
%a annotation, normally the link created with `org-store-link'.
%i initial content, copied from the active region. If %i is
indented, the entire inserted text will be indented as well.
%c current kill ring head
%x content of the X clipboard
%^C interactive selection of which kill or clip to use
%^L like %^C, but insert as link
%k title of 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 all tags in all agenda files
%^{prop}p prompt the user for a value for property `prop'
%:keyword specific information for certain link types, see below
%[pathname] insert the contents of the file given by `pathname'
%(sexp) evaluate elisp `(sexp)' and replace with the result
%c current kill ring head.
%x content of the X clipboard.
%^C interactive selection of which kill or clip to use.
%^L like %^C, but insert as link.
%k title of currently clocked task.
%K link to currently clocked task.
%f file visited by current buffer when org-capture was called.
%F full path of the file or directory visited by current buffer.
%^g prompt for tags, with completion on tags in target file.
%^G prompt for tags, with completion on all tags in all agenda files.
%^{prop}p prompt the user for a value for property `prop'.
%:keyword specific information for certain link types, see below.
%[pathname] insert the contents of the file given by `pathname'.
%(sexp) evaluate elisp `(sexp)' and replace with the result.
%? After completing the template, position cursor here.
@ -450,7 +450,8 @@ bypassed."
(org-capture-set-plist entry)
(org-capture-get-template)
(org-capture-put :original-buffer orig-buf
:original-file (buffer-file-name orig-buf)
:original-file (or (buffer-file-name orig-buf)
(car (rassq orig-buf dired-buffers)))
:original-file-nondirectory
(and (buffer-file-name orig-buf)
(file-name-nondirectory