From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: showing lists in agenda, and writing org-agenda to a file Date: Sun, 6 Jan 2008 17:17:40 -0800 Message-ID: <18305.32180.980606.710374@erics-mac.local> References: <878x35i535.fsf@novell.com> Reply-To: Eric Schulte Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBgdQ-0005yC-IT for emacs-orgmode@gnu.org; Sun, 06 Jan 2008 20:18:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBgdQ-0005xk-6Y for emacs-orgmode@gnu.org; Sun, 06 Jan 2008 20:18:36 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBgdP-0005xV-Ug for emacs-orgmode@gnu.org; Sun, 06 Jan 2008 20:18:35 -0500 Received: from mxout2.cac.washington.edu ([140.142.33.4]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JBgdP-00028j-GJ for emacs-orgmode@gnu.org; Sun, 06 Jan 2008 20:18:35 -0500 In-Reply-To: <878x35i535.fsf@novell.com> 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: emacs-orgmode@gnu.org 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)