From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tassilo Horn Subject: Problems with org-mode-hook when files are opened by org-agenda-list Date: Thu, 12 Mar 2009 08:42:25 +0100 Message-ID: <87ocw7p4pq.fsf@thinkpad.tsdh.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LhfYv-0005Bf-Bb for emacs-orgmode@gnu.org; Thu, 12 Mar 2009 03:42:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LhfYu-0005BM-CP for emacs-orgmode@gnu.org; Thu, 12 Mar 2009 03:42:40 -0400 Received: from [199.232.76.173] (port=37512 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LhfYu-0005BJ-3O for emacs-orgmode@gnu.org; Thu, 12 Mar 2009 03:42:40 -0400 Received: from main.gmane.org ([80.91.229.2]:60592 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LhfYt-00086D-Nd for emacs-orgmode@gnu.org; Thu, 12 Mar 2009 03:42:39 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LhfYq-0002gx-AI for emacs-orgmode@gnu.org; Thu, 12 Mar 2009 07:42:36 +0000 Received: from dhcp195.uni-koblenz.de ([141.26.71.195]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Mar 2009 07:42:36 +0000 Received: from tassilo by dhcp195.uni-koblenz.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Mar 2009 07:42:36 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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/