[Top][All Lists]

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

Re: [Orgmode] Problems with org-mode-hook when files are opened by org-a

From: Carsten Dominik
Subject: Re: [Orgmode] Problems with org-mode-hook when files are opened by org-agenda-list
Date: Thu, 12 Mar 2009 09:31:53 +0100

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)
     (let ((file "/tmp/org-agenda.txt"))
       (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

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


Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.

reply via email to

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