From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Native display of line numbers
Date: Sun, 18 Jun 2017 15:47:05 +0000 [thread overview]
Message-ID: <20170618154705.GB22671@acm> (raw)
In-Reply-To: <83r2yhxrlv.fsf@gnu.org>
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: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>
> > 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).
next prev parent reply other threads:[~2017-06-18 15:47 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-17 15:12 Native display of line numbers Eli Zaretskii
2017-06-17 16:41 ` Stefan Monnier
2017-06-17 18:25 ` Eli Zaretskii
2017-06-17 21:25 ` Stefan Monnier
2017-06-18 14:21 ` Eli Zaretskii
2017-06-17 16:52 ` Kaushal Modi
2017-06-17 17:20 ` Kaushal Modi
2017-06-17 17:42 ` Eli Zaretskii
2017-06-17 17:41 ` Eli Zaretskii
2017-06-17 21:16 ` Stefan Monnier
2017-06-18 4:27 ` Kaushal Modi
2017-06-18 14:40 ` Eli Zaretskii
2017-06-17 20:27 ` Alan Mackenzie
2017-06-17 21:26 ` Stefan Monnier
2017-06-18 2:35 ` Eli Zaretskii
2017-06-18 11:42 ` Alan Mackenzie
2017-06-18 12:16 ` Colin Baxter
2017-06-18 15:06 ` Eli Zaretskii
2017-06-18 15:47 ` Alan Mackenzie [this message]
2017-06-18 16:11 ` Eli Zaretskii
2017-06-18 20:19 ` Alan Mackenzie
2017-06-19 2:28 ` Eli Zaretskii
2017-06-17 20:47 ` Sébastien Le Callonnec
2017-06-18 2:38 ` Eli Zaretskii
2017-06-18 10:51 ` Sébastien Le Callonnec
2017-06-17 21:32 ` Mathias Dahl
2017-06-17 22:12 ` James Nguyen
2017-06-18 14:31 ` Eli Zaretskii
2017-06-19 2:25 ` James Nguyen
2017-06-19 15:32 ` Eli Zaretskii
2017-06-19 16:33 ` James Nguyen
2017-06-18 14:28 ` Eli Zaretskii
2017-06-18 14:42 ` Andreas Schwab
2017-06-18 8:44 ` martin rudalics
2017-06-18 8:58 ` martin rudalics
2017-06-18 14:46 ` Eli Zaretskii
2017-06-19 2:39 ` Eli Zaretskii
2017-06-19 8:04 ` martin rudalics
2017-06-19 15:13 ` Eli Zaretskii
2017-06-18 11:03 ` Yuri Khan
2017-06-18 14:54 ` Eli Zaretskii
2017-06-18 16:54 ` Yuri Khan
2017-06-18 19:00 ` Eli Zaretskii
2017-06-19 5:32 ` Yuri Khan
2017-06-19 15:51 ` Eli Zaretskii
2017-06-24 10:32 ` Eli Zaretskii
2017-06-18 19:41 ` Daniele Nicolodi
2017-06-18 20:04 ` Eli Zaretskii
2017-06-18 20:48 ` Daniele Nicolodi
2017-06-19 2:31 ` Eli Zaretskii
2017-06-19 3:07 ` Daniele Nicolodi
2017-06-19 15:03 ` Eli Zaretskii
2017-06-19 2:44 ` Clément Pit-Claudel
2017-06-19 4:15 ` Eli Zaretskii
2017-06-19 4:30 ` Clément Pit-Claudel
2017-06-18 22:20 ` Scott Jaderholm
2017-06-19 2:34 ` Eli Zaretskii
2017-06-19 5:49 ` Scott Jaderholm
2017-06-19 16:56 ` Stephen Leake
2017-06-19 17:11 ` Eli Zaretskii
2017-06-19 18:43 ` Stephen Leake
2017-06-19 19:32 ` Eli Zaretskii
2017-06-19 18:39 ` Alan Mackenzie
2017-06-19 19:28 ` Eli Zaretskii
2017-06-19 19:38 ` Alan Mackenzie
2017-06-19 19:51 ` Eli Zaretskii
2017-06-22 15:02 ` Filipe Silva
2017-06-22 15:38 ` Eli Zaretskii
2017-06-22 15:46 ` Filipe Silva
2017-06-23 16:23 ` Stefan Monnier
2017-06-23 21:04 ` Eli Zaretskii
2017-06-23 21:24 ` Stefan Monnier
2017-06-24 7:18 ` Eli Zaretskii
2017-06-22 16:27 ` Yuri Khan
2017-06-22 16:56 ` Stephen Berman
2017-06-23 11:10 ` Filipe Silva
2017-06-23 11:17 ` Filipe Silva
-- strict thread matches above, loose matches on Subject: below --
2017-06-17 23:44 Joseph Garvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170618154705.GB22671@acm \
--to=acm@muc.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).