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

Previous Next

Package: emacs;

Reported by: Jaehwang Jerry Jung <tomtomjhj <at> gmail.com>

Date: Sun, 9 Feb 2020 08:16:02 UTC

Severity: wishlist

Tags: patch

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 39517 <at> debbugs.gnu.org (full text, mbox):

From: Jaehwang Jerry Jung <tomtomjhj <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39517 <at> debbugs.gnu.org
Subject: Re: bug#39517: [PATCH] Add new option 'word-wrap-boundary'
Date: Tue, 11 Feb 2020 00:36:01 +0900
[Message part 1 (text/plain, inline)]
Hi. Thank you for the comments.

On 2/10/20 12:34 AM, Eli Zaretskii wrote:
>> From: Jaehwang Jerry Jung<tomtomjhj <at> gmail.com>
>> Date: Sun,  9 Feb 2020 16:43:34 +0900
>> Cc: Jaehwang Jerry Jung<tomtomjhj <at> gmail.com>
>>
>> * 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.

[Message part 2 (text/html, inline)]

This bug report was last modified 4 years and 345 days ago.

Previous Next


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