From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shankar Rao Subject: insert aligned table using capture template Date: Tue, 3 Nov 2015 11:01:12 -0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113d394478c2880523a784b8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtgpW-0004MV-9Z for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 14:01:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtgpV-0005bi-EP for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 14:01:14 -0500 Received: from mail-oi0-x236.google.com ([2607:f8b0:4003:c06::236]:34492) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtgpV-0005bd-9O for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 14:01:13 -0500 Received: by oies66 with SMTP id s66so14506795oie.1 for ; Tue, 03 Nov 2015 11:01:12 -0800 (PST) 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 --001a113d394478c2880523a784b8 Content-Type: text/plain; charset=UTF-8 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) ...)) --001a113d394478c2880523a784b8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
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
<= font face=3D"monospace, monospace">=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 | Calc= ulations |\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 ...))

<= /div>
--001a113d394478c2880523a784b8-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: insert aligned table using capture template Date: Tue, 03 Nov 2015 15:28:02 -0500 Message-ID: <87611ikeul.fsf@alphaville.usersys.redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtiBj-0003ge-Hz for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 15:28:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtiBg-0002Gx-BB for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 15:28:15 -0500 Received: from plane.gmane.org ([80.91.229.3]:47667) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtiBf-0002Gt-QY for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 15:28:11 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZtiBe-0006FC-OB for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 21:28:10 +0100 Received: from pool-108-20-41-232.bstnma.fios.verizon.net ([108.20.41.232]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 03 Nov 2015 21:28:10 +0100 Received: from ndokos by pool-108-20-41-232.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 03 Nov 2015 21:28:10 +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 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 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--