From: Nikolaus Rath <Nikolaus@rath.org>
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 16:14:17 -0800 [thread overview]
Message-ID: <8737t8c8ti.fsf@thinkpad.rath.org> (raw)
In-Reply-To: <m1mvrg3xp1.fsf@mail.gmail.com> (Magnus Henoch's message of "Thu, 04 Feb 2016 22:41:46 +0000")
On Feb 04 2016, Magnus Henoch <magnus.henoch@gmail.com> wrote:
> 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.
Hmm. Trying to call this gives me (on Emacs 24.4):
Debugger entered--Lisp error: (wrong-number-of-arguments (lambda
(beg end &rest _ignore) (interactive (list (point-min)
(point-max))) (save-excursion (goto-char beg) (while
(search-forward " " end t) (let ((pos (1- (point)))) (if
(get-text-property pos (quote hard)) values must not be (quote eq)
(quote !) (add-text-properties pos (1+ pos) (list (quote display)
(copy-sequence "⏎ "))) (remove-text-properties pos (1+ pos) (quote
(display nil)))))))) 0)
my-mark-hard-newlines()
Emacs 24.4.
I always considered myself able to read backtraces - but the above
leaves me clueless. Which function has the wrong number of
arguments? Why is the whole function definition included in the
error?
Best,
-Nikolaus
(No Cc on replies please, I'm reading the list)
--
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F
»Time flies like an arrow, fruit flies like a Banana.«
next prev parent reply other threads:[~2016-02-05 0:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-04 22:41 Magnus Henoch
2016-02-05 0:14 ` Nikolaus Rath [this message]
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=8737t8c8ti.fsf@thinkpad.rath.org \
--to=nikolaus@rath.org \
--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).