Gnus development mailing list
 help / color / mirror / Atom feed
* [Patch] MFT in mml-preview
@ 2002-12-30 18:59 Reiner Steib
  2002-12-30 19:14 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Reiner Steib @ 2002-12-30 18:59 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

Hi,

WIBNI we could see the automatically generated Mail-Followup-To header
in the preview (`mml-preview') before sending a message?

I added this to `mml.el'.  Probably it would be better not to
duplicate code from `message.el', but I'm not sure how to do this.

Suggested ChangeLog entry:

--8<---------------cut here---------------start------------->8---
2002-12-30  Reiner Steib  <Reiner.Steib@gmx.de>

	* mml.el (mml-preview-insert-mft): New function.
	(mml-preview): Use it.

	* message.el (message-send-mail): Added comment concerning
	`mml-preview-insert-mft'.

--8<---------------cut here---------------end--------------->8---


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: message.mml-preview-insert-mft.patch --]
[-- Type: text/x-patch, Size: 1546 bytes --]

--- message.el	2002/12/29 18:33:35	6.266
+++ message.el	2002/12/30 15:15:00
@@ -3337,6 +3352,8 @@
     (save-restriction
       (message-narrow-to-headers)
       ;; Generate the Mail-Followup-To header if the header is not there...
+      ;; (Please also change code in `mml-preview-insert-mft',
+      ;; if you change anything here.)
       (if (and (or message-subscribed-regexps
 		   message-subscribed-addresses
 		   message-subscribed-address-file

--- mml.el	2002/12/29 16:03:07	6.65
+++ mml.el	2002/12/30 16:23:12
@@ -1007,6 +1007,19 @@
   (mml-insert-tag 'part 'type type 'disposition "inline")
   (forward-line -1))
 
+(defun mml-preview-insert-mft ()
+  "Insert a Mail-Followup-To header before previewing an article.
+Should be adopted if code in `message-send-mail' is changed."
+  (when (and (message-mail-p)
+	     (or message-subscribed-regexps
+		 message-subscribed-addresses
+		 message-subscribed-address-file
+		 message-subscribed-address-functions)
+	     (not (mail-fetch-field "mail-followup-to"))
+	     (message-make-mft))
+    (message-position-on-field "Mail-Followup-To" "X-Draft-From")
+    (insert (message-make-mft))))
+
 (defun mml-preview (&optional raw)
   "Display current buffer with Gnus, in a new buffer.
 If RAW, don't highlight the article."
@@ -1027,7 +1040,8 @@
 				   "*MIME preview of ") (buffer-name))))
       (erase-buffer)
       (insert-buffer buf)
+      (mml-preview-insert-mft)
       (let ((message-deletable-headers (if (message-news-p)
 					   nil
 					 message-deletable-headers)))

[-- Attachment #3: Type: text/plain, Size: 116 bytes --]


Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/

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

* Re: [Patch] MFT in mml-preview
  2002-12-30 18:59 [Patch] MFT in mml-preview Reiner Steib
@ 2002-12-30 19:14 ` Lars Magne Ingebrigtsen
  2002-12-30 19:54   ` Reiner Steib
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Magne Ingebrigtsen @ 2002-12-30 19:14 UTC (permalink / raw)


Reiner Steib <4uce.02.r.steib@gmx.net> writes:

> I added this to `mml.el'.  Probably it would be better not to
> duplicate code from `message.el', but I'm not sure how to do this.

You could try to factor out the common forms into a function or a
macro, I guess...

> 	* mml.el (mml-preview-insert-mft): New function.
> 	(mml-preview): Use it.
>
> 	* message.el (message-send-mail): Added comment concerning
> 	`mml-preview-insert-mft'.

Anyway, these changes are so big that it requires FSF paperwork.
Have you signed those, or should I send you a copyright assignment
form?

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



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

* Re: [Patch] MFT in mml-preview
  2002-12-30 19:14 ` Lars Magne Ingebrigtsen
@ 2002-12-30 19:54   ` Reiner Steib
  2002-12-30 20:21     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Reiner Steib @ 2002-12-30 19:54 UTC (permalink / raw)


On Mon, Dec 30 2002, Lars Magne Ingebrigtsen wrote:

> Reiner Steib <4uce.02.r.steib@gmx.net> writes:
>
>> I added this to `mml.el'.  Probably it would be better not to
>> duplicate code from `message.el', but I'm not sure how to do this.
>
> You could try to factor out the common forms into a function or a
> macro, I guess...

The common part is the condition:

          (and (or message-subscribed-regexps
		   message-subscribed-addresses
		   message-subscribed-address-file
		   message-subscribed-address-functions)
	       (not (mail-fetch-field "mail-followup-to")))

The four message-subscribed-* could be collected...

(defun message-subscribed-FOO-p ()
  (or message-subscribed-regexps
      message-subscribed-addresses
      message-subscribed-address-file
      message-subscribed-address-functions))

...and we could use "(message-subscribed-FOO-p)" in both, mml.el and
message.el.  Does this make sense?

> Anyway, these changes are so big that it requires FSF paperwork.

I have signed the papers.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/



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

* Re: [Patch] MFT in mml-preview
  2002-12-30 19:54   ` Reiner Steib
@ 2002-12-30 20:21     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Magne Ingebrigtsen @ 2002-12-30 20:21 UTC (permalink / raw)


Reiner Steib <4uce.02.r.steib@gmx.net> writes:

> ...and we could use "(message-subscribed-FOO-p)" in both, mml.el and
> message.el.  Does this make sense?

Yup.

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



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

* Re: [Patch] MFT in mml-preview
  2002-12-30 22:04 Reiner Steib
@ 2002-12-30 22:24 ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Magne Ingebrigtsen @ 2002-12-30 22:24 UTC (permalink / raw)


Reiner Steib <4uce.02.r.steib@gmx.net> writes:

> 	* message.el (message-subscribed-p): New function.
> 	(message-send-mail): Use it.
> 	* mml.el (mml-preview-insert-mft): New function.
> 	(mml-preview): Use it.

Thanks for the patch; I've applied it to Oort Gnus v0.08 (i. e., CVS).

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



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

* Re: [Patch] MFT in mml-preview
@ 2002-12-30 22:04 Reiner Steib
  2002-12-30 22:24 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Reiner Steib @ 2002-12-30 22:04 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

On Mon, Dec 30 2002, Lars Magne Ingebrigtsen wrote:

> Reiner Steib <4uce.02.r.steib@gmx.net> writes:
>
>> ...and we could use "(message-subscribed-FOO-p)" in both, mml.el and
>> message.el.  Does this make sense?
>
> Yup.

Okay, here's a new patch using `message-subscribed-p' (maybe the
doc-string should be improved?):


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: message.mml-preview-insert-mft-02.patch --]
[-- Type: text/x-patch, Size: 2035 bytes --]

*** mml.el.~6.65.~	Mon Dec 30 17:25:32 2002
--- mml.el	Mon Dec 30 21:50:17 2002
***************
*** 1007,1012 ****
--- 1007,1022 ----
    (mml-insert-tag 'part 'type type 'disposition "inline")
    (forward-line -1))
  
+ (defun mml-preview-insert-mft ()
+   "Insert a Mail-Followup-To header before previewing an article.
+ Should be adopted if code in `message-send-mail' is changed."
+   (when (and (message-mail-p)
+ 	     (message-subscribed-p)
+ 	     (not (mail-fetch-field "mail-followup-to"))
+ 	     (message-make-mft))
+     (message-position-on-field "Mail-Followup-To" "X-Draft-From")
+     (insert (message-make-mft))))
+ 
  (defun mml-preview (&optional raw)
    "Display current buffer with Gnus, in a new buffer.
  If RAW, don't highlight the article."
***************
*** 1027,1032 ****
--- 1037,1043 ----
  				   "*MIME preview of ") (buffer-name))))
        (erase-buffer)
        (insert-buffer buf)
+       (mml-preview-insert-mft)
        (let ((message-deletable-headers (if (message-news-p)
  					   nil
  					 message-deletable-headers)))

--- message.el.~6.268.~	Mon Dec 30 21:28:50 2002
+++ message.el	Mon Dec 30 21:51:56 2002
@@ -1896,6 +1896,13 @@
 		   (message-fetch-field "cc")
 		   (message-fetch-field "bcc")))))))
 
+(defun message-subscribed-p ()
+  "Say whether we need to insert a MFT header."
+  (or message-subscribed-regexps
+      message-subscribed-addresses
+      message-subscribed-address-file
+      message-subscribed-address-functions))
+
 (defun message-next-header ()
   "Go to the beginning of the next header."
   (beginning-of-line)
@@ -3343,10 +3350,7 @@
     (save-restriction
       (message-narrow-to-headers)
       ;; Generate the Mail-Followup-To header if the header is not there...
-      (if (and (or message-subscribed-regexps
-		   message-subscribed-addresses
-		   message-subscribed-address-file
-		   message-subscribed-address-functions)
+      (if (and (message-subscribed-p)
 	       (not (mail-fetch-field "mail-followup-to")))
 	  (setq headers
 		(cons

[-- Attachment #3: Type: text/plain, Size: 455 bytes --]


--8<---------------cut here---------------start------------->8---
2002-12-30  Reiner Steib  <Reiner.Steib@gmx.de>

	* message.el (message-subscribed-p): New function.
	(message-send-mail): Use it.
	* mml.el (mml-preview-insert-mft): New function.
	(mml-preview): Use it.

--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/

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

end of thread, other threads:[~2002-12-30 22:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-30 18:59 [Patch] MFT in mml-preview Reiner Steib
2002-12-30 19:14 ` Lars Magne Ingebrigtsen
2002-12-30 19:54   ` Reiner Steib
2002-12-30 20:21     ` Lars Magne Ingebrigtsen
2002-12-30 22:04 Reiner Steib
2002-12-30 22:24 ` Lars Magne Ingebrigtsen

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).