unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How to get the line offset in `display-line-numbers-mode'?
@ 2020-01-31 18:14 Bastien
  2020-01-31 18:44 ` Mattias Engdegård
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2020-01-31 18:14 UTC (permalink / raw)
  To: emacs-devel

Hi,

Assuming display-line-numbers-mode is turned on, how can I get
the number of spaces this mode uses for displaying numbers?

Line numbers on the left don't seem to use overlays or even
text properties for the display, so I don't know where to look
for getting this information for a given line.

Thanks for any pointers,

-- 
 Bastien



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to get the line offset in `display-line-numbers-mode'?
  2020-01-31 18:14 How to get the line offset in `display-line-numbers-mode'? Bastien
@ 2020-01-31 18:44 ` Mattias Engdegård
  2020-01-31 19:29   ` Eli Zaretskii
  2020-01-31 20:28   ` Bastien
  0 siblings, 2 replies; 4+ messages in thread
From: Mattias Engdegård @ 2020-01-31 18:44 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-devel

31 jan. 2020 kl. 19.14 skrev Bastien <bzg@gnu.org>:

> Assuming display-line-numbers-mode is turned on, how can I get
> the number of spaces this mode uses for displaying numbers?

It may not be the right way, but I ended up using

 (round (line-number-display-width 'columns))




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to get the line offset in `display-line-numbers-mode'?
  2020-01-31 18:44 ` Mattias Engdegård
@ 2020-01-31 19:29   ` Eli Zaretskii
  2020-01-31 20:28   ` Bastien
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2020-01-31 19:29 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: bzg, emacs-devel

> From: Mattias Engdegård <mattiase@acm.org>
> Date: Fri, 31 Jan 2020 19:44:59 +0100
> Cc: emacs-devel@gnu.org
> 
> 31 jan. 2020 kl. 19.14 skrev Bastien <bzg@gnu.org>:
> 
> > Assuming display-line-numbers-mode is turned on, how can I get
> > the number of spaces this mode uses for displaying numbers?
> 
> It may not be the right way, but I ended up using
> 
>  (round (line-number-display-width 'columns))

That's the right way.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to get the line offset in `display-line-numbers-mode'?
  2020-01-31 18:44 ` Mattias Engdegård
  2020-01-31 19:29   ` Eli Zaretskii
@ 2020-01-31 20:28   ` Bastien
  1 sibling, 0 replies; 4+ messages in thread
From: Bastien @ 2020-01-31 20:28 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: emacs-devel

Hi Mattias,

Mattias Engdegård <mattiase@acm.org> writes:

> 31 jan. 2020 kl. 19.14 skrev Bastien <bzg@gnu.org>:
>
>> Assuming display-line-numbers-mode is turned on, how can I get
>> the number of spaces this mode uses for displaying numbers?
>
> It may not be the right way, but I ended up using
>
>  (round (line-number-display-width 'columns))

Very nice, thanks a lot!

-- 
 Bastien



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-31 20:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-31 18:14 How to get the line offset in `display-line-numbers-mode'? Bastien
2020-01-31 18:44 ` Mattias Engdegård
2020-01-31 19:29   ` Eli Zaretskii
2020-01-31 20:28   ` Bastien

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