From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shankar Rao Subject: Re: insert aligned table using capture template Date: Tue, 3 Nov 2015 12:37:55 -0800 Message-ID: References: <87611ikeul.fsf@alphaville.usersys.redhat.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bd6bf1c5eb54a0523a8defc Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtiL7-0006dA-Am for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 15:37:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtiL6-0007pR-Ak for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 15:37:57 -0500 Received: from mail-ob0-x235.google.com ([2607:f8b0:4003:c01::235]:34314) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtiL6-0007pL-4i for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 15:37:56 -0500 Received: by obbza9 with SMTP id za9so22561663obb.1 for ; Tue, 03 Nov 2015 12:37:55 -0800 (PST) In-Reply-To: <87611ikeul.fsf@alphaville.usersys.redhat.com> 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: Nick Dokos Cc: emacs-orgmode@gnu.org --047d7bd6bf1c5eb54a0523a8defc Content-Type: text/plain; charset=UTF-8 Oops. (set org-capture-templates '(... should be (set org-capture-templates `(... On Tue, Nov 3, 2015 at 12:28 PM, Nick Dokos wrote: > Shankar Rao writes: > > > I'm trying to use to org-capture insert tables into a datetree that I > use to manage my finances. Below is the capture template I set up for it. > Is there a way to make the table be aligned > > after I finalize the capture? > > > > Shankar > > > > ----- > > > > (setq org-capture-templates > > '(... > > ("f" "Add Tables" plain > > (file+datetree+prompt "~/my-table-file.org") > > ,(concat "#+TBLNAME: accounts-%<%y%m%d>\n" > > "| Account | Initial | Final | Calculations |\n" > > "|-\n" > > "| Account A | | | |\n" > > "| Account B | | | |\n" > > "| Account C | | | |\n") > > :immediate-finish t > > :jump-to-captured t) > > ...)) > > The ,(concat ...) stuff did not work for me: is is supposed to? I get > "invalid capture template". > > Be that as it may, you can do this (maybe with more safeguards): > > --8<---------------cut here---------------start------------->8--- > (add-hook 'org-capture-prepare-finalize-hook (function > my-capture-table-align)) > > (defun my-capture-table-align () > (forward-line 1) ;; skip the #+name line > (if (org-at-table-p 'any) > (org-table-align))) > --8<---------------cut here---------------end--------------->8--- > > -- > Nick > > > --047d7bd6bf1c5eb54a0523a8defc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Oops.

(set org-capture-templates '(= ...

should be=C2=A0

(set = org-capture-templates `(...



On Tue, Nov 3, 2015 at = 12:28 PM, Nick Dokos <ndokos@gmail.com> wrote:
Shankar Rao <= ;shankar.rao@gmail.com> wri= tes:

> I'm trying to use to org-capture insert tables into a datetree tha= t I use to manage my finances. Below is the capture template I set up for i= t. Is there a way to make the table be aligned
> after I finalize the capture?
>
> Shankar
>
> -----
>
> (setq org-capture-templates
> =C2=A0 =C2=A0 =C2=A0 =C2=A0'(...
> ("f" "Add Tables" plain
> (file+datetree+prompt "~/my-table-file.org")
> =C2=A0,(concat "#+TBLNAME: accounts-%<%y%m%d>\n"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "|= Account | Initial | Final | Calculations |\n"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "|= -\n"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "|= Account A | | | |\n"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "|= Account B | | | |\n"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "|= Account C | | | |\n")
> :immediate-finish t
> :jump-to-captured t)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 ...))

The ,(concat ...) stuff did not work for me: is is supposed to?= I get
"invalid capture template".

Be that as it may, you can do this (maybe with more safeguards):

--8<---------------cut here---------------start------------->8---
(add-hook 'org-capture-prepare-finalize-hook (function my-capture-table= -align))

(defun my-capture-table-align ()
=C2=A0 (forward-line 1) ;; skip the #+name line
=C2=A0 (if (org-at-table-p 'any)
=C2=A0 =C2=A0 =C2=A0 (org-table-align)))
--8<---------------cut here---------------end--------------->8---

--
Nick



--047d7bd6bf1c5eb54a0523a8defc--