From: Magnus Henoch <magnus.henoch@gmail.com>
To: ding@gnus.org
Subject: Re: text/plain with 80 char wrap vs the flowed mime-type (whatever it is)
Date: Thu, 04 Feb 2016 22:41:46 +0000 [thread overview]
Message-ID: <m1mvrg3xp1.fsf@mail.gmail.com> (raw)
In-Reply-To: Nikolaus Rath's message of "Thu\, 04 Feb 2016 08\:17\:37 -0800 \(6 hours\, 20 minutes ago\)"
Nikolaus Rath <Nikolaus@rath.org> writes:
> On Jan 27 2016, jorge.alfaro-murillo@yale.edu (Jorge
> A. Alfaro-Murillo) wrote:
>> I have:
>>
>> #+BEGIN_SRC emacs-lisp (add-hook 'message-mode-hook
>> 'use-hard-newlines) #+END_SRC
>>
>> That allows the message to be sent with format=flowed.
>
> For me that breaks e.g. text pasted from a terminal or from a C
> mode window (the pasted stuff is refilled when the message is
> displayed by the recipient).
>
> Is that a general problem or something specific to my setup?
I eventually came up with this:
(defun my-mark-hard-newlines (beg end &rest _ignore)
(interactive (list (point-min) (point-max)))
(save-excursion
(goto-char beg)
(while (search-forward "\n" end t)
(let ((pos (1- (point))))
(if (get-text-property pos 'hard)
;; Use `copy-sequence', because display property
values must not be `eq'!
(add-text-properties pos (1+ pos) (list 'display
(copy-sequence "⏎\n")))
(remove-text-properties pos (1+ pos) '(display
nil)))))))
(defun my-use-and-mark-hard-newlines ()
(interactive)
(use-hard-newlines)
(add-hook 'after-change-functions 'my-mark-hard-newlines nil
t))
(with-eval-after-load "message"
(add-hook 'message-mode-hook 'my-use-and-mark-hard-newlines))
It doesn't fix things automatically, but it lets me see which
newlines are hard, so I get the hint to fix code snippets manually
before sending.
Regards,
Magnus
next reply other threads:[~2016-02-04 22:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-04 22:41 Magnus Henoch [this message]
2016-02-05 0:14 ` Nikolaus Rath
2016-02-05 0:22 ` Mark Simpson
-- strict thread matches above, loose matches on Subject: below --
2016-01-27 21:59 Wes Hardaker
2016-01-28 1:52 ` Jorge A. Alfaro-Murillo
2016-02-02 18:22 ` Wes Hardaker
2016-02-04 2:54 ` Mark Simpson
2016-02-04 5:18 ` Teemu Likonen
2016-02-04 14:30 ` Teemu Likonen
2016-02-05 0:21 ` Mark Simpson
2016-02-05 17:13 ` Jorge A. Alfaro-Murillo
2016-02-04 16:17 ` Nikolaus Rath
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1mvrg3xp1.fsf@mail.gmail.com \
--to=magnus.henoch@gmail.com \
--cc=ding@gnus.org \
/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.
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).