emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] showing lists in agenda, and writing org-agenda to a file


From: Bastien
Subject: Re: [Orgmode] showing lists in agenda, and writing org-agenda to a file
Date: Mon, 07 Jan 2008 02:44:21 +0000
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.0 (gnu/linux)

Hi Eric,

"Eric Schulte" <address@hidden> writes:

> 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).  

Great!  That looks neat.

> 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).

Here is a slight rewrite of your code:

;; Use (current-column)
(defun current-line-length ()
  "Length of a the line at point."
  (save-excursion (end-of-line) (current-column)))

;; Use (org-write-agenda file)
(defun org-agenda-to-file (key file &optional max-line-width)
  "Write the `org-agenda' view associated with KEY to FILE.
MAX-LINE-WIDTH optionally specifies the maximum line width for
the text in the resulting file."
  (interactive)
  (save-window-excursion
    (org-agenda nil key)
    (switch-to-buffer "*Org Agenda*")
    (org-write-agenda file)
    (org-agenda-quit))
  (if max-width (put-file-content-in-procustes-bed
                 file max-line-length)))

;; Use a separate torture function for this
(defun put-file-content-in-procustes-bed (file max-line-width)
  "Find FILE and cut anything beyond LINE-WIDTH."
  (save-window-excursion
    (with-temp-buffer
      (find-file file)
      (kill-rectangle
       (point-min) 
       (progn (point-max) 
              (move-to-column max-line-width t)
              (point)))
      (erase-buffer)
      (yank-rectangle)
      (write-file file))))

Here is what the associated shell script would look like:

--8<---------------cut here---------------start------------->8---
#!/bin/bash

/usr/local/bin/emacs-23.0.0 --batch --eval \
"(progn (load-file \"~/elisp/testing/org/org.el\") \
        (org-agenda-to-file \"a\" \"~/.desktop-display\" 60))"
--8<---------------cut here---------------end--------------->8---

BTW, do you have any screenshot showing geektool/conky in action? 

> 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...

It's not possible right now.  I wonder if this would be useful.  The
purpose of the agenda view is to give you a quick overview of your
tasks, not to burden souls with details...

In agenda mode, you can see the item at point with SPC and you can turn
follow mode on -- this will display the subtree at point.

Thanks for the code!

-- 
Bastien




reply via email to

[Prev in Thread] Current Thread [Next in Thread]