From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/45082 Path: main.gmane.org!not-for-mail From: Simon Josefsson Newsgroups: gmane.emacs.gnus.general Subject: Re: Two gnus-posting-styles problems Date: Mon, 03 Jun 2002 20:23:25 +0200 Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1023128695 12386 127.0.0.1 (3 Jun 2002 18:24:55 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 3 Jun 2002 18:24:55 +0000 (UTC) Cc: bugs@gnus.org (The Gnus Bugfixing Girls + Boys), ding@gnus.org Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17EwVi-0003Df-00 for ; Mon, 03 Jun 2002 20:24:54 +0200 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 17EwUj-0007T4-00; Mon, 03 Jun 2002 13:23:53 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 03 Jun 2002 13:24:10 -0500 (CDT) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id NAA29772 for ; Mon, 3 Jun 2002 13:23:50 -0500 (CDT) Original-Received: (qmail 16194 invoked by alias); 3 Jun 2002 18:23:27 -0000 Original-Received: (qmail 16187 invoked from network); 3 Jun 2002 18:23:26 -0000 Original-Received: from 178.230.13.217.in-addr.dgcsystems.net (HELO yxa.extundo.com) (217.13.230.178) by gnus.org with SMTP; 3 Jun 2002 18:23:26 -0000 Original-Received: from latte.josefsson.org (yxa.extundo.com [217.13.230.178]) (authenticated bits=0) by yxa.extundo.com (8.12.3/8.12.3) with ESMTP id g53INOWa010615; Mon, 3 Jun 2002 20:23:25 +0200 Original-To: Hrvoje Niksic Mail-Copies-To: nobody In-Reply-To: (Hrvoje Niksic's message of "Mon, 03 Jun 2002 19:49:38 +0200") Original-Lines: 71 User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2.90 (i686-pc-linux-gnu) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:45082 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:45082 Hrvoje Niksic writes: > Simon Josefsson writes: > >> Perhaps >> >> ((header "from" "redhat.com") >> (address "hniksic@redhat.com")) >> >> is useful? > > It's an improvement, but it doesn't solve the #1a problem. No, the #1a problem is probably a bug and the patch solves it. > I have yet to try your patch. Can you explain what it is supposed to > do? I'm not sure I understand the intention from reading the patch. I see now that the patch accidently included an unrelated patch. The point of the patch was simply to bind gnus-article-copy to nil in all places where you aren't following up or replying to an article -- e.g., when pressing `a' or `m'. If the variable is nil, the posting styles code won't use the last viewed buffer. >>> 2. I tried to fix #1 by explicitly matching the stuff from the Message >>> buffer, like this: >>> >>> ((and (message-fetch-field "to") >>> (string-match "redhat\\.com" (message-fetch-field "to"))) >>> (address "hniksic@redhat.com")) >>> >>> But that didn't work because `gnus-configure-posting-styles' is >>> called from `message-mode-hook', which gets run when the Message >>> buffer is still completely empty. It should be called at a later >>> stage, when the buffer has already been set up. >> >> There's a dependency problem here, not all functions that use >> information from the message buffer and modify the contents of the >> message buffer can be called last. I think the ordering has changed >> several times, but it won't ever satisfy everyone. I think the >> approach should be that you shouldn't count on information being >> available in the message buffers unless... err, it is available. > > I'm not sure I understand this. Why can't it satisfy everyone? What > is the position opposite to mine? There are alot of hooks and functions that people use to populate message buffers: message-mode-hook, message-setup-hook, gnus-message-setup-hook, gnus-posting-styles, making user-mail-address context sensitive, defadvice etc. If we change the ordering the way you want, the posting style is applied last, which makes it possible to extract To/From etc from the newly composed message. But the same change will affect code added to, say, message-setup-hook, since it no longer can extract the fields added by the posting styles code. Some code need to be called last, and changing the order now means people will have to use different hooks depending on which Gnus version they use and how it implements this. To be concrete: Consider someone using message-setup-hook to extract from headers and insert something else AND then uses posting styles, and relies on it being called in that order will be surprised. (Now I don't know if message-setup-hook really is called before applying posting styles, but I'm sure there are such hooks.) That said, perhaps changing it to apply posting styles last is good, but it seems difficult to tell what harm to people's customizations it will generate. Leaving it as is doesn't hurt anything, it seems, it only forces you to write your customization in another way. And since your proposed customization didn't use anything promised by documentation (did it?), the conservative approach would be to leave the call order as is.