From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Holst Subject: Problems with capture and lisp code Date: Thu, 21 Jan 2016 10:55:13 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMBxa-0003Z0-UD for emacs-orgmode@gnu.org; Thu, 21 Jan 2016 04:55:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMBxZ-0000Aj-NY for emacs-orgmode@gnu.org; Thu, 21 Jan 2016 04:55:22 -0500 Received: from smtp6-v.fe.bosch.de ([2a03:cc00:ff0:100::2]:13485) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMBxZ-00009d-Aw for emacs-orgmode@gnu.org; Thu, 21 Jan 2016 04:55:21 -0500 Received: from vsmta13.fe.internet.bosch.com (unknown [10.4.98.53]) by imta24.fe.bosch.de (Postfix) with ESMTP id 3E6EFD80101 for ; Thu, 21 Jan 2016 10:55:14 +0100 (CET) Received: from SI-HUB1001.de.bosch.com (vsgw23.fe.internet.bosch.com [10.4.98.23]) by vsmta13.fe.internet.bosch.com (Postfix) with ESMTP id BC5252E4044F for ; Thu, 21 Jan 2016 10:55:13 +0100 (CET) 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 mailing list Hi, for my work flow I would like to set up a capture template based on the ideas described in: http://www.jboecker.de/2010/04/14/general-reference-filing-with-org-mode.= html#sec-5 The original is based on remember but I want to use capture. The principle is as follows: In the capture template run some lisp code which appends a function to `org-capture-before-finalize-hook' which calls `org-attach-mv' to attach a file. The function run from capture template looks like this: #+begin_src emacs-lisp (defun th:filing-install-attach-mv-hook () "call this from a capture template to install th:filing-attach-mv-hook" (add-hook 'org-capture-before-finalize-hook 'th:filing-attach-mv-hook) (make-local-variable 'kill-buffer-hook) (add-hook 'kill-buffer-hook 'th:filing-uninstall-attach-mv-hook) (add-hook 'org-capture-mode-hook 'th:filing-uninstall-attach-mv-hook) (message "finalize-hook: %s" org-capture-before-finalize-hook)) #+end_src In the messages buffer I can see that at run time of the function `th:filing-attach-mv-hook' is in `org-capture-before-finalize-hook'. Now when I look at `org-capture-before-finalize-hook' in the final capture buffer `th:filing-attach-mv-hook' is not there. The same happens with `kill-buffer-hook'. I also tried `org-capture-prepare-finalize-hook'. Same result. So I am puzzled here :-(. Is there some caching mechanism involved? For the author of the article stated above this worked with remember - but why does it not work with capture. Any pointers welcome. Thanks for looking into this. --=20 Mit freundlichen Gr=FC=DFen / Best regards Thomas Holst=20