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