* insert aligned table using capture template
@ 2015-11-03 19:01 Shankar Rao
2015-11-03 20:28 ` Nick Dokos
0 siblings, 1 reply; 3+ messages in thread
From: Shankar Rao @ 2015-11-03 19:01 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 663 bytes --]
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)
...))
[-- Attachment #2: Type: text/html, Size: 1916 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: insert aligned table using capture template
2015-11-03 19:01 insert aligned table using capture template Shankar Rao
@ 2015-11-03 20:28 ` Nick Dokos
2015-11-03 20:37 ` Shankar Rao
0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2015-11-03 20:28 UTC (permalink / raw)
To: emacs-orgmode
Shankar Rao <shankar.rao@gmail.com> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: insert aligned table using capture template
2015-11-03 20:28 ` Nick Dokos
@ 2015-11-03 20:37 ` Shankar Rao
0 siblings, 0 replies; 3+ messages in thread
From: Shankar Rao @ 2015-11-03 20:37 UTC (permalink / raw)
To: Nick Dokos; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1506 bytes --]
Oops.
(set org-capture-templates '(...
should be
(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> 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
>
>
>
[-- Attachment #2: Type: text/html, Size: 2448 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-03 20:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-03 19:01 insert aligned table using capture template Shankar Rao
2015-11-03 20:28 ` Nick Dokos
2015-11-03 20:37 ` Shankar Rao
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).