emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Advanced table


From: Eric Schulte
Subject: Re: [Orgmode] Advanced table
Date: Tue, 29 Sep 2009 13:15:42 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (darwin)

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 <address@hidden> 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(@address@hidden)) 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.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode




reply via email to

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