[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#9286: fill-paragraph destroys URLs
From: |
Chong Yidong |
Subject: |
bug#9286: fill-paragraph destroys URLs |
Date: |
Sat, 20 Aug 2011 15:58:52 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
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.
*** 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)