From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: generalize %F in capture to dired buffers Date: Mon, 18 Jul 2011 17:56:15 +0200 Message-ID: <87vcuza8gw.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:43817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QiqBD-0006RL-6d for emacs-orgmode@gnu.org; Mon, 18 Jul 2011 11:56:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QiqBB-0003U4-Gi for emacs-orgmode@gnu.org; Mon, 18 Jul 2011 11:56:22 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:53322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QiqBA-0003Tr-UU for emacs-orgmode@gnu.org; Mon, 18 Jul 2011 11:56:21 -0400 Received: by wyg36 with SMTP id 36so2565206wyg.0 for ; Mon, 18 Jul 2011 08:56:19 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode List --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-capture-F-is-directory-when-capture-starts-in-a-.patch >From ac5ad0078527ba4efcf12e091f048b82d6559422 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou 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 --=-=-=--