unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Emacs26: Quick thoughts on display-line-numbers-mode
@ 2017-10-05 18:38 Robert Weiner
  2017-10-05 18:52 ` Matthew Plant
  2017-10-05 19:02 ` Eli Zaretskii
  0 siblings, 2 replies; 23+ messages in thread
From: Robert Weiner @ 2017-10-05 18:38 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

I took a quick look at display-line-numbers-mode (nice work as always) and
had a few thoughts:

1. The similar linum-mode when possible displays a subtle vertical
separator between the line numbers and the left margin of the text area.
This helps to visually parse the numbers as separate from the text and
helps identify where the first text character is.  It would be good to have
something similar at least as an option.

Then linum-mode should be removed (maybe add an alias) so there is no
confusion as to which mode should be used.

2. The mode-line popup menu that displays/hides line and col numbers in the
mode=line could be expanded to toggle this mode on and off locally and
globally, as well as providing options for its various display settings:
relative, visual and absolute.

Bob

[-- Attachment #2: Type: text/html, Size: 1716 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-05 18:38 Emacs26: Quick thoughts on display-line-numbers-mode Robert Weiner
@ 2017-10-05 18:52 ` Matthew Plant
  2017-10-05 19:13   ` Eli Zaretskii
  2017-10-05 19:02 ` Eli Zaretskii
  1 sibling, 1 reply; 23+ messages in thread
From: Matthew Plant @ 2017-10-05 18:52 UTC (permalink / raw)
  To: emacs-devel

I agree with this, and also think there should be more customization
options.

Previously with linum I set the background of the fringe to be
different from the background of the buffer, so that the line number
column was distinct from the rest of the text buffer. It would be great
to have this option back, especially as I was excited that the
background color would finally reach the bottom of the screen when I
was reading the end of a file.

I think the two options needed for both of us would perhaps be some
sort of format string (perhaps identical to linum mode's) and then some
background option.

That being said display-line-numbers-mode effectively saved my desktop
experience. I have a 4k display so I will often have four windows of
the same file open vertically. I was recently doing this with a file
that is about 2k lines and inputting characters was causing so much
slow down that emacs was near unusable. Of course, profiling indicated
and action confirmed that linum mode was to blame.

Additionally with this change I can finally get rid of the fringe,
which makes resizing via mouse much easier.

On Thu, 2017-10-05 at 14:38 -0400, Robert Weiner wrote:
> I took a quick look at display-line-numbers-mode (nice work as
> always) and had a few thoughts:
> 
> 1. The similar linum-mode when possible displays a subtle vertical
> separator between the line numbers and the left margin of the text
> area.  This helps to visually parse the numbers as separate from the
> text and helps identify where the first text character is.  It would
> be good to have something similar at least as an option.
> 
> Then linum-mode should be removed (maybe add an alias) so there is no
> confusion as to which mode should be used.
> 
> 2. The mode-line popup menu that displays/hides line and col numbers
> in the mode=line could be expanded to toggle this mode on and off
> locally and globally, as well as providing options for its various
> display settings: relative, visual and absolute.
> 
> Bob
> 
> 
> 



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-05 18:38 Emacs26: Quick thoughts on display-line-numbers-mode Robert Weiner
  2017-10-05 18:52 ` Matthew Plant
@ 2017-10-05 19:02 ` Eli Zaretskii
  2017-10-05 19:44   ` Robert Weiner
  1 sibling, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2017-10-05 19:02 UTC (permalink / raw)
  To: rswgnu; +Cc: emacs-devel

> From: Robert Weiner <rsw@gnu.org>
> Date: Thu, 5 Oct 2017 14:38:12 -0400
> 
> 1. The similar linum-mode when possible displays a subtle vertical separator between the line numbers and
> the left margin of the text area. This helps to visually parse the numbers as separate from the text and helps
> identify where the first text character is. It would be good to have something similar at least as an option.

linum-mode displays line numbers in the left display margin.  I think
usurping the display margins for a display-related feature as popular
as line numbers is a bad idea, because it clashes with other
specialized features which want to use the margins, so I explicitly
coded the native line-number display not to do that.  Therefore, I
will object to having this new display on the display margins, even as
an option.

Separation between the numbers and the text is still kept, by means of
a white-space glyph.

> Then linum-mode should be removed (maybe add an alias) so there is no confusion as to which mode should
> be used.

I'm waiting for the pretests and the feedback we get to see if this
can be done.  It's possible that in some rare situations the new mode
will be inconvenient or unable to support.  If no such reports come
in, we will indeed retire linum-mode when Emacs 26.1 is released.

> 2. The mode-line popup menu that displays/hides line and col numbers in the mode=line could be expanded to
> toggle this mode on and off locally and globally, as well as providing options for its various display settings:
> relative, visual and absolute.

I'm not sure I agree.  The mode-line menu is for displays on the mode
line.  The display-line-numbers-mode and its variants can be turned on
or off from the menu bar's Options menu.

Thanks for your comments.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-05 18:52 ` Matthew Plant
@ 2017-10-05 19:13   ` Eli Zaretskii
       [not found]     ` <1507232129.15251.12.camel@gmail.com>
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2017-10-05 19:13 UTC (permalink / raw)
  To: Matthew Plant; +Cc: emacs-devel

> From: Matthew Plant <maplant95@gmail.com>
> Date: Thu, 05 Oct 2017 11:52:01 -0700
> 
> I agree with this, and also think there should be more customization
> options.

The display-line-numbers feature has no less than 7 customization
options and 3 sub-modes, most of them documented in the manual.  What
else is missing?

> Previously with linum I set the background of the fringe to be
> different from the background of the buffer, so that the line number
> column was distinct from the rest of the text buffer. It would be great
> to have this option back

This is already supported via 2 faces: the line-number face and
line-number-current-line face.  Or do I misunderstand what you want?



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-05 19:02 ` Eli Zaretskii
@ 2017-10-05 19:44   ` Robert Weiner
  2017-10-05 19:58     ` Eli Zaretskii
  0 siblings, 1 reply; 23+ messages in thread
From: Robert Weiner @ 2017-10-05 19:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2331 bytes --]

On Thu, Oct 5, 2017 at 3:02 PM, Eli Zaretskii <eliz@gnu.org> wrote:

>
> linum-mode displays line numbers in the left display margin.  I think
> usurping the display margins for a display-related feature as popular
> as line numbers is a bad idea, because it clashes with other
> specialized features which want to use the margins, so I explicitly
> coded the native line-number display not to do that.  Therefore, I
> will object to having this new display on the display margins, even as
> an option.
>

​Ok.
​

> ​​
>
> ​​
> Separation between the numbers and the text is still kept, by means of
> ​​
> a white-space glyph.
>

​So could you add a customization option for this glyph that would provide
some visual separation, e.g. a hairline or something similar to the visual
linum-mode provides?

​​
>
> ​​
> > Then linum-mode should be removed (maybe add an alias) so there is no
> confusion as to which mode should
> ​​
> > be used.
> ​​
>
> ​​
> I'm waiting for the pretests and the feedback we get to see if this
> ​​
> can be done.  It's possible that in some rare situations the new mode
> ​​
> will be inconvenient or unable to support.  If no such reports come
> ​​
> in, we will indeed retire linum-mode when Emacs 26.1 is released.
>

​Ok.​

​​
> > 2. The mode-line popup menu that displays/hides line and col numbers in
> the mode=line could be expanded to
> ​​
> > toggle this mode on and off locally and globally, as well as providing
> options for its various display settings:
> ​​
> > relative, visual and absolute.
> ​​
>
> ​​
> I'm not sure I agree.  The mode-line menu is for displays on the mode
> ​​
> line.  The display-line-numbers-mode and its variants can be turned on
> ​​
> or off from the menu bar's Options menu.
>
​
I see your point but do think in practice a lot of people would look to the
mode-line menu if they could.  Also, having all the options in one place
would let people decide which to use at any given point without hunting
around.  I know I look at mode-lines a lot more than the menubar.  It would
also force a cleanup of the menu item naming so that it was obvious where
each option will display its numbers.

​Bob
​

[-- Attachment #2: Type: text/html, Size: 5658 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
       [not found]     ` <1507232129.15251.12.camel@gmail.com>
@ 2017-10-05 19:50       ` Eli Zaretskii
  2017-10-05 20:07         ` Matthew Plant
  2017-10-05 23:24         ` Alex
  0 siblings, 2 replies; 23+ messages in thread
From: Eli Zaretskii @ 2017-10-05 19:50 UTC (permalink / raw)
  To: Matthew Plant; +Cc: emacs-devel

> From: Matthew Plant <maplant95@gmail.com>
> Date: Thu, 05 Oct 2017 12:35:29 -0700
> 
> My apologies, I did not notice that line-number face existed because it
> is not part of the display line numbers group. This does exactly what I
> want.
> 
> That being said, shouldn't this face be part of the group display-line-
> number? Faces for compilation errors are part of the the compilation
> group. 

My reasoning was that this is one of the basic faces we provide, so
it's in the basic faces group.

> Being able to specify which side the line numbers appear I imagine
> would be useful for editing right to left languages.

When the paragraph direction is right-to-left, the numbers
automatically appear on the right.  You should be able to see that if
you visit TUTORIAL.he with display-line-numbers-mode turned on.

> That being said I can't find one editor that supports this feature

Well, Emacs does ;-)

> You said in a separate reply that separation between the numbers and
> the text is kept with a white-space glyph. Why not just let this be a
> buffer or mode local string specified by the user?

There's a technical problem with doing that, which I couldn't solve.
It would also slow down redisplay, while performance was high on my
priority list when working on this feature.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-05 19:44   ` Robert Weiner
@ 2017-10-05 19:58     ` Eli Zaretskii
  2017-10-05 21:34       ` Robert Weiner
  2017-10-06  3:09       ` Matthew Plant
  0 siblings, 2 replies; 23+ messages in thread
From: Eli Zaretskii @ 2017-10-05 19:58 UTC (permalink / raw)
  To: rswgnu; +Cc: emacs-devel

> From: Robert Weiner <rsw@gnu.org>
> Date: Thu, 5 Oct 2017 15:44:54 -0400
> Cc: emacs-devel <emacs-devel@gnu.org>
> 
>  ​​Separation between the numbers and the text is still kept, by means of
>  ​​a white-space glyph.
> 
> ​So could you add a customization option for this glyph that would provide some visual separation, e.g. a
> hairline or something similar to the visual linum-mode provides?

There's a technical problem with doing that, for which I didn't have a
solution at the time and still don't.  Such an option would also slow
redisplay, albeit in minor ways.

>  ​​> 2. The mode-line popup menu that displays/hides line and col numbers in the mode=line could be
>  expanded to
>  ​​> toggle this mode on and off locally and globally, as well as providing options for its various display
>  settings:
>  ​​> relative, visual and absolute.
>  ​​
>  ​​I'm not sure I agree. The mode-line menu is for displays on the mode
>  ​​line. The display-line-numbers-mode and its variants can be turned on
>  ​​or off from the menu bar's Options menu.
> 
> ​I see your point but do think in practice a lot of people would look to the mode-line menu if they could. Also,
> having all the options in one place would let people decide which to use at any given point without hunting
> around. I know I look at mode-lines a lot more than the menubar.

Well, currently the mode line offers customization only of the stuff
that is displayed on the mode line, so I'm not sure why people would
look there or something else.

> It would also force a cleanup of the menu item
> naming so that it was obvious where each option will display its numbers.

Not sure I understand: the Options menu has Hide/Show sub-menu, which
is where we put all the toggle-type options.  Line-number display is
one of them.  So it looks like the current arrangement is consistent
with how we provide similar customizations.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-05 19:50       ` Eli Zaretskii
@ 2017-10-05 20:07         ` Matthew Plant
  2017-10-05 23:24         ` Alex
  1 sibling, 0 replies; 23+ messages in thread
From: Matthew Plant @ 2017-10-05 20:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On Thu, 2017-10-05 at 22:50 +0300, Eli Zaretskii wrote:
> > From: Matthew Plant <maplant95@gmail.com>
> > Date: Thu, 05 Oct 2017 12:35:29 -0700
> > 
> > My apologies, I did not notice that line-number face existed
> > because it
> > is not part of the display line numbers group. This does exactly
> > what I
> > want.
> > 
> > That being said, shouldn't this face be part of the group display-
> > line-
> > number? Faces for compilation errors are part of the the
> > compilation
> > group. 
> 
> My reasoning was that this is one of the basic faces we provide, so
> it's in the basic faces group.
> 
Hmm... Ok.

> > Being able to specify which side the line numbers appear I imagine
> > would be useful for editing right to left languages.
> 
> When the paragraph direction is right-to-left, the numbers
> automatically appear on the right.  You should be able to see that if
> you visit TUTORIAL.he with display-line-numbers-mode turned on.
> 
> > That being said I can't find one editor that supports this feature
> 
> Well, Emacs does ;-)
> 

I was silently wondering if this was the case. Oops, my bad.

> > You said in a separate reply that separation between the numbers
> > and
> > the text is kept with a white-space glyph. Why not just let this be
> > a
> > buffer or mode local string specified by the user?
> 
> There's a technical problem with doing that, which I couldn't solve.
> It would also slow down redisplay, while performance was high on my
> priority list when working on this feature.

If you can elaborate on the technical problem I can give it a look.
If the glyph is limited to one character and is properly cached I don't
see why this would be a specificaly worrisome performance hit. I can
see it being an issue if the glyph is changed a lot, but I don't think
this is a common use case.

I'm making some assumptions about the display code, I'll take a look at
the implementation.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-05 19:58     ` Eli Zaretskii
@ 2017-10-05 21:34       ` Robert Weiner
  2017-10-06  3:09       ` Matthew Plant
  1 sibling, 0 replies; 23+ messages in thread
From: Robert Weiner @ 2017-10-05 21:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 720 bytes --]

On Thu, Oct 5, 2017 at 3:58 PM, Eli Zaretskii <eliz@gnu.org> wrote:

>
> Not sure I understand: the Options menu has Hide/Show sub-menu, which
> is where we put all the toggle-type options.  Line-number display is
> one of them.  So it looks like the current arrangement is consistent
> with how we provide similar customizations.
>

​I see.  The menu items on that menu are exactly what I would put on the
modeline menu for quick access, though I would make it a one-level menu.
It takes a lot of time to go to Options, visually scan down the menu, find
Hide/Show, etc.  Versus a quick click on the modeline and you are setting
this.  Then either place people go would be wholly consistent.

Bob
​

[-- Attachment #2: Type: text/html, Size: 1543 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-05 19:50       ` Eli Zaretskii
  2017-10-05 20:07         ` Matthew Plant
@ 2017-10-05 23:24         ` Alex
  2017-10-06  6:48           ` Eli Zaretskii
  1 sibling, 1 reply; 23+ messages in thread
From: Alex @ 2017-10-05 23:24 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Matthew Plant, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> That being said, shouldn't this face be part of the group display-line-
>> number? Faces for compilation errors are part of the the compilation
>> group. 
>
> My reasoning was that this is one of the basic faces we provide, so
> it's in the basic faces group.

It appears that a face can be added to multiple groups. Perhaps this
should be done for the line-number* faces?



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-05 19:58     ` Eli Zaretskii
  2017-10-05 21:34       ` Robert Weiner
@ 2017-10-06  3:09       ` Matthew Plant
  2017-10-06  7:26         ` Eli Zaretskii
  1 sibling, 1 reply; 23+ messages in thread
From: Matthew Plant @ 2017-10-06  3:09 UTC (permalink / raw)
  To: Eli Zaretskii, rswgnu; +Cc: emacs-devel

On Thu, 2017-10-05 at 22:58 +0300, Eli Zaretskii wrote:
> > From: Robert Weiner <rsw@gnu.org>
> > Date: Thu, 5 Oct 2017 15:44:54 -0400
> > Cc: emacs-devel <emacs-devel@gnu.org>
> > 
> >  Separation between the numbers and the text is still kept, by
> > means of
> >  a white-space glyph.
> > 
> > So could you add a customization option for this glyph that would
> > provide some visual separation, e.g. a
> > hairline or something similar to the visual linum-mode provides?
> 
> There's a technical problem with doing that, for which I didn't have
> a
> solution at the time and still don't.  Such an option would also slow
> redisplay, albeit in minor ways.
> 
For now, you can go to src/xdisp.c:20996 and change the line:
    strcat (lnum_buf, " ");
to  
   strcat (lnum_buf, "|");

This change works pretty well, although it's not as nice as having a
complete line.

Although I think I like the pipe character better than the space.

> >  > 2. The mode-line popup menu that displays/hides line and col
> > numbers in the mode=line could be
> >  expanded to
> >  > toggle this mode on and off locally and globally, as well as
> > providing options for its various display
> >  settings:
> >  > relative, visual and absolute.
> >  
> >  I'm not sure I agree. The mode-line menu is for displays on the
> > mode
> >  line. The display-line-numbers-mode and its variants can be
> > turned on
> >  or off from the menu bar's Options menu.
> > 
> > I see your point but do think in practice a lot of people would
> > look to the mode-line menu if they could. Also,
> > having all the options in one place would let people decide which
> > to use at any given point without hunting
> > around. I know I look at mode-lines a lot more than the menubar.
> 
> Well, currently the mode line offers customization only of the stuff
> that is displayed on the mode line, so I'm not sure why people would
> look there or something else.
> 
> > It would also force a cleanup of the menu item
> > naming so that it was obvious where each option will display its
> > numbers.
> 
> Not sure I understand: the Options menu has Hide/Show sub-menu, which
> is where we put all the toggle-type options.  Line-number display is
> one of them.  So it looks like the current arrangement is consistent
> with how we provide similar customizations.
> 



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-05 23:24         ` Alex
@ 2017-10-06  6:48           ` Eli Zaretskii
  2017-10-07 21:12             ` Alex
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2017-10-06  6:48 UTC (permalink / raw)
  To: Alex; +Cc: maplant95, emacs-devel

> From: Alex <agrambot@gmail.com>
> Cc: Matthew Plant <maplant95@gmail.com>,  emacs-devel@gnu.org
> Date: Thu, 05 Oct 2017 17:24:15 -0600
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> That being said, shouldn't this face be part of the group display-line-
> >> number? Faces for compilation errors are part of the the compilation
> >> group. 
> >
> > My reasoning was that this is one of the basic faces we provide, so
> > it's in the basic faces group.
> 
> It appears that a face can be added to multiple groups.

Which other faces are in more than one group?

> Perhaps this should be done for the line-number* faces?

If this is established practice, no objections here.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-06  3:09       ` Matthew Plant
@ 2017-10-06  7:26         ` Eli Zaretskii
  2017-10-06  7:50           ` Matthew Plant
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2017-10-06  7:26 UTC (permalink / raw)
  To: Matthew Plant; +Cc: rswgnu, emacs-devel

> From: Matthew Plant <maplant95@gmail.com>
> Cc: emacs-devel@gnu.org
> Date: Thu, 05 Oct 2017 20:09:39 -0700
> 
> > There's a technical problem with doing that, for which I didn't have
> > a
> > solution at the time and still don't.  Such an option would also slow
> > redisplay, albeit in minor ways.
> > 
> For now, you can go to src/xdisp.c:20996 and change the line:
>     strcat (lnum_buf, " ");
> to  
>    strcat (lnum_buf, "|");

The problem with this is that in R2L paragraphs the glyph should
_precede_ the number, i.e. be to the left of the number.  And when the
number is generated for the first line to be redrawn, the paragraph
direction was not yet computed.  This is the technical problem to
which I alluded.  Until I find a way to solve it, such solutions
cannot be accepted, sorry.

> Although I think I like the pipe character better than the space.

That definitely depends on the font you are using.  Some fonts have an
extremely ugly pipe glyphs.  So this will have to be another
customization option, not just a hard-coded character.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-06  7:26         ` Eli Zaretskii
@ 2017-10-06  7:50           ` Matthew Plant
  2017-10-06  8:16             ` Eli Zaretskii
  0 siblings, 1 reply; 23+ messages in thread
From: Matthew Plant @ 2017-10-06  7:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rswgnu, emacs-devel

Yes, I should have read the comment literally right above the line I suggested changing. 
I didn’t mean to offer that snippet as a solution, just as a suggestion for anyone compiling themselves. I would be more formal otherwise.
If I understand the problem correctly, since orientation depends on paragraph, does that mean line numbers could be on different sides in the same window?
I think I have an approach for fixing this

> On Oct 6, 2017, at 12:26 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Matthew Plant <maplant95@gmail.com>
>> Cc: emacs-devel@gnu.org
>> Date: Thu, 05 Oct 2017 20:09:39 -0700
>> 
>>> There's a technical problem with doing that, for which I didn't have
>>> a
>>> solution at the time and still don't.  Such an option would also slow
>>> redisplay, albeit in minor ways.
>>> 
>> For now, you can go to src/xdisp.c:20996 and change the line:
>>    strcat (lnum_buf, " ");
>> to  
>>   strcat (lnum_buf, "|");
> 
> The problem with this is that in R2L paragraphs the glyph should
> _precede_ the number, i.e. be to the left of the number.  And when the
> number is generated for the first line to be redrawn, the paragraph
> direction was not yet computed.  This is the technical problem to
> which I alluded.  Until I find a way to solve it, such solutions
> cannot be accepted, sorry.
> 
>> Although I think I like the pipe character better than the space.
> 
> That definitely depends on the font you are using.  Some fonts have an
> extremely ugly pipe glyphs.  So this will have to be another
> customization option, not just a hard-coded character.




^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-06  7:50           ` Matthew Plant
@ 2017-10-06  8:16             ` Eli Zaretskii
  2017-10-06 12:37               ` Stefan Monnier
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2017-10-06  8:16 UTC (permalink / raw)
  To: Matthew Plant; +Cc: rswgnu, emacs-devel

> From: Matthew Plant <maplant95@gmail.com>
> Date: Fri, 6 Oct 2017 00:50:10 -0700
> Cc: rswgnu@gmail.com,
>  emacs-devel@gnu.org
> 
> If I understand the problem correctly, since orientation depends on paragraph, does that mean line numbers could be on different sides in the same window?

Yes.  You can see that in action if you visit TUTORIAL.he with
display-line-numbers-mode turned on.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-06  8:16             ` Eli Zaretskii
@ 2017-10-06 12:37               ` Stefan Monnier
  2017-10-06 13:06                 ` Eli Zaretskii
  0 siblings, 1 reply; 23+ messages in thread
From: Stefan Monnier @ 2017-10-06 12:37 UTC (permalink / raw)
  To: emacs-devel

>> If I understand the problem correctly, since orientation depends on
>> paragraph, does that mean line numbers could be on different sides in the
>> same window?
> Yes.  You can see that in action if you visit TUTORIAL.he with
> display-line-numbers-mode turned on.

Oh, wow, I hadn't realized that.  Is that the generally expected behavior?

As a naive user who can't read any R2L scripts, I find this very
unexpected.  I'd have expected/wanted instead the line numbers to always
be on the same side for a given window (tho I admit that I'm not sure
how to turn this rule into an implementable behavior, except maybe by
letting the user decide globally whether line numbers should be on the
left or the right).

But again, I'm just a very naive user who's never bothered by the
current behavior because he never faces such situations anyway.


        Stefan




^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-06 12:37               ` Stefan Monnier
@ 2017-10-06 13:06                 ` Eli Zaretskii
  2017-10-06 13:25                   ` John Wiegley
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2017-10-06 13:06 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Fri, 06 Oct 2017 08:37:37 -0400
> 
> >> If I understand the problem correctly, since orientation depends on
> >> paragraph, does that mean line numbers could be on different sides in the
> >> same window?
> > Yes.  You can see that in action if you visit TUTORIAL.he with
> > display-line-numbers-mode turned on.
> 
> Oh, wow, I hadn't realized that.  Is that the generally expected behavior?

I don't know.  It doesn't strike me as blatantly wrong, to give you
just one data point.  I guess we will have to hear more from users.
In general, buffers with changing paragraph direction are quite rare,
btw.

> As a naive user who can't read any R2L scripts, I find this very
> unexpected.  I'd have expected/wanted instead the line numbers to always
> be on the same side for a given window (tho I admit that I'm not sure
> how to turn this rule into an implementable behavior, except maybe by
> letting the user decide globally whether line numbers should be on the
> left or the right).

Currently, the only way of doing that is set bidi-paragraph-direction
to a non-nil value.

> But again, I'm just a very naive user who's never bothered by the
> current behavior because he never faces such situations anyway.

Thanks, noted.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-06 13:06                 ` Eli Zaretskii
@ 2017-10-06 13:25                   ` John Wiegley
  2017-10-06 14:17                     ` Eli Zaretskii
  0 siblings, 1 reply; 23+ messages in thread
From: John Wiegley @ 2017-10-06 13:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, emacs-devel

EZ> I don't know. It doesn't strike me as blatantly wrong, to give you just
EZ> one data point. I guess we will have to hear more from users. In general,
EZ> buffers with changing paragraph direction are quite rare, btw.

As someone who edits R2L buffers, I'd prefer line numbers always being on one
side of the buffer or the other -- hopefully with an easy way to fix the side,
or toggle it depending on what I'm doing. English text with R2L in it is
usually a different scenario than R2L with some English in it.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-06 13:25                   ` John Wiegley
@ 2017-10-06 14:17                     ` Eli Zaretskii
  2017-10-06 18:47                       ` John Wiegley
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2017-10-06 14:17 UTC (permalink / raw)
  To: John Wiegley; +Cc: monnier, emacs-devel

> From: "John Wiegley" <johnw@gnu.org>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,  emacs-devel@gnu.org
> Date: Fri, 06 Oct 2017 09:25:09 -0400
> 
> EZ> I don't know. It doesn't strike me as blatantly wrong, to give you just
> EZ> one data point. I guess we will have to hear more from users. In general,
> EZ> buffers with changing paragraph direction are quite rare, btw.
> 
> As someone who edits R2L buffers, I'd prefer line numbers always being on one
> side of the buffer or the other -- hopefully with an easy way to fix the side,
> or toggle it depending on what I'm doing. English text with R2L in it is
> usually a different scenario than R2L with some English in it.

If you have R2L text with some English in it, you can easily arrange
for paragraph direction always being R2L.

But your opinion is noted, thanks.  I still think we need much more
feedback before we decide to change the current implementation,
especially since it's not a trivial change.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-06 14:17                     ` Eli Zaretskii
@ 2017-10-06 18:47                       ` John Wiegley
  0 siblings, 0 replies; 23+ messages in thread
From: John Wiegley @ 2017-10-06 18:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: monnier, emacs-devel

>>>>> Eli Zaretskii <eliz@gnu.org> writes:

> But your opinion is noted, thanks. I still think we need much more feedback
> before we decide to change the current implementation, especially since it's
> not a trivial change.

Agreed.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-06  6:48           ` Eli Zaretskii
@ 2017-10-07 21:12             ` Alex
  2017-10-08  7:44               ` Eli Zaretskii
  0 siblings, 1 reply; 23+ messages in thread
From: Alex @ 2017-10-07 21:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: maplant95, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex <agrambot@gmail.com>
>> Cc: Matthew Plant <maplant95@gmail.com>,  emacs-devel@gnu.org
>> Date: Thu, 05 Oct 2017 17:24:15 -0600
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> That being said, shouldn't this face be part of the group display-line-
>> >> number? Faces for compilation errors are part of the the compilation
>> >> group. 
>> >
>> > My reasoning was that this is one of the basic faces we provide, so
>> > it's in the basic faces group.
>> 
>> It appears that a face can be added to multiple groups.
>
> Which other faces are in more than one group?

Here are some in face.el:
mode-line*
window-divider*
fringe
cursor
mouse
menu

>> Perhaps this should be done for the line-number* faces?
>
> If this is established practice, no objections here.

Okay, I've attached a patch which does this. Additionally, I added the
`display-line-numbers' group to the `convenience' group since (n)linum
belong to that group. nlinum belongs to 2 groups already, as do groups
such as `message' and `mode-line-faces', so it should also be fine.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: d-l-n --]
[-- Type: text/x-diff, Size: 1602 bytes --]

From 1b78dd8aa2757e9901b2e0ed69a9e7ea55350284 Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Sat, 7 Oct 2017 15:02:01 -0600
Subject: [PATCH] Add line-number faces to the display-line-numbers group

* lisp/faces.el (line-number):
(line-number-current-line): Add to the display-line-numbers group.
* lisp/display-line-numbers.el (display-line-numbers): Add to the
convenience group.
---
 lisp/display-line-numbers.el | 1 +
 lisp/faces.el                | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/display-line-numbers.el b/lisp/display-line-numbers.el
index 3b6b101de4..15e0427915 100644
--- a/lisp/display-line-numbers.el
+++ b/lisp/display-line-numbers.el
@@ -36,6 +36,7 @@
 
 (defgroup display-line-numbers nil
   "Display line numbers in the buffer."
+  :group 'convenience
   :group 'display)
 
 (defcustom display-line-numbers-type t
diff --git a/lisp/faces.el b/lisp/faces.el
index 24ab1fa4f0..a5f1d1dd32 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2483,7 +2483,8 @@ line-number
 and text lines might move horizontally as you move through
 the buffer."
   :version "26.1"
-  :group 'basic-faces)
+  :group 'basic-faces
+  :group 'display-line-numbers)
 
 (defface line-number-current-line
   '((t :inherit line-number))
@@ -2497,7 +2498,8 @@ line-number-current-line
 from that of the `line-number' face could produce such
 unwanted effects."
   :version "26.1"
-  :group 'basic-faces)
+  :group 'basic-faces
+  :group 'display-line-numbers)
 
 (defface escape-glyph
   '((((background dark)) :foreground "cyan")
-- 
2.14.2


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-07 21:12             ` Alex
@ 2017-10-08  7:44               ` Eli Zaretskii
  2017-10-09  0:06                 ` Alex
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2017-10-08  7:44 UTC (permalink / raw)
  To: Alex; +Cc: maplant95, emacs-devel

> From: Alex <agrambot@gmail.com>
> Cc: maplant95@gmail.com,  emacs-devel@gnu.org
> Date: Sat, 07 Oct 2017 15:12:11 -0600
> 
> > Which other faces are in more than one group?
> 
> Here are some in face.el:
> mode-line*
> window-divider*
> fringe
> cursor
> mouse
> menu

Thanks, I'm convinced.

> Okay, I've attached a patch which does this. Additionally, I added the
> `display-line-numbers' group to the `convenience' group since (n)linum
> belong to that group. nlinum belongs to 2 groups already, as do groups
> such as `message' and `mode-line-faces', so it should also be fine.

"Convenience" is a lousy name for a customization group, as it doesn't
really convey any meaning.  But I guess that's water under the bridge
now.

The patch LGTM, please push to the release branch.  I would suggest to
mention in the log message the URL of the first message in this
thread.

TIA



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Emacs26: Quick thoughts on display-line-numbers-mode
  2017-10-08  7:44               ` Eli Zaretskii
@ 2017-10-09  0:06                 ` Alex
  0 siblings, 0 replies; 23+ messages in thread
From: Alex @ 2017-10-09  0:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: maplant95, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> "Convenience" is a lousy name for a customization group, as it doesn't
> really convey any meaning.  But I guess that's water under the bridge
> now.

I suppose so, unless there's a way to define group aliases?

> The patch LGTM, please push to the release branch.  I would suggest to
> mention in the log message the URL of the first message in this
> thread.
>
> TIA

Sure, pushed.



^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2017-10-09  0:06 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-05 18:38 Emacs26: Quick thoughts on display-line-numbers-mode Robert Weiner
2017-10-05 18:52 ` Matthew Plant
2017-10-05 19:13   ` Eli Zaretskii
     [not found]     ` <1507232129.15251.12.camel@gmail.com>
2017-10-05 19:50       ` Eli Zaretskii
2017-10-05 20:07         ` Matthew Plant
2017-10-05 23:24         ` Alex
2017-10-06  6:48           ` Eli Zaretskii
2017-10-07 21:12             ` Alex
2017-10-08  7:44               ` Eli Zaretskii
2017-10-09  0:06                 ` Alex
2017-10-05 19:02 ` Eli Zaretskii
2017-10-05 19:44   ` Robert Weiner
2017-10-05 19:58     ` Eli Zaretskii
2017-10-05 21:34       ` Robert Weiner
2017-10-06  3:09       ` Matthew Plant
2017-10-06  7:26         ` Eli Zaretskii
2017-10-06  7:50           ` Matthew Plant
2017-10-06  8:16             ` Eli Zaretskii
2017-10-06 12:37               ` Stefan Monnier
2017-10-06 13:06                 ` Eli Zaretskii
2017-10-06 13:25                   ` John Wiegley
2017-10-06 14:17                     ` Eli Zaretskii
2017-10-06 18:47                       ` John Wiegley

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