[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] insert aligned table using capture template
From: |
Nick Dokos |
Subject: |
Re: [O] insert aligned table using capture template |
Date: |
Tue, 03 Nov 2015 15:28:02 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
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