unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: Kenichi Handa <handa@m17n.org>
Cc: 9286@debbugs.gnu.org, jidanni@jidanni.org
Subject: bug#9286: fill-paragraph destroys URLs
Date: Sat, 20 Aug 2011 15:58:52 -0400	[thread overview]
Message-ID: <87obzjhn2b.fsf@stupidchicken.com> (raw)
In-Reply-To: <87k4ajbpyi.fsf@jidanni.org> (jidanni@jidanni.org's message of "Fri, 12 Aug 2011 05:25:41 +0800")

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)






  reply	other threads:[~2011-08-20 19:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-11 21:25 bug#9286: fill-paragraph destroys URLs jidanni
2011-08-20 19:58 ` Chong Yidong [this message]
2019-10-09 22:30   ` Lars Ingebrigtsen
2019-10-10  7:43     ` Eli Zaretskii
2019-10-11  6:58       ` bug#34463: " Lars Ingebrigtsen
2019-11-23 14:00         ` Lars Ingebrigtsen
2011-08-20 20:04 ` jidanni

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=87obzjhn2b.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=9286@debbugs.gnu.org \
    --cc=handa@m17n.org \
    --cc=jidanni@jidanni.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.
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).