From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Advanced table Date: Tue, 29 Sep 2009 13:15:42 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsiB0-0004fS-AA for emacs-orgmode@gnu.org; Tue, 29 Sep 2009 15:15:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsiAu-0004f8-UB for emacs-orgmode@gnu.org; Tue, 29 Sep 2009 15:15:53 -0400 Received: from [199.232.76.173] (port=33473 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsiAu-0004f5-NS for emacs-orgmode@gnu.org; Tue, 29 Sep 2009 15:15:48 -0400 Received: from mail-px0-f202.google.com ([209.85.216.202]:57513) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MsiAt-0003qg-WF for emacs-orgmode@gnu.org; Tue, 29 Sep 2009 15:15:48 -0400 Received: by pxi40 with SMTP id 40so6597147pxi.24 for ; Tue, 29 Sep 2009 12:15:47 -0700 (PDT) In-Reply-To: (andrea Crotti's message of "Sat, 26 Sep 2009 13:20:31 +0000 (UTC)") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: andrea Crotti Cc: emacs-orgmode@gnu.org 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 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