From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/58798 Path: main.gmane.org!not-for-mail From: Steinar Bang Newsgroups: gmane.emacs.gnus.general Subject: Re: Find tick state from gnus-article-prepare-hook? Date: Sun, 10 Oct 2004 23:13:05 +0200 Organization: Probably a good idea Sender: ding-owner@lists.math.uh.edu Message-ID: <87brfaqntq.fsf@dod.no> References: <87oejbsyaq.fsf@dod.no> <87k6tzswib.fsf@dod.no> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: sea.gmane.org 1097442906 12196 80.91.229.6 (10 Oct 2004 21:15:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 10 Oct 2004 21:15:06 +0000 (UTC) Original-X-From: ding-owner+M7335@lists.math.uh.edu Sun Oct 10 23:14:52 2004 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13] ident=mail) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CGl1o-0000cl-00 for ; Sun, 10 Oct 2004 23:14:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1CGl0N-00067E-00; Sun, 10 Oct 2004 16:13:23 -0500 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1CGl0G-000678-00 for ding@lists.math.uh.edu; Sun, 10 Oct 2004 16:13:16 -0500 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by util2.math.uh.edu with esmtp (Exim 4.30) id 1CGl0E-0007N1-Ss for ding@lists.math.uh.edu; Sun, 10 Oct 2004 16:13:14 -0500 Original-Received: from main.gmane.org (main.gmane.org [80.91.229.2]) by justine.libertine.org (Postfix) with ESMTP id AE6333A0059 for ; Sun, 10 Oct 2004 16:13:11 -0500 (CDT) Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1CGl08-00078B-00 for ; Sun, 10 Oct 2004 23:13:08 +0200 Original-Received: from cm-80.111.90.110.chello.no ([80.111.90.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 10 Oct 2004 23:13:08 +0200 Original-Received: from sb by cm-80.111.90.110.chello.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 10 Oct 2004 23:13:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Original-To: ding@gnus.org Original-Lines: 43 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: cm-80.111.90.110.chello.no Mail-Copies-To: never User-Agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:MSi6hv25tcKvEK2+IKN742qsVOA= Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:58798 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:58798 >>>>> Steinar Bang : > 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)