emacs-devel
[Top][All Lists]
Advanced

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

Re: Native display of line numbers: visual line-counting


From: Eli Zaretskii
Subject: Re: Native display of line numbers: visual line-counting
Date: Tue, 27 Jun 2017 18:00:17 +0300

> From: Filipe Silva <address@hidden>
> Date: Tue, 27 Jun 2017 10:29:28 -0300
> 
> Having the real line number instead of 0 would give us a more useful 
> information instead of just 0, but showing
> 0 is totally fine if it makes the implementation easier.

It doesn't matter from the implementation POV, so real line number it
is.

> in vim, the visual relative line number does not take into account wrapped 
> lines. if a line is big enough that
> spans multiple lines in the buffer, all of that count as 1 and only the first 
> segment of the wrapper line is
> numbered. you can always use 'gj' to navigate wrapper lines.

This contradicts the only set of requirements I saw posted about this
(by several people): show line numbers that are consistent with
vertical movement commands like C-n and C-p.  Which means wrapped
lines should be counted, as Emacs moves visually, at least by default.

> Yes, org-mode and folding are the only cases I know off that would require a 
> visual relative line number
> implementation. I don't know what is display properties, nor before and after 
> strings. Can someone state an
> example ?

If you use magit, you have a lot of them, I think.

Here's a toy example, due to Dmitry.  Evaluate this in *scratch*, then
switch to the popup-test.el buffer.  The multi-line "aaaaa" part is an
overlay after-string.

(with-current-buffer (get-buffer-create "popup-test.el")
   (setq display-line-numbers t)
   (insert "aaaaaaa
aaaaaaa
aaaaaaa
aaaaaaa
aaaaaaa
")

   (let ((ov (make-overlay (point-max) (point-max))))
     (overlay-put ov 'after-string "bbbbbb\nbbbbbb\n")
     (overlay-put ov 'display-line-numbers-disable t)))



reply via email to

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