unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Native display of line numbers
Date: Sat, 17 Jun 2017 16:52:11 +0000	[thread overview]
Message-ID: <CAFyQvY1zY2YEESZBdDT0t_VjMwOt90=vwxbq==1aw3oyLn3Hog@mail.gmail.com> (raw)
In-Reply-To: <83lgoqzm0v.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 2544 bytes --]

Hi Eli,

First of all, thank you for working on this!

On Sat, Jun 17, 2017 at 11:12 AM Eli Zaretskii <eliz@gnu.org> wrote:

> I generally consider display of line numbers for each line in the
> buffer un-Emacsy, something that came from the dark era when we needed
> to count lines to be able to tell the then existing editors something
> like "move down N lines, then DO SOMETHING".  Emacs pioneered today's
> world where all this is unnecessary, and the rest is history.
>

While I don't use the line numbers that way, it's very useful to pinpoint a
colleague directly to a piece of code, especially when not sharing the code
visually; like when over a phone call: "Hey, open up the "foo" file and
look at line 1534.". Nothing beats the precision of that.


> However, many users want line numbers to be displayed in Emacs.  I
> don't know why they want it, perhaps they were "spoiled" by other IDEs
> or something.


Above.


> So with that in mind, I came up with an implementation of a native
> display of line numbers.  You can find it in the scratch/line-numbers
> branch of the Emacs repository.


Thanks!


> Compared with linum-mode,
> nlinum-mode, and other similar modes, it has the following main
> advantages:
>
>   . it works significantly faster (almost twice as fast as linum-mode,
>     50% faster that relative-line-numbers-mode)
>

How does it compare to nlinum.el in your initial testing? I will also test
it out over next few days.


> Please give it a try and report any bugs you find.
>

Here's my first observation after building from that branch.

In the below image, on the left I have emacs -Q running that has the new
line number feature enabled, and on the right I have older emacs instance
running with nlinum.el enabled.

[image: image.png]
Can you please add support for highlighting the current line number, using
a different face (See the highlighted line number by nlinum on the right
hand side)?

About the code:

+(defun toggle-display-line-numbers ()
+ (interactive)
+ (if display-line-numbers
+ (setq display-line-numbers nil)
+ (setq display-line-numbers t))
+ (force-mode-line-update))

Instead of this, about about a minor mode with an intuitive name like
"line-numbers-mode"? Above also has an issue, I believe.. If user has set
display-line-numbers to 'relative, toggling it will always set it back to t.

How about leaving the buffer local display-line-numbers definition as it
is, but replacing toggle-display-line-numbers function with a minor mode
line-numbers-mode?

Thanks!
-- 

Kaushal Modi

[-- Attachment #1.2: Type: text/html, Size: 4676 bytes --]

[-- Attachment #2: image.png --]
[-- Type: image/png, Size: 249811 bytes --]

  parent reply	other threads:[~2017-06-17 16:52 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 [this message]
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
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='CAFyQvY1zY2YEESZBdDT0t_VjMwOt90=vwxbq==1aw3oyLn3Hog@mail.gmail.com' \
    --to=kaushal.modi@gmail.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 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).