From: Eric Schulte <firstname.lastname@example.org>
To: Darlan Cavalcante Moreira <email@example.com>
Cc: emacs-orgmode <firstname.lastname@example.org>
Subject: Re: How to add content from a file to a table automatically
Date: Wed, 09 Jan 2013 22:10:37 -0700 [thread overview]
Message-ID: <email@example.com> (raw)
In-Reply-To: <firstname.lastname@example.org> (Darlan Cavalcante Moreira's message of "Thu, 10 Jan 2013 00:25:56 -0300")
[-- Attachment #1: Type: text/plain, Size: 928 bytes --]
Darlan Cavalcante Moreira <email@example.com> 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
Interesting question. Here is a partial answer.
If you can write a code block which reads the external file, and then
outputs the desired table, then the attached Org-mode file should work
The following defines a function (`continually-run') which re-runs a
named code block every couple of seconds. Code blocks already handle
the updating of their results every time they are run. See the file
itself for more information. After testing this I will warn that it
caused some weirdness with my cursor in the mini-buffer.
Hope this helps,
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: code-block-rerunner.org --]
[-- Type: text/x-org, Size: 1508 bytes --]
#+Title: Periodically Rerun a Code Block
Here's the lisp code to define a function to continually re-run a code
block. Evaluate the following code block, then =M-x continually-run=,
press ENTER and then type in the name of the code block to continually
run (in this case "date").
#+begin_src emacs-lisp :results silent
(defvar continual-runners nil
"Holds running block timers (so they may be canceled).")
(defun run-block-in-buffer (name buffer)
(with-temp-message (format "re-running %s" name)
(defun continually-run (name)
"Continually run the supplied code block name.
The code block is assumed to be in the current buffer."
(interactive "scode block to continually run: ")
(let ((run-buffer (current-buffer)))
(run-at-time nil 5 'run-block-in-buffer name run-buffer))))
Here's the code block to be continually re-run.
And here are the results which will be continually updated.
: Wed Jan 9 22:04:08 MST 2013
Execute the following to stop all continually updating code blocks.
#+begin_src emacs-lisp :results silent
(mapc #'cancel-timer continual-runners)
[-- Attachment #3: Type: text/plain, Size: 46 bytes --]
next prev parent reply other threads:[~2013-01-10 5:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-10 3:25 How to add content from a file to a table automatically Darlan Cavalcante Moreira
2013-01-10 5:07 ` Usecase for inotify? " Jambunathan K
2013-01-10 18:58 ` Eli Zaretskii
2013-01-10 5:10 ` Eric Schulte [this message]
2013-01-10 18:12 ` Darlan Cavalcante Moreira
2013-01-10 18:27 ` Eric Schulte
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:
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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 public inbox
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).