emacs-devel
[Top][All Lists]
Advanced

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

Re: Native display of line numbers


From: Eli Zaretskii
Subject: Re: Native display of line numbers
Date: Sat, 17 Jun 2017 20:41:05 +0300

> From: Kaushal Modi <address@hidden>
> Date: Sat, 17 Jun 2017 16:52:11 +0000
> 
>  . 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.

nlinum performed so poorly in my benchmarks that I was ashamed of
publishing the data.  The benchmark entails scrolling through xdisp.c
one line at a time.  The code is at the end of this message (it was
posted by Dmitry Antipov), you can try it yourself.  The first run is
always slow because Emacs fontifies on the fly, so I timed only the
second run.

> 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)?

Is it really important?  Why? do people really have difficulty finding
the line where point/cursor is?

I could add this feature if it's deemed important, but it will slow
down redisplay to some extent, because cursor motion can no longer be
considered affecting the cursor alone.

> 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.

The menu bar is for simple uses, I see no reason to put all the
complexity of a defcustom on the menu bar.

> 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?

Minor mode is probably due anyway, but that is independent of the menu
bar.

Anyway, these are simple things that can always be fixed later.  If
those are the only issues with this new feature, then I'm very lucky
(yeah, right).

Thanks for taking time to try the branch.

======================================================================

(defun scroll-up-benchmark ()
  (interactive)
  (let ((oldgc gcs-done)
        (oldtime (float-time)))
    (condition-case nil (while t (scroll-up) (redisplay))
      (error (message "GCs: %d Elapsed time: %f seconds"
                      (- gcs-done oldgc) (- (float-time) oldtime))))))



reply via email to

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