From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Baier Subject: Re: Capture templates with "function" type Date: Wed, 30 Oct 2013 23:10:36 +0100 Message-ID: <87bo262yw3.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vbdyn-0003FH-L9 for emacs-orgmode@gnu.org; Wed, 30 Oct 2013 18:11:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vbdyh-0006Vd-K2 for emacs-orgmode@gnu.org; Wed, 30 Oct 2013 18:11:09 -0400 Received: from plane.gmane.org ([80.91.229.3]:56231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vbdyh-0006VX-DX for emacs-orgmode@gnu.org; Wed, 30 Oct 2013 18:11:03 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Vbdyg-0002wT-HL for emacs-orgmode@gnu.org; Wed, 30 Oct 2013 23:11:02 +0100 Received: from nat-wh-wh36.rz.uni-karlsruhe.de ([141.70.81.154]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 30 Oct 2013 23:11:02 +0100 Received: from lexi.baier by nat-wh-wh36.rz.uni-karlsruhe.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 30 Oct 2013 23:11:02 +0100 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: emacs-orgmode@gnu.org Brett Viren writes: > Hi, > > I'm trying to set up a capture template of type "function" in order to > produce a daily log file named after today's date. > > It mostly works. However, after doing the C-cC-c to close the capture > buffer the window is left holding the daily log file which the capture > just updated instead of going back to whatever buffer I was in when I > initiated the capture. This returning-to-previous-buffer behavior is > what I see when I use the file+headline capture type. > > Can someone say how I might get this behavior for the "function" capture > type as well? Here is my setup: > > (defun bv-daily-log-file () > (find-file (concat "~/org/web/notes/" > (format-time-string "%Y-%m-%d") ".org")) > (goto-char (point-max)) > (newline 2) > ) > (setq org-capture-templates > (quote > ( > ("n" "Note" entry > (function bv-daily-log-file) > "\* %U %^{title}\n %a\n\n%?" > :empty-lines 1) > ))) > > > Thanks, > -Brett. Hello Bret, I do not know, how the capture process works internally, but if I had to guess I would say, that it stores the current window configuration, when a capture template is invoked that is not of type funcion. This configuration is restored after finishing or canceling the capture process. I would say, when using the function template type, you might have to roll your own window-configuration management, if that is the behaviour you want. Regards, Alex