unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Reiner Steib <reinersteib+gmane@imap.cc>
Subject: Re: `hard-newline' changes trigger format=flowed in Gnus
Date: Thu, 01 Dec 2005 18:44:57 +0100	[thread overview]
Message-ID: <v9vey84spy.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <7wlkz5ho7g.fsf@ece.lsu.edu> (David Koppelman's message of "Wed,  30 Nov 2005 14:31:47 -0600")

On Wed, Nov 30 2005, David Koppelman wrote:

> Reiner Steib <reinersteib+gmane@imap.cc> 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	other threads:[~2005-12-01 17:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-29 20:41 `hard-newline' changes trigger format=flowed in Gnus Reiner Steib
2005-11-29 21:08 ` Romain Francoise
2005-11-29 21:10 ` David Koppelman
2005-11-29 22:18 ` Chong Yidong
2005-11-30 13:35   ` Per Abrahamsen
2005-11-29 23:56 ` Chong Yidong
2005-11-30 15:10   ` Reiner Steib
2005-11-30 16:30     ` Sam Steingold
2005-11-30 20:23       ` Reiner Steib
2005-11-30 22:17         ` Sam Steingold
2005-12-01 17:48           ` Reiner Steib
2005-11-30 20:31     ` David Koppelman
2005-12-01 17:44       ` Reiner Steib [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v9vey84spy.fsf@marauder.physik.uni-ulm.de \
    --to=reinersteib+gmane@imap.cc \
    --cc=Reiner.Steib@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).