[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
line-number-mode at EOB (was: Native display of line numbers, improved)
From: |
Stephen Berman |
Subject: |
line-number-mode at EOB (was: Native display of line numbers, improved) |
Date: |
Tue, 18 Jul 2017 00:20:10 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
On Sun, 25 Jun 2017 16:34:01 +0200 Stephen Berman <address@hidden> wrote:
> On Sun, 25 Jun 2017 17:03:30 +0300 Eli Zaretskii <address@hidden> wrote:
>
>>> From: Stephen Berman <address@hidden>
>>> Cc: address@hidden
>>> Date: Sat, 24 Jun 2017 23:23:15 +0200
>>>
>>> When the buffer ends with a newline and point is on it, no line number
>>> is displayed on the left, though with line-number-mode enabled the mode
>>> line does display the line number.
>>
>> By "point is on it", I guess you mean point is at EOB, i.e. beyond the
>> last character position? Because otherwise, I don't think I see what
>> you describe.
>
> Yes, I meant at EOB.
>
>> If this is about point at EOB, then this is the intended behavior: the
>> "line" where we position cursor in that case doesn't exist, so it
>> would be IMO incorrect to count it.
>
> By that reasoning, line-number-mode (the %l construct) should be changed
> so as not to display a number when point is at EOB. Perhaps it should
> display "EOB" or "END" instead.
I attempted to implement this change in the mode line display (see
attached patch) and the result, while admittedly only "minor aesthetic
sugar", seems to me not too bad: it makes line-number-mode consistent
not only with vertically displayed line numbers but also with
`count-words-region' (and hence with `count-lines'). What do others
think?
If this change is accepted, then the command `what-line' should probably
also be changed to return "EOB" at EOB. (Such a change makes sense even
if line-number-mode is not changed, since it seems odd that e.g. in the
standard *scratch* buffer `C-x h M-=' reports "Region has 3 lines..."
while calling `what-line' at EOB reports "Line 4".)
Steve Berman
txtO69f9TAdzd.txt
Description: line-number-mode at EOB patch
- line-number-mode at EOB (was: Native display of line numbers, improved),
Stephen Berman <=
- Re: line-number-mode at EOB, Stefan Monnier, 2017/07/18
- Re: line-number-mode at EOB, Stephen Berman, 2017/07/18
- Re: line-number-mode at EOB, Stefan Monnier, 2017/07/18
- Re: line-number-mode at EOB, Eli Zaretskii, 2017/07/18
- Re: line-number-mode at EOB, Stefan Monnier, 2017/07/18
- Re: line-number-mode at EOB, Paul Eggert, 2017/07/20
- Re: line-number-mode at EOB, Stephen Berman, 2017/07/20
- Re: line-number-mode at EOB, Paul Eggert, 2017/07/20
- Re: line-number-mode at EOB, Stephen Berman, 2017/07/20
Re: line-number-mode at EOB (was: Native display of line numbers, improved), Eli Zaretskii, 2017/07/18