On Mar 12, 2009, at 8:42 AM, Tassilo Horn wrote:

Hi all,

I want that each time I startup emacs and each time I change a org file,
the agenda for this week should be exported to /tmp/org-agenda.txt.  I
use this file for creating an agenda popup in my window manager [1]

To achive that, I use the following code:

--8<---------------cut here---------------start------------->8---
(require 'org-install)
(eval-after-load 'org
 '(require 'org-id))

[...]

(defun th-org-mode-init ()
 [...]
 (add-hook 'after-save-hook 'th-org-update-agenda-file t t))

[...]

(defun th-org-update-agenda-file (&optional force)
 (interactive)
 (save-excursion
   (save-window-excursion
     (let ((file "/tmp/org-agenda.txt"))
       (org-agenda-list)
       (org-write-agenda file)))))

(th-org-update-agenda-file t)

(add-hook 'org-mode-hook 'th-org-mode-init)
--8<---------------cut here---------------end--------------->8---

I think you need to swap the last two lines.  During the first
call to your update function (and therefore during
the first creation of an agenda which will find all the agenda
files), the org-mode-hook has not yet been modified.

- Carsten


When I start emacs now the file /tmp/org-agenda.txt is created by the
call to `th-org-update-agenda-file'.  But in all org buffers the value
of `after-save-hook' is nil, although it should contain
`th-org-update-agenda-file'.

When I revert the org buffers, the function is correctly added.

So it seems to me that when org files are opened by `org-agenda-list'
the `org-mode-hook' is skipped somehow.  Am I right and is this
intended?

Bye,
Tassilo
__________
[1] 
http://tsdh.wordpress.com/2009/03/04/integrating-emacs-org-mode-with-the-awesome-window-manager/



_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode



_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to