emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org2hpda now on emacswiki
@ 2008-01-04 22:44 Christian Egli
  2008-01-07  1:17 ` showing lists in agenda, and writing org-agenda to a file Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Egli @ 2008-01-04 22:44 UTC (permalink / raw)
  To: emacs-orgmode


A while ago I posted a Makefile to generate pocketmod and hpda (hipster
PDA) printouts from your calendar and diary. I put the code up on the
emacs wiki. It can be found under
http://www.emacswiki.org/cgi-bin/wiki/CalendarPrinting.

While I was at it I renamed it to org2hpda because pocketmod might have
trade mark problems and has a patent pending.

Christian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* showing lists in agenda, and writing org-agenda to a file
  2008-01-04 22:44 org2hpda now on emacswiki Christian Egli
@ 2008-01-07  1:17 ` Eric Schulte
  2008-01-07  2:44   ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2008-01-07  1:17 UTC (permalink / raw)
  To: emacs-orgmode

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)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: showing lists in agenda, and writing org-agenda to a file
  2008-01-07  1:17 ` showing lists in agenda, and writing org-agenda to a file Eric Schulte
@ 2008-01-07  2:44   ` Bastien
  2008-01-07  3:34     ` Bastien
  2008-01-12 18:46     ` Eric Schulte
  0 siblings, 2 replies; 5+ messages in thread
From: Bastien @ 2008-01-07  2:44 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: showing lists in agenda, and writing org-agenda to a file
  2008-01-07  2:44   ` Bastien
@ 2008-01-07  3:34     ` Bastien
  2008-01-12 18:46     ` Eric Schulte
  1 sibling, 0 replies; 5+ messages in thread
From: Bastien @ 2008-01-07  3:34 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

Bastien <bzg@altern.org> writes:

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

Sorry, typos, should read:

(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-line-width (put-file-content-in-procustes-bed
		      file max-line-width)))

-- 
Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: showing lists in agenda, and writing org-agenda to a file
  2008-01-07  2:44   ` Bastien
  2008-01-07  3:34     ` Bastien
@ 2008-01-12 18:46     ` Eric Schulte
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Schulte @ 2008-01-12 18:46 UTC (permalink / raw)
  To: emacs-orgmode

Hi Bastien,

Thanks for the code re-write. Here's a link to my org-agenda displayed
on my linux laptop's desktop.

http://picasaweb.google.com/eric.no.spam.please/Screenshots/photo#5154659714810419410

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

Understandable, my only motivation here was to have the checkbox lists
available on my desktop display, but that can be more easily
accomplished through modification of the functions below, rather than
creating a new agenda view.

Thanks!
Eric

On Monday, January 7, at 02:44, Bastien wrote:
 > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-01-12 18:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2008-01-07  3:34     ` Bastien
2008-01-12 18:46     ` Eric Schulte

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