all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Filipe Silva <filipe.silva@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Native display of line numbers: visual line-counting
Date: Tue, 27 Jun 2017 18:00:17 +0300	[thread overview]
Message-ID: <834lv1scfy.fsf@gnu.org> (raw)
In-Reply-To: <CAEwkUWN-W94hfP1N=QR2A91Ae_bVBbX1xZpzPPuRQ8siMir5oA@mail.gmail.com> (message from Filipe Silva on Tue, 27 Jun 2017 10:29:28 -0300)

> From: Filipe Silva <filipe.silva@gmail.com>
> 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)))



  parent reply	other threads:[~2017-06-27 15:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-24 18:15 Native display of line numbers: visual line-counting Eli Zaretskii
2017-06-24 19:03 ` Joseph Garvin
2017-06-24 19:22   ` Eli Zaretskii
2017-06-24 20:13     ` Joseph Garvin
2017-06-24 20:42 ` James Nguyen
2017-06-25 19:16 ` Stefan Monnier
2017-06-25 19:31   ` Joseph Garvin
2017-06-25 20:20     ` Stefan Monnier
2017-06-26  2:37       ` Eli Zaretskii
2017-06-26  2:35     ` Eli Zaretskii
     [not found] ` <CAEwkUWN-W94hfP1N=QR2A91Ae_bVBbX1xZpzPPuRQ8siMir5oA@mail.gmail.com>
2017-06-27 15:00   ` Eli Zaretskii [this message]
2017-06-27 16:26     ` Filipe Silva

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834lv1scfy.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=filipe.silva@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.