emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] insert aligned table using capture template


From: Shankar Rao
Subject: Re: [O] insert aligned table using capture template
Date: Tue, 3 Nov 2015 12:37:55 -0800

Oops.

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

should be 

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



On Tue, Nov 3, 2015 at 12:28 PM, Nick Dokos <address@hidden> wrote:
Shankar Rao <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]