emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Native display of line numbers


From: Alan Mackenzie
Subject: Re: Native display of line numbers
Date: Sun, 18 Jun 2017 15:47:05 +0000
User-agent: Mutt/1.7.2 (2016-11-26)

Hello, Eli.

On Sun, Jun 18, 2017 at 18:06:36 +0300, Eli Zaretskii wrote:
> > Date: Sun, 18 Jun 2017 11:42:51 +0000
> > Cc: address@hidden
> > From: Alan Mackenzie <address@hidden>

> > 1. Enable relative line numbers globally.
> > 2. Visit a file, put it in two or several side by side windows.
> > 3. Start follow-mode.

> > The relative line numbers are now "global", in that they are relative to
> > point in the selected window.

> That's not what I see.  I guess you see that because you activate
> line-number display when both windows had the same value of point.

Line-number display was already globally enabled when the windows were
created.  But point in each window was indeed the same (see my function 
`3-column' below).

> If you move point in one of the windows before activating line numbers,
> you will see that the relative numbers are local to each window.  This
> is by design, and the add-on package relative-line-numbers does the
> same.

> > 4. Do something, such as C-n, which causes a redisplay.

> > The relative numbers are now "local", in that they are relative to point
> > in each window.

> Well, here they are local to begin with.

> > I think it would be best if the "global" relative line numbers could be
> > made to work.

> Given a window whose buffer is in Follow Mode, how do I know what is
> the "correct" value of point to use in that window to make the
> relative numbers "global"?

I don't see that this can easily be done, since follow-mode more fights
the display engine rather than working with it.  The display engine is
currently unaware of follow-mode.  My comment was partly to point out how
nice it would be if follow-mode support could be implemented in the
display engine.

> > If not, it would be better if the "local" line numbers appeared
> > after M-x follow-mode.

> Well, they are local here to begin with.  Maybe I didn't understand
> your recipe -- can you show it in full detail, with all the commands
> you type?

OK.

Firstly, I found this on a Linux tty, but it appears in an X session,
too.

$ emacs --no-desktop
M-x customize-variable<RET>display-line-numbers<RET>
  <set display-line-numbers to relative using the keyboard or mouse and
  save it for the session>
C-x C-f path/to/src/xdisp.c
If in X, maximise the selected window using the mouse.
C-c 3 ; see below.

The displayed line-numbers are now "global", and range from 0 to 194

C-n

The displayed line-numbers in the "other two" windows now range from -31
to 33.

########################################################################
(defun 3-column ()
  "Disply the current buffer in 3 columns with Follow Mode"
  (interactive)
  (follow-mode 1)
  (delete-other-windows)
  (split-window-horizontally) (split-window-horizontally)
  (balance-windows))
(global-set-key "\C-c3" '3-column)
########################################################################

I've found another bug, I'm afraid.  Starting off from the above
situation, with point in the middle window (in X windows), do M-<.  The
relative line numbers in the middle window now range from -59 to -20,
with that window's point at relative line -39.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]