From: Tassilo Horn <tassilo@member.fsf.org>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Help debugging a problem when saving org-agenda files with C-x s
Date: Thu, 14 May 2009 18:43:15 +0200 [thread overview]
Message-ID: <87skj7prdo.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: <B5F003F2-26E4-4648-9D77-D220610932F8@gmail.com> (Carsten Dominik's message of "Thu, 14 May 2009 16:17:34 +0200")
Carsten Dominik <carsten.dominik@gmail.com> writes:
Hi Carsten,
>> --8<---------------cut here---------------start------------->8---
>> (defun th-org-mode-init ()
>> (add-hook 'after-save-hook 'th-org-update-agenda-file t t))
>>
>> (add-hook 'org-mode-hook 'th-org-mode-init)
>>
>> ;; TODO: This errors when calling C-x s after modifying things in the agenda.
>> (defun th-org-update-agenda-file (&optional force)
>> (interactive)
>> (when (and (eq major-mode 'org-mode)
>> (member buffer-file-name org-agenda-files))
>> (save-excursion
>> (save-window-excursion
>> (let ((file "/tmp/org-agenda.txt"))
>> (org-agenda-list)
>> (org-write-agenda file))))))
>> --8<---------------cut here---------------end--------------->8---
>>
>> This works fine when I save an agenda file while in its buffer, but
>> when I edit the file via agenda commands and hit `C-x s', I'm asked
>> if I want to save "/home/horn/repos/org/uni.org" and say yes, I get
>> this error:
>
> This probably happens because you are relying on org-agenda-list which
> is supposed to display the agenda window and in this way set the
> selected window and buffer. In non-interactive use, the buffer is
> created, but display is delayed until after the next idle moment.
>
> Not tested, but this may help:
>
> Replace (org-agenda-write) with this:
>
> (with-current-buffer org-agenda-buffer-name (org-write-agenda file))
No, I'm sorry. I still get the error, and it's already triggered in the
call to `org-agenda-list' before `org-write-agenda' is called. The
error is thrown in `org-agenda-get-day-entries'.
Bye,
Tassilo
next prev parent reply other threads:[~2009-05-14 16:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-13 6:12 Help debugging a problem when saving org-agenda files with C-x s Tassilo Horn
2009-05-13 8:55 ` Tassilo Horn
2009-05-14 14:17 ` Carsten Dominik
2009-05-14 16:43 ` Tassilo Horn [this message]
2009-05-14 17:28 ` Carsten Dominik
2009-05-14 18:41 ` Tassilo Horn
2009-05-16 15:14 ` Carsten Dominik
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=87skj7prdo.fsf@thinkpad.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=carsten.dominik@gmail.com \
--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).