From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.devel,gmane.emacs.orgmode Subject: Usecase for inotify? Re: How to add content from a file to a table automatically Date: Thu, 10 Jan 2013 10:37:19 +0530 Message-ID: <87a9shaans.fsf@gmail.com> References: <50ee34c8.09fb640a.6b64.0e5a@mx.google.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1357794479 20450 80.91.229.3 (10 Jan 2013 05:07:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 10 Jan 2013 05:07:59 +0000 (UTC) Cc: emacs-orgmode , emacs-devel@gnu.org To: Darlan Cavalcante Moreira Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 10 06:08:16 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TtAND-0002AB-7b for ged-emacs-devel@m.gmane.org; Thu, 10 Jan 2013 06:08:15 +0100 Original-Received: from localhost ([::1]:40084 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtAMx-0001bI-6r for ged-emacs-devel@m.gmane.org; Thu, 10 Jan 2013 00:07:59 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtAMl-00014t-1X for emacs-devel@gnu.org; Thu, 10 Jan 2013 00:07:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtAMi-0004qJ-S6 for emacs-devel@gnu.org; Thu, 10 Jan 2013 00:07:45 -0500 Original-Received: from mail-pb0-f43.google.com ([209.85.160.43]:55273) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtAMg-0004pe-3u; Thu, 10 Jan 2013 00:07:42 -0500 Original-Received: by mail-pb0-f43.google.com with SMTP id um15so90388pbc.16 for ; Wed, 09 Jan 2013 21:07:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=LopeosGP2u67K0PNUAZue++wwwU7pp1gP4dxKM4Ay9Y=; b=fuXU5Unyqgf2zgtxwJzgVsrpcP9GGdYJwTrYQKE+2TZzuEZliSmke+qJhBmEIXpK1T I/vKQR++16biqIEf0iFcOGJBc0YVMja0pyvCebtS3TG1OWyqj/uzwkO9I8HKda8e3hH6 +3l7zZ1LVrLJF5AqmMmwWv2RC3yQ71pwLNUDS27NPdGj4va5ha6nGEM5dMWlI1/8KMP8 +ileTaA+JW8vNyLeoD+RDLJve1lOdZxwMqtneN0+m4pQCcbrT36FEnSEvIEOlmhZ/ATF dacdcl0w3+ef62mZtbtlvEDgETilJGt43YxSxfWX41GUK7/oSD3FdDkFc5szG7m8mrXV TF/w== X-Received: by 10.68.253.1 with SMTP id zw1mr61235587pbc.98.1357794461369; Wed, 09 Jan 2013 21:07:41 -0800 (PST) Original-Received: from debian-6.05 ([101.62.81.47]) by mx.google.com with ESMTPS id wg3sm239869pbc.28.2013.01.09.21.07.37 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 09 Jan 2013 21:07:40 -0800 (PST) In-Reply-To: <50ee34c8.09fb640a.6b64.0e5a@mx.google.com> (Darlan Cavalcante Moreira's message of "Thu, 10 Jan 2013 00:25:56 -0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.160.43 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:156179 gmane.emacs.orgmode:64473 Archived-At: There is support for inotify in Emacs. Last I heard, people were interested in hearing use-cases. I am not sure it qualifies as a minimal use-case. But it is something that comes out of real life. So here it goes to emacs-devel... Darlan Cavalcante Moreira writes: > Is there a way to detect when a file changes and then add the content from > it (if any, the file could be empty) to a specified org-mode table? Each > line in that file is already constructed in a way that it could be copied > and pasted to the table directly (but I can change that if it makes things > easier). > > For instance, suppose I have the table below > > > #+TBLNAME: FoodJanuary2013 > | | *Place* | *Date* | *Debit (R$)* | *Credit (R$)* | > |---+-----------+------------------+--------------+---------------| > | | Some name | [2013-01-07 Seg] | 0.00 | 10.00 | > |---+-----------+------------------+--------------+---------------| > | # | | *Total* | 0.00 | 10.00 | > #+TBLFM: @3$4=vsum(@2..@-1);%.2f::@3$5=vsum(@2..@-1);%.2f > > > and a file "food.txt" that was modified externally (Dropbox sync) and now > has the content below > > > | # | place name | [2013-01-08 Ter] | 0.00 | 12.50 | > | # | other place | [2013-01-09 Qua] | 9.30 | 0.00 | > > > I'd like the table to be automatically updated to include these two new > lines so that it should now corresponds to > > > #+TBLNAME: FoodJanuary2013 > | | *Place* | *Date* | *Debit (R$)* | *Credit (R$)* | > |---+-------------+------------------+--------------+---------------| > | | Some name | [2013-01-09 Qua] | 0.00 | 10.00 | > | # | place name | [2013-01-08 Ter] | 0.00 | 12.50 | > | # | other place | [2013-01-09 Qua] | 9.30 | 0.00 | > |---+-------------+------------------+--------------+---------------| > | # | | *Total* | 9.30 | 22.50 | > #+TBLFM: @5$4=vsum(@2..@-1);%.2f::@5$5=vsum(@2..@-1);%.2f > > > Adapting the formula as org-mode would automatically do if I typed enter > twice before the last hline is important, but updating the total value is > not (although nice), since I can do that with "C-u C-u C-c *" later when I > actually see the table. > > After that the content of the file should be erased to prevent future > additions of the same information. > > Any hints on how to do the different parts for this are welcome. > > -- > Darlan > > Ps: I use the latest org-mode and Emacs versions (from git and bzr, > respectively) in a Linux box. > > > The motivation for all this is that I use org-mode tables to control my > expenses, but I want to be able to add new expenses from my android > phone. Using the "tasker" app (REALLY good) I could create a simple UI to > add the expense to a file that will be synced using Dropbox (one file for > each category, which corresponds to a different table). All of this is > working and now I the next step is the one described in this e-mail. > > --