From: Steinar Bang <sb@dod.no>
Subject: Re: Find tick state from gnus-article-prepare-hook?
Date: Sun, 10 Oct 2004 23:13:05 +0200 [thread overview]
Message-ID: <87brfaqntq.fsf@dod.no> (raw)
In-Reply-To: <87k6tzswib.fsf@dod.no>
>>>>> Steinar Bang <sb@dod.no>:
> I tried using gnus-mark-article-hook instead, since this hook is
> called from the summary buffer, in what seems to be the appropriate
> moment.
> But with the code below, I am asked if I wish to save the diary
> entry on an unread article. But the article is never marked read.
The reason this happens, is that when I do
(add-hook 'gnus-mark-article-hook 'my-gnus-check-outlook)
I overwrite the original value of `gnus-mark-article-hook', which is
`(gnus-summary-mark-read-and-unread-as-read)'. This is not what I
expected when calling add-hook. I would expect my new function to be
added to the hook.
I think defcustom's handling of hook variables, is wrong. At least
the way it's done in XEmacs 21.4.
In any case, the below code works for me, for using code in u-appt.el
to scan unread articles in Gnus, for Outlook invitations.
Though I should probably find a less fragile hook, one where the
current mark setting doesn't depend on the position in the hook list.
Here's the code:
(defun my-gnus-check-outlook ()
"Run from a hook to check new messages in Gnus for Outlook appointment
invitations, and offer to save them in the diary."
(save-excursion
(let ((mark (gnus-summary-article-mark)))
(when (gnus-unread-mark-p mark)
(set-buffer gnus-article-buffer)
(u-appt-check-outlook)))))
; Check for Outlook invitations in unread messages
(add-hook 'gnus-mark-article-hook 'my-gnus-check-outlook)
; Add the original value of gnus-mark-article-hook, since this
; is overwritten by the above add-hook.
; Add it at the end, since it sets the mark to read.
(add-hook 'gnus-mark-article-hook 'gnus-summary-mark-read-and-unread-as-read t)
prev parent reply other threads:[~2004-10-10 21:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-09 15:31 Steinar Bang
2004-10-09 16:10 ` Steinar Bang
2004-10-09 16:42 ` Steinar Bang
2004-10-10 21:13 ` Steinar Bang [this message]
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=87brfaqntq.fsf@dod.no \
--to=sb@dod.no \
/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.
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 NNTP newsgroup(s).