GNU bug report logs - #39517
[PATCH] Add new option 'word-wrap-boundary'

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Jaehwang Jerry Jung <tomtomjhj@HIDDEN>; Keywords: patch; dated Sun, 9 Feb 2020 08:16:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 39517 <at> debbugs.gnu.org:


Received: (at 39517) by debbugs.gnu.org; 11 Feb 2020 15:43:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 11 10:43:17 2020
Received: from localhost ([127.0.0.1]:57381 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j1Xgz-0003Mk-G8
	for submit <at> debbugs.gnu.org; Tue, 11 Feb 2020 10:43:17 -0500
Received: from mail-pj1-f50.google.com ([209.85.216.50]:35948)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tomtomjhj@HIDDEN>) id 1j1Xgx-0003MX-Tu
 for 39517 <at> debbugs.gnu.org; Tue, 11 Feb 2020 10:43:16 -0500
Received: by mail-pj1-f50.google.com with SMTP id gv17so1401193pjb.1
 for <39517 <at> debbugs.gnu.org>; Tue, 11 Feb 2020 07:43:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-transfer-encoding:content-language;
 bh=sFhDVMlX06+BcRw71WT41bxpboJH/ArqZ6aWDnj4hts=;
 b=jIcVb1hKp/MPaqH8w1Wslxg825IBZNcIE604fw9iCFyw/kRyRD2mHRcxq3e7XLYEX1
 dpXym3a70lyFlLDN+y3k051595wOOnqjDx8pbbPbI4YV/xcaHGRAUISlDMlMy+7bQUse
 NxMUWMEf3m/FFiXmk31jobFWwA/dRt6jjw184eXLXou6LV4HfLNDpgRbWwJwGvBb4swj
 n6UcoG1b95T3lpbAA3l23urQzXrahlKvdE8pymZsdErSiTk+W6/6SkWcV/BKC6XHuTt9
 djQJYmlK6pVe2Vh2UyuIZUu9qDIHoLXfF4cH1gxxEv9LC3CULrpadBHbxgdsh4fb4DmX
 8eIA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding
 :content-language;
 bh=sFhDVMlX06+BcRw71WT41bxpboJH/ArqZ6aWDnj4hts=;
 b=lgjMNms8RGw0vgfqhkkcDvasxNXG71xyjwq4oNDTnlQ6ojFdXgYQo/3Mlciw0dFHKE
 G2X0i3lTslGTAtSJvJSZelUPDZ/lQlo75SuAlIJFMqJhYH2Knz9JhFevjkvaRzdoPz/X
 47MOFGscpuB5F+YofvFZDe6PI9/1YvY/1+9vlSWWStbLJeYy2P/c+7fV6ECb6tEtwDau
 oafGLzJ2nRWAvsYN9CKXoiRgd/WlqKHC+xD5wFiqTyDyzweu9y+Y3tP4HV/RtmdDoaqu
 GJUlUO0OoFd8y0cQoBlXyiYR1ShN8dlPeLLkp8lSuPRtPdsrD9wHmTk+Ei5jWDJXzgKp
 Odeg==
X-Gm-Message-State: APjAAAUBXRhXhODrAweQ9XEEZhz8Dpb2FN501qjVdab0ZUbwT4+MeWxy
 nv4HJXTc1Y+ioJ/kzoMm3L6PXxhL
X-Google-Smtp-Source: APXvYqydPWwkokQLKbUYkVpARTZDgupFiSO9EnZp9MjHILs3tUAI4QxXdWpayJasG3lubYEf7gTqgw==
X-Received: by 2002:a17:902:bd43:: with SMTP id
 b3mr3527702plx.230.1581435789680; 
 Tue, 11 Feb 2020 07:43:09 -0800 (PST)
Received: from [192.168.86.32] ([110.76.72.113])
 by smtp.gmail.com with ESMTPSA id y1sm4474992pgi.56.2020.02.11.07.43.08
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Tue, 11 Feb 2020 07:43:09 -0800 (PST)
Subject: Re: bug#39517: [PATCH] Add new option 'word-wrap-boundary'
To: Eli Zaretskii <eliz@HIDDEN>
References: <20200209074334.16270-1-tomtomjhj@HIDDEN>
 <83lfpbdbbq.fsf@HIDDEN> <fb2ba175-29aa-4683-e398-1ed2a69967a3@HIDDEN>
 <83tv3ybeyf.fsf@HIDDEN>
From: Jaehwang Jerry Jung <tomtomjhj@HIDDEN>
Message-ID: <ee2b6436-d191-bcac-751f-c56a00ee51f9@HIDDEN>
Date: Wed, 12 Feb 2020 00:43:06 +0900
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.4.1
MIME-Version: 1.0
In-Reply-To: <83tv3ybeyf.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39517
Cc: 39517 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



On 11/02/2020 01:10, Eli Zaretskii wrote:
>> From: Jaehwang Jerry Jung <tomtomjhj@HIDDEN>
>> Cc: 39517 <at> debbugs.gnu.org
>> 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.

Not that I know of.

>> -  ((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?

It's not uncommon to wrap on '/'. For example,
* Vim: http://vimdoc.sourceforge.net/htmldoc/options.html#'breakat'
* Visual Studio Code: https://github.com/microsoft/vscode/blob/39370d9c988c584fa2e834728d8ffa56259ff1ad/src/vs/editor/common/config/editorOptions.ts#L279-L283

Anyway, I agree with configurability. Perhaps I'll need some more time
to implement it with multibyte characters in mind. Or we could use the
syntax table.

>>   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.

Thanks. I sent the request.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39517; Package emacs. Full text available.

Message received at 39517 <at> debbugs.gnu.org:


Received: (at 39517) by debbugs.gnu.org; 10 Feb 2020 16:11:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 10 11:11:21 2020
Received: from localhost ([127.0.0.1]:55304 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j1Beb-0003A0-Ef
	for submit <at> debbugs.gnu.org; Mon, 10 Feb 2020 11:11:21 -0500
Received: from eggs.gnu.org ([209.51.188.92]:58245)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1j1Bea-00039l-Fu
 for 39517 <at> debbugs.gnu.org; Mon, 10 Feb 2020 11:11:20 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:49574)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1j1BeU-0008OF-A2; Mon, 10 Feb 2020 11:11:14 -0500
Received: from [176.228.60.248] (port=3782 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1j1BeF-0003Pv-Fy; Mon, 10 Feb 2020 11:11:13 -0500
Date: Mon, 10 Feb 2020 18:10:48 +0200
Message-Id: <83tv3ybeyf.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jaehwang Jerry Jung <tomtomjhj@HIDDEN>
In-reply-to: <fb2ba175-29aa-4683-e398-1ed2a69967a3@HIDDEN> (message from
 Jaehwang Jerry Jung on Tue, 11 Feb 2020 00:36:01 +0900)
Subject: Re: bug#39517: [PATCH] Add new option 'word-wrap-boundary'
References: <20200209074334.16270-1-tomtomjhj@HIDDEN>
 <83lfpbdbbq.fsf@HIDDEN> <fb2ba175-29aa-4683-e398-1ed2a69967a3@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 39517
Cc: 39517 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> From: Jaehwang Jerry Jung <tomtomjhj@HIDDEN>
> Cc: 39517 <at> debbugs.gnu.org
> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39517; Package emacs. Full text available.

Message received at 39517 <at> debbugs.gnu.org:


Received: (at 39517) by debbugs.gnu.org; 10 Feb 2020 15:36:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 10 10:36:13 2020
Received: from localhost ([127.0.0.1]:55238 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j1B6a-0000EE-P9
	for submit <at> debbugs.gnu.org; Mon, 10 Feb 2020 10:36:13 -0500
Received: from mail-pf1-f178.google.com ([209.85.210.178]:41345)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tomtomjhj@HIDDEN>) id 1j1B6Y-0000E1-VJ
 for 39517 <at> debbugs.gnu.org; Mon, 10 Feb 2020 10:36:11 -0500
Received: by mail-pf1-f178.google.com with SMTP id j9so3874672pfa.8
 for <39517 <at> debbugs.gnu.org>; Mon, 10 Feb 2020 07:36:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:subject:to:cc:references:message-id:date:user-agent
 :mime-version:in-reply-to:content-language;
 bh=QFBXGAFwDpKBCBJKGgH/jq3JK+l6uv54D+j57sqgHJU=;
 b=ClDHkxljJ0T2Cfrc6rzkwJeRsEWKc+2MraVbFPveq6D0I7TsPy2NX1DWBsDbFSsBL5
 ikhvkjFCoBfzqzNHe6XxWhxfNulAT/oacYA2qV8V/TSSaTIPn+nCdBL0gSmgzV+fMKxC
 NwZYszxkuuNYi0jvE/D+XUS43QJKPOS6tD9UN/lQ5rAqrZIEpElZYHMdzJ5xnvsqKWJW
 LDsZ0hCAMAdebJUdSpCQKrT5Cy86xuOx20ts0EILiGjJrgtWjJLl2+Qff+dolPErLZRD
 n3eE6LF/66Fr/tmgRvU7SL8nt4AJDG0C/b/fhQFLeurP4A6fpz+RKdAx+ghEjwy8dESK
 +k2g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:subject:to:cc:references:message-id:date
 :user-agent:mime-version:in-reply-to:content-language;
 bh=QFBXGAFwDpKBCBJKGgH/jq3JK+l6uv54D+j57sqgHJU=;
 b=o8KGtq/+iYkEyj0t2Xs/dKtpXlcIvrfqQ/frEgF2UjuZYl6wRjyw737nasrhlimYri
 ckwijniUgePcP3gPo7/ydAKPfXCjvxiCjdHGWoGEb3KmWp9qAk6w7Yh1oIbpYsBSWRWH
 KWmCMYkjHSUimkoUyJbVxFmK8iEWnzSNzlHfZMRtgaTrKDncJ1l6vWu5hdqNx0hOQtKw
 MRPLHWdr6L7PcDnwZLFOa1+54PEIZyEHKJQm92VcnvZaVyFPIWniFjx5TSjfeqW+nVvT
 wy/UyNl7oNkCGy1nxgIBGIrvDh5n3c6cOzbwCe2UQieGj+t8B/GVblhZ2c9bFu5coGY1
 QZEw==
X-Gm-Message-State: APjAAAV+7uWQHGXWmB8TRXRU4RTAOBZ7DR+G32Lnp29yTMqghMUuMIJL
 8TzDIJlsBT5TykgSFS2zNNG18WKi
X-Google-Smtp-Source: APXvYqxgC5zNdrfG6JyPkKPrXTc8JKtI7yer1ZP8ZfQ21XoyDd4i1Wz09GZwV5gx4XQoFh4IKOr0Cw==
X-Received: by 2002:a62:37c7:: with SMTP id e190mr1683845pfa.165.1581348964934; 
 Mon, 10 Feb 2020 07:36:04 -0800 (PST)
Received: from [172.20.40.119] ([110.76.108.140])
 by smtp.gmail.com with ESMTPSA id e11sm472182pgj.70.2020.02.10.07.36.03
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Mon, 10 Feb 2020 07:36:04 -0800 (PST)
From: Jaehwang Jerry Jung <tomtomjhj@HIDDEN>
Subject: Re: bug#39517: [PATCH] Add new option 'word-wrap-boundary'
To: Eli Zaretskii <eliz@HIDDEN>
References: <20200209074334.16270-1-tomtomjhj@HIDDEN>
 <83lfpbdbbq.fsf@HIDDEN>
Message-ID: <fb2ba175-29aa-4683-e398-1ed2a69967a3@HIDDEN>
Date: Tue, 11 Feb 2020 00:36:01 +0900
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.4.1
MIME-Version: 1.0
In-Reply-To: <83lfpbdbbq.fsf@HIDDEN>
Content-Type: multipart/alternative;
 boundary="------------6A7CBC69F355DD1526F85A45"
Content-Language: en-US
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39517
Cc: 39517 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------6A7CBC69F355DD1526F85A45
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi. Thank you for the comments.

On 2/10/20 12:34 AM, Eli Zaretskii wrote:
>> From: Jaehwang Jerry Jung<tomtomjhj@HIDDEN>
>> Date: Sun,  9 Feb 2020 16:43:34 +0900
>> Cc: Jaehwang Jerry Jung<tomtomjhj@HIDDEN>
>>
>> * src/buffer.c (syms_of_buffer): Define buffer-local variable
>> word-wrap-boundary.
>> * src/buffer.h (struct buffer): Add word_wrap_boundary_.
>> * src/xdisp.c (IT_DISPLAYING_WORD_WRAP_BOUNDARY): replaces
>> IT_DISPLAYING_WHITESPACE.
> Thank you for your interest in Emacs.
>
> When proposing a new feature, please always describe the rationale and
> relevant practical use cases.  In this case, it is not clear to me
> when it would make sense to allow arbitrary characters as wrap
> boundaries.  Maybe you had only white-space characters in mind, but
> then why not use [:space:] or some Unicode category specification
> instead of allowing any characters?

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.

>> +  /* Characters that may cause word wrapping.  */
>> +  Lisp_Object word_wrap_boundary_;
> Any reason this is a Lisp object and not a C string?

No specific reason for that. I chose Lisp object because other members
like name_ are Lisp objects too.

>> -#define IT_DISPLAYING_WHITESPACE(it)					\
>> -  ((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.

> This feature, if we decide to accept it, will also need to be
> described in the Emacs user manual, as that is why you exposed this to
> Lisp.  We would also want a defcustom form for it, probably in
> cus-start.el.

Thanks for letting me know that.

> 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.


--------------6A7CBC69F355DD1526F85A45
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <pre>Hi. Thank you for the comments.
</pre>
    <div class="moz-cite-prefix">On 2/10/20 12:34 AM, Eli Zaretskii
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:83lfpbdbbq.fsf@HIDDEN">
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">From: Jaehwang Jerry Jung <a class="moz-txt-link-rfc2396E" href="mailto:tomtomjhj@HIDDEN">&lt;tomtomjhj@HIDDEN&gt;</a>
Date: Sun,  9 Feb 2020 16:43:34 +0900
Cc: Jaehwang Jerry Jung <a class="moz-txt-link-rfc2396E" href="mailto:tomtomjhj@HIDDEN">&lt;tomtomjhj@HIDDEN&gt;</a>

* src/buffer.c (syms_of_buffer): Define buffer-local variable
word-wrap-boundary.
* src/buffer.h (struct buffer): Add word_wrap_boundary_.
* src/xdisp.c (IT_DISPLAYING_WORD_WRAP_BOUNDARY): replaces
IT_DISPLAYING_WHITESPACE.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">Thank you for your interest in Emacs.

When proposing a new feature, please always describe the rationale and
relevant practical use cases.  In this case, it is not clear to me
when it would make sense to allow arbitrary characters as wrap
boundaries.  Maybe you had only white-space characters in mind, but
then why not use [:space:] or some Unicode category specification
instead of allowing any characters?
</pre>
    </blockquote>
    <pre>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.
</pre>
    <blockquote type="cite" cite="mid:83lfpbdbbq.fsf@HIDDEN">
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">+  /* Characters that may cause word wrapping.  */
+  Lisp_Object word_wrap_boundary_;
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">Any reason this is a Lisp object and not a C string?
</pre>
    </blockquote>
    <pre>No specific reason for that. I chose Lisp object because other members
like name_ are Lisp objects too.
</pre>
    <blockquote type="cite" cite="mid:83lfpbdbbq.fsf@HIDDEN">
      <pre class="moz-quote-pre" wrap="">
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">-#define IT_DISPLAYING_WHITESPACE(it)					\
-  ((it-&gt;what == IT_CHARACTER &amp;&amp; (it-&gt;c == ' ' || it-&gt;c == '\t'))	\
+#define IT_DISPLAYING_WORD_WRAP_BOUNDARY(it)				\
+  ((it-&gt;what == IT_CHARACTER						\
+    &amp;&amp; strchr ((char *) SDATA (BVAR (current_buffer, word_wrap_boundary)), \
+		it-&gt;c))							\
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">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.</pre>
    </blockquote>
    <pre>You're right. Actually I think it would be simpler to hard-code a better
list of boundary characters in that macro.</pre>
    <blockquote type="cite" cite="mid:83lfpbdbbq.fsf@HIDDEN">
      <pre class="moz-quote-pre" wrap="">This feature, if we decide to accept it, will also need to be
described in the Emacs user manual, as that is why you exposed this to
Lisp.  We would also want a defcustom form for it, probably in
cus-start.el.
</pre>
    </blockquote>
    <pre>Thanks for letting me know that.
</pre>
    <blockquote type="cite" cite="mid:83lfpbdbbq.fsf@HIDDEN">
      <pre class="moz-quote-pre" wrap="">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.
</pre>
    </blockquote>
    <pre>Yes, I agree.
</pre>
  </body>
</html>

--------------6A7CBC69F355DD1526F85A45--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39517; Package emacs. Full text available.

Message received at 39517 <at> debbugs.gnu.org:


Received: (at 39517) by debbugs.gnu.org; 9 Feb 2020 15:34:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 09 10:34:24 2020
Received: from localhost ([127.0.0.1]:53089 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j0obI-0005sn-9I
	for submit <at> debbugs.gnu.org; Sun, 09 Feb 2020 10:34:24 -0500
Received: from eggs.gnu.org ([209.51.188.92]:35411)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1j0obG-0005sa-69
 for 39517 <at> debbugs.gnu.org; Sun, 09 Feb 2020 10:34:22 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:59787)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1j0obB-0002OP-1W; Sun, 09 Feb 2020 10:34:17 -0500
Received: from [176.228.60.248] (port=1263 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1j0obA-0002eo-Hq; Sun, 09 Feb 2020 10:34:16 -0500
Date: Sun, 09 Feb 2020 17:34:01 +0200
Message-Id: <83lfpbdbbq.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jaehwang Jerry Jung <tomtomjhj@HIDDEN>
In-reply-to: <20200209074334.16270-1-tomtomjhj@HIDDEN> (message from
 Jaehwang Jerry Jung on Sun, 9 Feb 2020 16:43:34 +0900)
Subject: Re: bug#39517: [PATCH] Add new option 'word-wrap-boundary'
References: <20200209074334.16270-1-tomtomjhj@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 39517
Cc: 39517 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> From: Jaehwang Jerry Jung <tomtomjhj@HIDDEN>
> Date: Sun,  9 Feb 2020 16:43:34 +0900
> Cc: Jaehwang Jerry Jung <tomtomjhj@HIDDEN>
> 
> * src/buffer.c (syms_of_buffer): Define buffer-local variable
> word-wrap-boundary.
> * src/buffer.h (struct buffer): Add word_wrap_boundary_.
> * src/xdisp.c (IT_DISPLAYING_WORD_WRAP_BOUNDARY): replaces
> IT_DISPLAYING_WHITESPACE.

Thank you for your interest in Emacs.

When proposing a new feature, please always describe the rationale and
relevant practical use cases.  In this case, it is not clear to me
when it would make sense to allow arbitrary characters as wrap
boundaries.  Maybe you had only white-space characters in mind, but
then why not use [:space:] or some Unicode category specification
instead of allowing any characters?

> +  /* Characters that may cause word wrapping.  */
> +  Lisp_Object word_wrap_boundary_;

Any reason this is a Lisp object and not a C string?

> -#define IT_DISPLAYING_WHITESPACE(it)					\
> -  ((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.

This feature, if we decide to accept it, will also need to be
described in the Emacs user manual, as that is why you exposed this to
Lisp.  We would also want a defcustom form for it, probably in
cus-start.el.

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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39517; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Feb 2020 08:15:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 09 03:15:43 2020
Received: from localhost ([127.0.0.1]:52010 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j0hkk-0007xy-QS
	for submit <at> debbugs.gnu.org; Sun, 09 Feb 2020 03:15:43 -0500
Received: from lists.gnu.org ([209.51.188.17]:60043)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tomtomjhj@HIDDEN>) id 1j0hFt-0007F1-Ko
 for submit <at> debbugs.gnu.org; Sun, 09 Feb 2020 02:43:50 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:43117)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <tomtomjhj@HIDDEN>) id 1j0hFr-0006W1-Om
 for bug-gnu-emacs@HIDDEN; Sun, 09 Feb 2020 02:43:49 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <tomtomjhj@HIDDEN>) id 1j0hFq-00010v-6b
 for bug-gnu-emacs@HIDDEN; Sun, 09 Feb 2020 02:43:47 -0500
Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:35036)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <tomtomjhj@HIDDEN>) id 1j0hFp-0000zg-Sm
 for bug-gnu-emacs@HIDDEN; Sun, 09 Feb 2020 02:43:46 -0500
Received: by mail-pj1-x1031.google.com with SMTP id q39so2815614pjc.0
 for <bug-gnu-emacs@HIDDEN>; Sat, 08 Feb 2020 23:43:45 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=VoKqNHAbxtn88UTtZyg4XwFSTtvF3IilmwSWdobKnCU=;
 b=P1mGGhWLCxwC+psIho6sQnWG5uxkoWkWntcqNDeHFyrNugIopXJJQr139rRM1MdLy/
 helTJCEtksIo/Jg0IYGg1QxomuP9R1TbyGjjbek2uCyIiH+1ysHVE5iIoVPys5YLv2zz
 aYpHWvMcU+a7SRYBtKMWzS7qskUYdKnHwTKOZIUIxdNIoDCGW/e7cYFrYtXv0dvGEB+y
 WheIb1EBd+7uAP4+posYgbmhrnqJ0Xzk+I+1ViFfp6JtcWT9nmFHCTDblnGZUIYI91Eq
 tzYhnvpIcKecwfbC0y3iWCxeRQz94c/Xpo513RdoJ7qAyS1x1ZdI3CbOmKlQDOlfQrwO
 wfBQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=VoKqNHAbxtn88UTtZyg4XwFSTtvF3IilmwSWdobKnCU=;
 b=CnTf/Q99IIezGSdhrdKneqZG37amnOX3sEPcvonmYQhdMT3cHohFr8vYpjxvnAnSYO
 2mQjPjrcpRimQIzRSnI/Fi6xpr4N+OYzPa0ErzovJYY2TGKRQMm16GgOgwERpwWUd0tN
 tGJ0ZN6SHeKfopqSijI/sjrg6G+c7WRTX7xivze37/+/Bbnxr7PbEYyWSrNvifKwK6Nw
 8yyF+xSC5k0WH8Vd2TDyjhrq11t6mYocrwxC8NkvznCO7WKWXBarclN/DOTx2sIe29yg
 Ot/epeH/EayvjsX6iA48ZK1IppXPi/cP2wzBPdAod2S6GT/dfmpWoToykSEdlZZqGAHg
 cfyg==
X-Gm-Message-State: APjAAAV3NITDEF3QaaO3vU94FYaUCnnZc/K4vpLXrl86G9sAmQogjHUB
 gpnYJ2dm5A06uktTbApY7UZztOq0
X-Google-Smtp-Source: APXvYqz7i0ZcuVKTtl9nma8sW/bZCiE62N0544KLg31uP0MSkxNKH1B5JHdED787D89K993/0N9yRw==
X-Received: by 2002:a17:90a:9311:: with SMTP id
 p17mr13977127pjo.140.1581234223861; 
 Sat, 08 Feb 2020 23:43:43 -0800 (PST)
Received: from localhost.localdomain ([222.237.147.45])
 by smtp.gmail.com with ESMTPSA id q4sm8395599pfl.175.2020.02.08.23.43.42
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 08 Feb 2020 23:43:43 -0800 (PST)
From: Jaehwang Jerry Jung <tomtomjhj@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Add new option 'word-wrap-boundary'
Date: Sun,  9 Feb 2020 16:43:34 +0900
Message-Id: <20200209074334.16270-1-tomtomjhj@HIDDEN>
X-Mailer: git-send-email 2.25.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::1031
X-Spam-Score: 2.3 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: * src/buffer.c (syms_of_buffer): Define buffer-local variable
 word-wrap-boundary. * src/buffer.h (struct buffer): Add word_wrap_boundary_.
 * src/xdisp.c (IT_DISPLAYING_WORD_WRAP_BOUNDARY): replaces IT [...] 
 Content analysis details:   (2.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at https://www.dnswl.org/,
 low trust [209.51.188.17 listed in list.dnswl.org]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (tomtomjhj[at]gmail.com)
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 2.0 SPOOFED_FREEMAIL       No description available.
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 09 Feb 2020 03:15:40 -0500
Cc: Jaehwang Jerry Jung <tomtomjhj@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

* src/buffer.c (syms_of_buffer): Define buffer-local variable
word-wrap-boundary.
* src/buffer.h (struct buffer): Add word_wrap_boundary_.
* src/xdisp.c (IT_DISPLAYING_WORD_WRAP_BOUNDARY): replaces
IT_DISPLAYING_WHITESPACE.
---
 etc/NEWS     |  5 +++++
 src/buffer.c | 16 ++++++++++++++--
 src/buffer.h |  3 +++
 src/xdisp.c  | 43 ++++++++++++++++++++++---------------------
 4 files changed, 44 insertions(+), 23 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 7b358ff271..40f432e5bb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -70,6 +70,11 @@ specify cursor-type to be '(box . SIZE)', the cursor becomes a hollow
 box if the point is on an image larger than 'SIZE' pixels in any
 dimension.
 
+** New option 'word-wrap-boundary'.
+This defines the characters that can be used as a wrapping boundary
+when 'word-wrap' is on. It defaults to " \t", the characters that had
+been hard-coded in the previous versions of Emacs.
+
 
 * Editing Changes in Emacs 28.1
 
diff --git a/src/buffer.c b/src/buffer.c
index cc7d4e4817..fa48461b2f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -369,6 +369,11 @@ bset_word_wrap (struct buffer *b, Lisp_Object val)
   b->word_wrap_ = val;
 }
 static void
+bset_word_wrap_boundary (struct buffer *b, Lisp_Object val)
+{
+  b->word_wrap_boundary_ = val;
+}
+static void
 bset_zv_marker (struct buffer *b, Lisp_Object val)
 {
   b->zv_marker_ = val;
@@ -5168,6 +5173,7 @@ init_buffer_once (void)
   /* Make this one a permanent local.  */
   buffer_permanent_local_flags[idx++] = 1;
   XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx;
+  XSETFASTINT (BVAR (&buffer_local_flags, word_wrap_boundary), idx); ++idx;
   XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx;
   XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx;
   XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx;
@@ -5265,6 +5271,7 @@ init_buffer_once (void)
   XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8);
   bset_truncate_lines (&buffer_defaults, Qnil);
   bset_word_wrap (&buffer_defaults, Qnil);
+  bset_word_wrap_boundary (&buffer_defaults, build_string (" \t"));
   bset_ctl_arrow (&buffer_defaults, Qt);
   bset_bidi_display_reordering (&buffer_defaults, Qt);
   bset_bidi_paragraph_direction (&buffer_defaults, Qnil);
@@ -5752,8 +5759,8 @@ syms_of_buffer (void)
 
   DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil,
 		     doc: /* Non-nil means to use word-wrapping for continuation lines.
-When word-wrapping is on, continuation lines are wrapped at the space
-or tab character nearest to the right window edge.
+When word-wrapping is on, continuation lines are wrapped at the character
+defined in `word-wrap-boundary` nearest to the right window edge.
 If nil, continuation lines are wrapped at the right screen edge.
 
 This variable has no effect if long lines are truncated (see
@@ -5768,6 +5775,11 @@ syms_of_buffer (void)
 visual lines rather than logical lines.  See the documentation of
 `visual-line-mode'.  */);
 
+  DEFVAR_PER_BUFFER ("word-wrap-boundary",
+		     &BVAR (current_buffer, word_wrap_boundary), Qstringp,
+		     doc: /* Characters that may cause line wrapping when `word-wrap` is on.
+" \\t" initially. */);
+
   DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory),
 		     Qstringp,
 		     doc: /* Name of default directory of current buffer.
diff --git a/src/buffer.h b/src/buffer.h
index fd05fdd37d..69707c4020 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -394,6 +394,9 @@ #define BVAR(buf, field) ((buf)->field ## _)
   /* Non-nil means to use word wrapping when displaying continuation lines.  */
   Lisp_Object word_wrap_;
 
+  /* Characters that may cause word wrapping.  */
+  Lisp_Object word_wrap_boundary_;
+
   /* Non-nil means display ctl chars with uparrow.  */
   Lisp_Object ctl_arrow_;
 
diff --git a/src/xdisp.c b/src/xdisp.c
index e41ceaf0bb..7e3710230c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -412,11 +412,12 @@ #define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) false
 #endif /* HAVE_WINDOW_SYSTEM */
 
 /* Test if the display element loaded in IT, or the underlying buffer
-   or string character, is a space or a TAB character.  This is used
-   to determine where word wrapping can occur.  */
+   or string character, is a word wrap boundary character.  */
 
-#define IT_DISPLAYING_WHITESPACE(it)					\
-  ((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))							\
    || ((STRINGP (it->string)						\
 	&& (SREF (it->string, IT_STRING_BYTEPOS (*it)) == ' '		\
 	    || SREF (it->string, IT_STRING_BYTEPOS (*it)) == '\t'))	\
@@ -9078,12 +9079,12 @@ #define IT_RESET_X_ASCENT_DESCENT(IT)			\
 	{
 	  if (it->line_wrap == WORD_WRAP && it->area == TEXT_AREA)
 	    {
-	      if (IT_DISPLAYING_WHITESPACE (it))
+	      if (IT_DISPLAYING_WORD_WRAP_BOUNDARY (it))
 		may_wrap = true;
 	      else if (may_wrap)
 		{
 		  /* We have reached a glyph that follows one or more
-		     whitespace characters.  If the position is
+		     boundary characters.  If the position is
 		     already found, we are done.  */
 		  if (atpos_it.sp >= 0)
 		    {
@@ -9228,10 +9229,10 @@ #define IT_RESET_X_ASCENT_DESCENT(IT)			\
 			    {
 			      bool can_wrap = true;
 
-			      /* If we are at a whitespace character
+			      /* If we are at a boundary character
 				 that barely fits on this screen line,
 				 but the next character is also
-				 whitespace, we cannot wrap here.  */
+				 boundary, we cannot wrap here.  */
 			      if (it->line_wrap == WORD_WRAP
 				  && wrap_it.sp >= 0
 				  && may_wrap
@@ -9243,13 +9244,13 @@ #define IT_RESET_X_ASCENT_DESCENT(IT)			\
 				  SAVE_IT (tem_it, *it, tem_data);
 				  set_iterator_to_next (it, true);
 				  if (get_next_display_element (it)
-				      && IT_DISPLAYING_WHITESPACE (it))
+				      && IT_DISPLAYING_WORD_WRAP_BOUNDARY (it))
 				    can_wrap = false;
 				  RESTORE_IT (it, &tem_it, tem_data);
 				}
 			      if (it->line_wrap != WORD_WRAP
 				  || wrap_it.sp < 0
-				  /* If we've just found whitespace
+				  /* If we've just found boundary
 				     where we can wrap, effectively
 				     ignore the previous wrap point --
 				     it is no longer relevant, but we
@@ -9322,19 +9323,19 @@ #define IT_RESET_X_ASCENT_DESCENT(IT)			\
 		  else
 		    IT_RESET_X_ASCENT_DESCENT (it);
 
-		  /* If the screen line ends with whitespace, and we
+		  /* If the screen line ends with boundary, and we
 		     are under word-wrap, don't use wrap_it: it is no
 		     longer relevant, but we won't have an opportunity
 		     to update it, since we are done with this screen
 		     line.  */
 		  if (may_wrap && IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)
 		      /* If the character after the one which set the
-			 may_wrap flag is also whitespace, we can't
+			 may_wrap flag is also boundary, we can't
 			 wrap here, since the screen line cannot be
-			 wrapped in the middle of whitespace.
+			 wrapped in the middle of boundary.
 			 Therefore, wrap_it _is_ relevant in that
 			 case.  */
-		      && !(moved_forward && IT_DISPLAYING_WHITESPACE (it)))
+		      && !(moved_forward && IT_DISPLAYING_WORD_WRAP_BOUNDARY (it)))
 		    {
 		      /* If we've found TO_X, go back there, as we now
 			 know the last word fits on this screen line.  */
@@ -23163,7 +23164,7 @@ #define RECORD_MAX_MIN_POS(IT)					\
 
 	  if (it->line_wrap == WORD_WRAP && it->area == TEXT_AREA)
 	    {
-	      if (IT_DISPLAYING_WHITESPACE (it))
+	      if (IT_DISPLAYING_WORD_WRAP_BOUNDARY (it))
 		may_wrap = true;
 	      else if (may_wrap)
 		{
@@ -23308,10 +23309,10 @@ #define RECORD_MAX_MIN_POS(IT)					\
 			      /* Even if there is a previous wrap
 				 point, continue the line here as
 				 usual, if (i) the previous character
-				 was a space or tab AND (ii) the
-				 current character is not.  */
+				 was a boundary AND (ii) the current
+				 character is not.  */
 			      && (!may_wrap
-				  || IT_DISPLAYING_WHITESPACE (it)))
+				  || IT_DISPLAYING_WORD_WRAP_BOUNDARY (it)))
 			    goto back_to_wrap;
 
 			  /* Record the maximum and minimum buffer
@@ -23342,10 +23343,10 @@ #define RECORD_MAX_MIN_POS(IT)					\
 				       /* Even if there is a previous wrap
 					  point, continue the line here as
 					  usual, if (i) the previous character
-					  was a space or tab AND (ii) the
-					  current character is not.  */
+					  was a boundary AND (ii) the current
+					  character is not.  */
 				       && (!may_wrap
-					   || IT_DISPLAYING_WHITESPACE (it)))
+					   || IT_DISPLAYING_WORD_WRAP_BOUNDARY (it)))
 				goto back_to_wrap;
 
 			    }
-- 
2.17.1





Acknowledgement sent to Jaehwang Jerry Jung <tomtomjhj@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#39517; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 20 Feb 2020 21:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.