unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* rmail-message-filter
@ 2009-03-03  4:23 Glenn Morris
  2009-03-03 18:44 ` rmail-message-filter Eli Zaretskii
  2009-03-04  8:51 ` rmail-message-filter Richard M Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Glenn Morris @ 2009-03-03  4:23 UTC (permalink / raw)
  To: emacs-devel


rmail-message-filter is an option in rmail.el. Post-mbox, it does nothing.
Previously, it was called:

 i) the very first time a message was shown.
ii) when toggling the headers to the normal state, every time.

It's not clear what it should do now, since there is nothing that
records when a message is shown for the first time (unseen is not
necessarily the same thing).

Should it do something (every time a message is shown? when the unseen
attribute is removed? when new mail is gotten), or be removed?




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: rmail-message-filter
  2009-03-03  4:23 rmail-message-filter Glenn Morris
@ 2009-03-03 18:44 ` Eli Zaretskii
  2009-03-03 20:06   ` rmail-message-filter Glenn Morris
  2009-03-04  8:51 ` rmail-message-filter Richard M Stallman
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2009-03-03 18:44 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

> From: Glenn Morris <rgm@gnu.org>
> Date: Mon, 02 Mar 2009 23:23:51 -0500
> 
> 
> rmail-message-filter is an option in rmail.el. Post-mbox, it does nothing.
> Previously, it was called:
> 
>  i) the very first time a message was shown.
> ii) when toggling the headers to the normal state, every time.
> 
> It's not clear what it should do now, since there is nothing that
> records when a message is shown for the first time (unseen is not
> necessarily the same thing).

How is unseen different from the first time? weren't they synonyms in
pre-mbox Rmail?

> Should it do something (every time a message is shown? when the unseen
> attribute is removed? when new mail is gotten), or be removed?

I'd say call it when the unseen attribute is removed.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: rmail-message-filter
  2009-03-03 18:44 ` rmail-message-filter Eli Zaretskii
@ 2009-03-03 20:06   ` Glenn Morris
  2009-03-03 20:59     ` rmail-message-filter Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2009-03-03 20:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii wrote:

> How is unseen different from the first time? weren't they synonyms in
> pre-mbox Rmail?

I never used it, but apparently not.

When you first get a mail, the Babyl header for that message reads:

0, unseen,,

When you read the mail, it changes to:

1,,

If you move to another message, then put back the unseen attribute on
the message you just looked at, eg:

(rmail-set-attribute "unseen" t 1)

it changes to:

1, unseen,,

The leading 0/1 appears to mean "has this message ever been reformatted?".
There is no equivalent flag in mbox. rmail-message-filter was
basically called whenever that flag changed from 0 to 1.

> I'd say call it when the unseen attribute is removed.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: rmail-message-filter
  2009-03-03 20:06   ` rmail-message-filter Glenn Morris
@ 2009-03-03 20:59     ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2009-03-03 20:59 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Eli Zaretskii, emacs-devel

> The leading 0/1 appears to mean "has this message ever been reformatted?".
> There is no equivalent flag in mbox.  rmail-message-filter was
> basically called whenever that flag changed from 0 to 1.

We could add a "processed" attribute specifically for that purpose.

>> I'd say call it when the unseen attribute is removed.

This may also be sufficient.
It all depends on what that hook was used for.

Google shows that it's used by rmailmime.el.  For that use at least, it
would (now) need to be called every time the message is displayed
(because the output of that hook may not be properly formatted to be
put back into the mbox file).


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: rmail-message-filter
  2009-03-03  4:23 rmail-message-filter Glenn Morris
  2009-03-03 18:44 ` rmail-message-filter Eli Zaretskii
@ 2009-03-04  8:51 ` Richard M Stallman
  2009-03-04 22:18   ` rmail-message-filter Glenn Morris
  1 sibling, 1 reply; 7+ messages in thread
From: Richard M Stallman @ 2009-03-04  8:51 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

    rmail-message-filter is an option in rmail.el. Post-mbox, it does nothing.
    Previously, it was called:

     i) the very first time a message was shown.
    ii) when toggling the headers to the normal state, every time.

In other words, it was called whenever headers were pruned.

The analogous time to call it is whenever rmail-show-message
displays a message (except when it displays the whole header).




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: rmail-message-filter
  2009-03-04  8:51 ` rmail-message-filter Richard M Stallman
@ 2009-03-04 22:18   ` Glenn Morris
  2009-03-04 23:29     ` rmail-message-filter Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2009-03-04 22:18 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard M Stallman wrote:

> In other words, it was called whenever headers were pruned.

If only the documentation was this clear.

"a filter function for new messages"

> The analogous time to call it is whenever rmail-show-message
> displays a message (except when it displays the whole header).

The simple thing would be to call it at the end of rmail-copy-headers,
whenever rmail-header-style is not 'full. However

i) I don't see that this offers anything that rmail-show-message-hook
does not.

ii) This is not exactly the same as the old behaviour, since
previously pruning was not necessarily done every time a message was
shown (if the previous time it was shown it was pruned).

Also, it's documented to behave as:

   Called with region narrowed to the message, including headers,
   before obeying `rmail-ignored-headers'."

To recreate the "before obeying `rmail-ignored-headers'" part would
require something like the following. But it seems dangerous to me to
mess about with the real rmail buffer rather than the "view" copy.

Without knowing what this function was used for, it seems like
rmail-show-message-hook is a better thing to use.

***************
*** 2560,2565 ****
--- 2571,2581 ----
  	  (message "Showing message %d" msg))
  	(narrow-to-region beg end)
  	(goto-char beg)
+ 	(and rmail-message-filter
+ 	     (not (eq rmail-header-style 'full))
+ 	     (let ((inhibit-read-only t))
+ 	       (funcall rmail-message-filter)
+ 	       (goto-char beg)))
  	(setq body-start (search-forward "\n\n" nil t))
  	(narrow-to-region beg (point))
  	(goto-char beg)




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: rmail-message-filter
  2009-03-04 22:18   ` rmail-message-filter Glenn Morris
@ 2009-03-04 23:29     ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2009-03-04 23:29 UTC (permalink / raw)
  To: Glenn Morris; +Cc: rms, emacs-devel

> i) I don't see that this offers anything that rmail-show-message-hook
> does not.

Compatibility with previous code that used rmail-message-filter (and
which did that because back then rmail-message-filter and
rmail-show-message-hook were not called at the same moment).

> ii) This is not exactly the same as the old behaviour, since
> previously pruning was not necessarily done every time a message was
> shown (if the previous time it was shown it was pruned).

> To recreate the "before obeying `rmail-ignored-headers'" part would
> require something like the following. But it seems dangerous to me to
> mess about with the real rmail buffer rather than the "view" copy.

It needs to work on a copy, indeed.


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-03-04 23:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-03  4:23 rmail-message-filter Glenn Morris
2009-03-03 18:44 ` rmail-message-filter Eli Zaretskii
2009-03-03 20:06   ` rmail-message-filter Glenn Morris
2009-03-03 20:59     ` rmail-message-filter Stefan Monnier
2009-03-04  8:51 ` rmail-message-filter Richard M Stallman
2009-03-04 22:18   ` rmail-message-filter Glenn Morris
2009-03-04 23:29     ` rmail-message-filter Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).