Hello,

After an interesting discussion with chu_ on #org-mode, I've written the
following patch, which makes %F in a capture template return the full
path of the directory if the capture process was called from a dired
buffer.

Any interest in applying it?

Regards,

-- 
Nicolas Goaziou
>From ac5ad0078527ba4efcf12e091f048b82d6559422 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaz...@gmail.com>
Date: Mon, 18 Jul 2011 17:42:01 +0200
Subject: [PATCH] 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.
---
 lisp/org-capture.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index aeb04f2..8da12df 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -447,7 +447,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
-- 
1.7.6

Reply via email to