From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brett Viren Subject: Re: Capture templates with "function" type Date: Tue, 05 Nov 2013 13:00:56 -0500 Message-ID: References: <87ppqe69s4.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vdkwf-0006f5-3c for emacs-orgmode@gnu.org; Tue, 05 Nov 2013 13:01:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdkwX-0002ys-Se for emacs-orgmode@gnu.org; Tue, 05 Nov 2013 13:01:40 -0500 Received: from smtpgw.bnl.gov ([2620:10a:0:3::30]:19325 helo=iron4.sec.bnl.local) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdkwX-0002gZ-Oe for emacs-orgmode@gnu.org; Tue, 05 Nov 2013 13:01:33 -0500 In-Reply-To: <87ppqe69s4.fsf@bzg.ath.cx> (Bastien's message of "Tue, 05 Nov 2013 18:25:15 +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: Bastien Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Bastien, Bastien writes: > You may try this (not tested myself): > > (defun bv-daily-log-file () > (save-window-excursion > (find-file (concat "~/org/web/notes/"=20 > (format-time-string "%Y-%m-%d") ".org")) > (goto-char (point-max)) > (newline 2))) > > The trick is to use `save-window-excursion'. Thanks for the pointer but it looks like this macro runs afoul of the capture process somehow. I redefined my function as you have above and did C-xC-e to reload it and then initiated a capture from a window showing my GNUS summary. It fails with: byte-code: Capture abort: (buffer-read-only #) I then tried another capture staring from a read-write buffer. The capture succeeds but the captured text is inserted into this starting buffer instead of the one found by the bv-daily-log-file function. The Elisp manual mentions that save-selected-window is sometimes a better alternative but that gives the same behavior.=20=20 Do you maybe have further ideas I could try?=20=20 Thanks, =2DBrett. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlJ5MlgACgkQEixH2Z0dKCyhYgCgl8CEBs4UMCEiywGbfL0XLSAw MRwAnj4ZCYp1dMf7jJ4MhNRjn0cdxCsr =t/U9 -----END PGP SIGNATURE----- --=-=-=--