emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Problems with org-mode-hook when files are opened by org-agend


From: Tassilo Horn
Subject: [Orgmode] Problems with org-mode-hook when files are opened by org-agenda-list
Date: Thu, 12 Mar 2009 08:42:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux)

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

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/





reply via email to

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