emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `hard-newline' changes trigger format=flowed in Gnus


From: Reiner Steib
Subject: Re: `hard-newline' changes trigger format=flowed in Gnus
Date: Thu, 01 Dec 2005 18:44:57 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

On Wed, Nov 30 2005, David Koppelman wrote:

> Reiner Steib <address@hidden> writes:
>
>> There is some information in emacs-mime.texi:
>>
>> ,----[ (info "(emacs-mime)Flowed text") ]
>> | The Emacs MIME library will respect the `use-hard-newlines' variable
>> | (*note Hard and Soft Newlines: (emacs)Hard and Soft Newlines.) when
>> | encoding a message, and the "format=flowed" Content-Type parameter when
>> | decoding a message.
[...]
>> IMHO, it won't hurt to add a short note and reference to this
>> explanation in gnus.texi and message.texi.  The only occurrence is in
>> the "New Features" section (info "(gnus)Oort Gnus").  Suggestions?
>
> If I understand things correctly if soft and hard newline characters
> are found 

The code (see `mml-generate-mime-1') checks for hard newlines:

  (text-property-any (point-min) (point-max) 'hard 't)

The soft newlines are the normal '\n'-s without any special text
property.   (At least that is my understanding, CMIIW.)

> then it will be assumed that a soft newline is what was intended and
> so text will be flowed, no questions asked. But there are many cases
> in which the soft newline character is there by "accident". 

Maybe you meant "hard newline" in this paragraph?

> The sender won't know until the recipient gets back to the sender
> and then the sender will have to delve deeply into lisp or the
> documentation to diagnose the problem and develop a workaround.

ACK.  I only noticed this bug because I was sending mail to some other
account of mine while testing /etc/postfix/virtual (therefore copying
the headers of the message into the body).

> Therefore one must be much more careful before flowing. Perhaps some
> combination of the following:
>
>  Some indication that text will be assumed flowable, perhaps in the
>  modeline or perhaps by highlighting around the soft newlines.

Probably highlighting hard newlines is possible.  I guess people on
emacs-devel can tell you how.  Performing a "flowable" test while
writing a message doesn't make much sense IMHO.

>  If flowability has been assumed then ask the user if that's correct and
>  take yes, yes always, no, and no never responses.

Maybe something like this?

--8<---------------cut here---------------start------------->8---
--- mml.el      01 Nov 2005 14:18:40 +0100      7.38
+++ mml.el      01 Dec 2005 18:27:37 +0100      
@@ -413,6 +413,8 @@
                                      cont)))
        (buffer-string)))))
 
+(defvar mml-confirm-flow-fill t)
+
 (defun mml-generate-mime-1 (cont)
   (let ((mm-use-ultra-safe-encoding
         (or mm-use-ultra-safe-encoding (assq 'sign cont))))
@@ -481,16 +483,21 @@
                    ;; parts where there either isn't a format parameter
                    ;; in the mml tag or it says "flowed" and there
                    ;; actually are hard newlines in the text.
-                   (let (use-hard-newlines)
+                   (let (found-hard-newlines)
                      (when (and (string= type "text/plain")
                                 (not (string= (cdr (assq 'sign cont)) "pgp"))
                                 (or (null (assq 'format cont))
                                     (string= (cdr (assq 'format cont))
                                              "flowed"))
-                                (setq use-hard-newlines
+                                (setq found-hard-newlines
                                       (text-property-any
                                        (point-min) (point-max) 'hard 't)))
-                       (fill-flowed-encode)
+                       (when (and found-hard-newlines
+                                  (or mml-confirm-flow-fill
+                                      (y-or-n-p
+                                       "Hard newlines found.  Send as 
\"format=flowed\"? ")))
+                         (let ((use-hard-newlines found-hard-newlines))
+                           (fill-flowed-encode)))
                        ;; Indicate that `mml-insert-mime-headers' should
                        ;; insert a "; format=flowed" string unless the
                        ;; user has already specified it.
--8<---------------cut here---------------end--------------->8---

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]