bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#9286: fill-paragraph destroys URLs


From: Lars Ingebrigtsen
Subject: bug#9286: fill-paragraph destroys URLs
Date: Thu, 10 Oct 2019 00:30:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Chong Yidong <cyd@stupidchicken.com> writes:

> If I am decoding the jidanni-speak correctly, his complaint is doing M-q
> on a buffer containing
>
> asdf
>
>
> turns the text into
>
> asdf國
>
> instead of what he wants:
>
> asdf 國
>
> This is because line joining does not include a space if *either*
> character on each side of the newline has the ?| (line-breakable)
> category and an entry in fill-nospace-between-words-table.  To get the
> behavior jidanni wants, we could change it so that *both* the characters
> must have this property; see attached patch.
>
> But I am not sure this is TRT in general.  Handa-san, could you weigh in
> with an opinion?  Adding a space seems more or less correct to me, but I
> am no expert.

This problem is still present in Emacs 27.  This patch, from 2011, was
never applied.  I think Chong's proposal sounds logical, but like him,
I'm (ahem) no expert.

> *** lisp/textmodes/fill.el    2011-07-16 20:05:54 +0000
> --- lisp/textmodes/fill.el    2011-08-20 19:52:41 +0000
> ***************
> *** 482,491 ****
>           (replace-match (get-text-property (match-beginning 0) 'fill-space))
>         (let ((prev (char-before (match-beginning 0)))
>               (next (following-char)))
> !         (if (and (or (aref (char-category-set next) ?|)
> !                      (aref (char-category-set prev) ?|))
> !                  (or (aref fill-nospace-between-words-table next)
> !                      (aref fill-nospace-between-words-table prev)))
>               (delete-char -1))))))
>
>     (goto-char from)
> --- 482,491 ----
>           (replace-match (get-text-property (match-beginning 0) 'fill-space))
>         (let ((prev (char-before (match-beginning 0)))
>               (next (following-char)))
> !         (if (and (aref (char-category-set next) ?|)
> !                  (aref (char-category-set prev) ?|)
> !                  (aref fill-nospace-between-words-table next)
> !                  (aref fill-nospace-between-words-table prev))
>               (delete-char -1))))))
>
>     (goto-char from)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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