emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: showing lists in agenda, and writing org-agenda to a file
Date: Mon, 07 Jan 2008 02:44:21 +0000	[thread overview]
Message-ID: <87prwefj7e.fsf@bzg.ath.cx> (raw)
In-Reply-To: <18305.32180.980606.710374@erics-mac.local> (Eric Schulte's message of "Sun, 6 Jan 2008 17:17:40 -0800")

Hi Eric,

"Eric Schulte" <schulte.eric@gmail.com> 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	other threads:[~2008-01-07  2:44 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 ` showing lists in agenda, and writing org-agenda to a file Eric Schulte
2008-01-07  2:44   ` Bastien [this message]
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=87prwefj7e.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /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).