help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: width of line numbers


From: Stephen Berman
Subject: Re: width of line numbers
Date: Tue, 22 Dec 2020 11:12:14 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On Tue, 22 Dec 2020 10:23:26 +0100 Joost Kremers <joostkremers@fastmail.fm> 
wrote:

> Hi all,
>
> I was wondering if there's a way to find out the width of the current line
> number display (with `display-line-number-mode`, not `linum-mode`).

(line-number-display-width)

> Or, alternatively, get the window width without the line number.

This should do it:

(- (window-body-width) (line-number-display-width))

>                                                                  
>                                                                  Both
> `window-body-width` and `window-total-width` (why are there two functions, 
> BTW?)
> report the width of the text area without "dividers, scrollbars, margins,
> fringes", but the line number display is still included.

Actually, window-total-width "includes the widths of WINDOW’s fringes,
margins, scroll bars and its right divider, if any."

Steve Berman



reply via email to

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