From: "Eric Schulte" <schulte.eric@gmail.com>
To: andrea Crotti <andrea.crotti.0@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Advanced table
Date: Tue, 29 Sep 2009 13:15:42 -0600 [thread overview]
Message-ID: <m2r5tp7eap.fsf@gmail.com> (raw)
In-Reply-To: <loom.20090926T151838-359@post.gmane.org> (andrea Crotti's message of "Sat, 26 Sep 2009 13:20:31 +0000 (UTC)")
Hi,
Using Org-babel the following source-code block could prove at least a
partial solution.
--8<---------------cut here---------------start------------->8---
#+begin_src emacs-lisp
(let ((total 0) (responding t) purchases)
(while responding
(setq purchases
(cons
(list ""
(read-from-minibuffer "What: ")
(read-from-minibuffer "Where: ")
(read-minibuffer "How Much: "))
purchases))
(setq responding (y-or-n-p "more? ")))
(append
purchases
(list
(list
(format-time-string "%Y-%m-%d" (current-time))
"" "" (progn
(mapc (lambda (purchase)
(setq total (+ total (fourth purchase))))
purchases)
total)))))
#+end_src
--8<---------------cut here---------------end--------------->8---
With Org-babel loaded, simply evaluate the block (press C-c C-c with the
cursor on/in the block) and the desired table portion will be placed
into your Org-mode file. At the moment I can't recall how to remove the
quotes from the strings, but it should certainly be doable.
with slight modification it would also be possible to append the table
to an existing table, etc...
Best -- Eric
andrea Crotti <andrea.crotti.0@gmail.com> writes:
> I was trying to write down everything I spend and where I do, so I set up this simple table.
> So basically every day I have some expenses and on top I have the total.
>
> If the pattern is always the same (vsum(@+I..@+II)) I would like to have that formula every time I add a
> new thing.
>
> Now supposing that I always write the same day I pay best thing would be to have an automatic system
> that asks me the various fields and insert them in the table, does it make sense?
>
>
> | DATA | WHAT | WHERE | HOW MUCH |
> |------------------+------------+-------------+----------|
> | [2009-09-25 Fri] | | | 28.95 |
> |------------------+------------+-------------+----------|
> | | food | supermarket | 7.85 |
> | | ticket bus | | 2.3 |
> | | tea + ice | ice uno | 4.4 |
> | | ticket | | 14.4 |
> |------------------+------------+-------------+----------|
> | [2009-09-26 Sat] | | | 41 |
> ...
>
> This was an example of the data. I'm not quite sure that this data structure would be later easy to
> manipulate, what do you think?
> Better solutions??
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
prev parent reply other threads:[~2009-09-29 19:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-26 13:20 Advanced table andrea Crotti
2009-09-29 19:15 ` Eric Schulte [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2r5tp7eap.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=andrea.crotti.0@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.