Subject: Re: bug#39517: [PATCH] Add new option 'word-wrap-boundary'

From: Eli Zaretskii <[email-masked]>
Date: Mon, 10 Feb 2020 18:10:48 +0200

> From: Jaehwang Jerry Jung <[email-masked]>
> Cc: [email-masked]
> Date: Tue, 11 Feb 2020 00:36:01 +0900
> 
> I noticed that word wrapping looks a bit weird when the text contains
> long URLs.  So I wanted to add non-word ASCII characters so that URLs
> can be wrapped more naturally as in other editors, while not changing
> the default behavior.

OK, but is that the only relevant use case?  Maybe we have others.  We
need to think in more general terms, in case the other use cases might
suggest different solutions.

> -  ((it->what == IT_CHARACTER && (it->c == ' ' || it->c == '\t'))	\
> +#define IT_DISPLAYING_WORD_WRAP_BOUNDARY(it)				\
> +  ((it->what == IT_CHARACTER						\
> +    && strchr ((char *) SDATA (BVAR (current_buffer, word_wrap_boundary)), \
> +		it->c))							\
> 
> This cannot be right: characters are stored in Lisp strings in a
> multibyte encoding that is superset of UTF-8, so the above will only
> support pure-ASCII boundary characters, which is probably not what you
> had in mind.
> 
> You're right. Actually I think it would be simpler to hard-code a better
> list of boundary characters in that macro.

I don't think we can hardcode them, because the set of characters must
be buffer-local: we don't want to wrap on '/' in a general text-mode
buffer, let alone in a C-mode buffer, right?

>  Last, but not least, for a contribution this large, we will need you
> to assign the copyright to the FSF.  If you agree, I will send you the
> form to fill and the instructions to send it.
> 
> Yes, I agree.

Form sent off-list.

Thanks.