From: "Eric Schulte" <schulte.eric@gmail.com>
To: emacs-orgmode@gnu.org
Subject: showing lists in agenda, and writing org-agenda to a file
Date: Sun, 6 Jan 2008 17:17:40 -0800 [thread overview]
Message-ID: <18305.32180.980606.710374@erics-mac.local> (raw)
In-Reply-To: <878x35i535.fsf@novell.com>
Hi,
I've started using tools to display my org-agenda as part of my
desktop (geektool http://projects.tynsoe.org/en/geektool/ on my Mac,
and conky http://conky.sourceforge.net/ on my linux box). In doing so
I put together the following little function (below), which I though I
would share in the hope that either someone finds it useful, or
someone has already done this and can share a better method of
accomplishing the same (I'm in the early stages of learning elisp).
Also, In some cases I would like to display the entire body of a
subtree in my custom org-agenda view. Specifically subtrees where the
body is a checkbox list...
** TODO Chores [/] at [2008-01-06 Sun 11:40]
- [ ] dishes/kitchen
- [ ] walk patton
- [ ] MITRE (2 hours)
...
Any suggestions for accomplishing this?
Thanks,
Eric
;; dump agenda to file
(defmacro line-length()
"Length of a line in number of characters"
(length (buffer-substring (save-excursion (beginning-of-line) (point))
(save-excursion (end-of-line) (point)))))
(defun org-agenda-to-file (key file-path &optional max-width)
"Write the org-agenda to a specified file. Can be useful for
displaying the agenda outside of emacs. 'key' will be the key
passed to org-agenda, file-path is the path to which the agenda
will be written, and 'max-width' optionally specifies a maximum
line width for the text in the resulting file."
(interactive)
(save-excursion
(save-window-excursion
(let ((org-agenda-window-setup 'reorganize-frame))
(org-agenda "a" key)
(switch-to-buffer "*Org Agenda*")
(write-file file-path)
(org-agenda-quit)
(if max-width
(progn
(find-file file-path)
(dotimes (line (count-lines (point-min) (point-max)))
(goto-line (1+ line))
(if (> (line-length) max-width)
(progn
(move-beginning-of-line 1)
(forward-char max-width)
(delete-char (- (line-length) max-width)))))
(save-buffer)
(kill-buffer (current-buffer))))))))
;; execute with a shell command like this
;; (org-agenda-to-file "a" "~/.desktop-display" 60)
next prev parent reply other threads:[~2008-01-07 1:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-04 22:44 org2hpda now on emacswiki Christian Egli
2008-01-07 1:17 ` Eric Schulte [this message]
2008-01-07 2:44 ` showing lists in agenda, and writing org-agenda to a file Bastien
2008-01-07 3:34 ` Bastien
2008-01-12 18:46 ` Eric Schulte
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18305.32180.980606.710374@erics-mac.local \
--to=schulte.eric@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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).