[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Capture templates with "function" type
From: |
Alexander Baier |
Subject: |
Re: [O] Capture templates with "function" type |
Date: |
Wed, 30 Oct 2013 23:10:36 +0100 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux) |
Brett Viren <address@hidden> 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