emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: emacs-orgmode@gnu.org
Subject: Problems with org-mode-hook when files are opened by org-agenda-list
Date: Thu, 12 Mar 2009 08:42:25 +0100	[thread overview]
Message-ID: <87ocw7p4pq.fsf@thinkpad.tsdh.de> (raw)

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	other threads:[~2009-03-12  7:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12  7:42 Tassilo Horn [this message]
2009-03-12  8:31 ` Problems with org-mode-hook when files are opened by org-agenda-list Carsten Dominik
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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ocw7p4pq.fsf@thinkpad.tsdh.de \
    --to=tassilo@member.fsf.org \
    --cc=emacs-orgmode@gnu.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).