Brett Viren <b...@bnl.gov> 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


Reply via email to