From: Carsten Dominik <dominik@science.uva.nl>
To: Tassilo Horn <tassilo@member.fsf.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Problems with org-mode-hook when files are opened by org-agenda-list
Date: Thu, 12 Mar 2009 09:31:53 +0100 [thread overview]
Message-ID: <BB2B1889-3A8D-4EAE-8E29-32A90CAB692A@uva.nl> (raw)
In-Reply-To: <87ocw7p4pq.fsf@thinkpad.tsdh.de>
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
next prev parent reply other threads:[~2009-03-12 8:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-12 7:42 Problems with org-mode-hook when files are opened by org-agenda-list Tassilo Horn
2009-03-12 8:31 ` Carsten Dominik [this message]
2009-03-12 16:02 ` Tassilo Horn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BB2B1889-3A8D-4EAE-8E29-32A90CAB692A@uva.nl \
--to=dominik@science.uva.nl \
--cc=emacs-orgmode@gnu.org \
--cc=tassilo@member.fsf.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.