소스 검색

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.
Nicolas Goaziou 13 년 전
부모
커밋
819fbec641
1개의 변경된 파일24개의 추가작업 그리고 23개의 파일을 삭제
  1. 24 23
      lisp/org-capture.el

+ 24 - 23
lisp/org-capture.el

@@ -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