all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: James Nguyen <jamesn@fastmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Native display of line numbers: visual line-counting
Date: Sat, 24 Jun 2017 13:42:21 -0700	[thread overview]
Message-ID: <A7B8A496-363C-4209-B780-A9EE928A44B4@fastmail.com> (raw)
In-Reply-To: <83podttfpy.fsf@gnu.org>

>> First, this makes sense only for relative line numbers, right?  If not
>> I don't really understand what would be the definition of "visually
>> counted first line shown in a window".  If everyone agrees, it would
>> mean that the current line will have the number of zero, right?  or do
>> people still want to see the "physical line number" for the current
>> line in this case?

I am thinking about it in terms of code folding.
Each fold becomes the mark of the new line number.

1. static int internal_self_insert (int, EMACS_INT); // Absolute line number of 1
1. DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
2.        doc: /* Return buffer position N characters after (before if N negative) point.  */)
3.   (Lisp_Object n)
4. {
5.   CHECK_NUMBER (n);
6. 
7.   return make_number (PT + XINT (n));
8. }
9. 
10. 
11. static Lisp_Object
12. move_point (Lisp_Object n, bool forward)
13. {
14.   SET_PT (new_point);
15.   return Qnil;
16. }

Becomes

1. static int internal_self_insert (int, EMACS_INT); {} // FOLD // Absolute Line number of 1
1. 
2. 
3. static Lisp_Object
4. move_point (Lisp_Object n, bool forward) {} // FOLD

I'd like the current line to still represent the current absolute line number
of the file.


> On Jun 24, 2017, at 11:15 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> So a few people requested this feature, and I started thinking about
> its implementation.  Immediately I bumped into several issues that I'm
> not sure how to resolve, since I don't really understand how this will
> be used in Emacs.
> 
> First, this makes sense only for relative line numbers, right?  If not
> I don't really understand what would be the definition of "visually
> counted first line shown in a window".  If everyone agrees, it would
> mean that the current line will have the number of zero, right?  or do
> people still want to see the "physical line number" for the current
> line in this case?
> 
> Next, the only use case which I fully understand is the one with
> some of the lines folded, as in Org or Outline modes.  More
> accurately, the case where text is not displayed because it was made
> invisible by the 'invisible' property of some kind -- these lines are
> not to be counted under this mode.
> 
> But that is not the only case where what is displayed does not
> correspond to buffer text 1:1.  Some text on the screen might come
> from display properties or from before- and after-strings.  These can
> include embedded newlines, and this contribute to "visual lines" Emacs
> displays.  Are these lines to be counted or not?  Should Emacs display
> something for their "line numbers" or not?
> 
> We need to resolve all these and possibly other subtleties before the
> feature can be implemented.  Ideas and opinions are welcome.
> 
> TIA
> 




  parent reply	other threads:[~2017-06-24 20:42 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 [this message]
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
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=A7B8A496-363C-4209-B780-A9EE928A44B4@fastmail.com \
    --to=jamesn@fastmail.com \
    --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 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.