unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* window-width, the terminal and linum-mode
@ 2012-12-25 10:33 Hans-Peter Deifel
  2012-12-25 11:12 ` Constantin Kulikov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hans-Peter Deifel @ 2012-12-25 10:33 UTC (permalink / raw)
  To: help-gnu-emacs

Hi group,

I was looking in "(elisp) Window Sizes" for a function to give me the
width of the text area of a window and found `window-body-width'.
However, this function gives me different results in terminal and GUI
modes, when linum-mode is enabled.

In terminal emacs, `window-body-width' includes the width of the line
number, while in gui emacs it doesn't. In both cases, the line number
width is returned correctly by `(window-margins)'.

So the question is: How can I get the width of the text-area (meaning,
in my case, without the line-numbers). I'd also like to avoid having to
distinguish X and terminal mode explicitly.

Thanks,
HP

--
Hans-Peter Deifel
GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.4)


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

* Re: window-width, the terminal and linum-mode
  2012-12-25 10:33 window-width, the terminal and linum-mode Hans-Peter Deifel
@ 2012-12-25 11:12 ` Constantin Kulikov
  2012-12-25 17:39 ` Eli Zaretskii
       [not found] ` <mailman.16102.1356457168.855.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Constantin Kulikov @ 2012-12-25 11:12 UTC (permalink / raw)
  To: Hans-Peter Deifel; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 29 bytes --]

Maybe try `(window-width)' ?

[-- Attachment #2: Type: text/html, Size: 62 bytes --]

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

* Re: window-width, the terminal and linum-mode
  2012-12-25 10:33 window-width, the terminal and linum-mode Hans-Peter Deifel
  2012-12-25 11:12 ` Constantin Kulikov
@ 2012-12-25 17:39 ` Eli Zaretskii
       [not found] ` <mailman.16102.1356457168.855.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2012-12-25 17:39 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Hans-Peter Deifel <hpdeifel@gmx.de>
> Date: Tue, 25 Dec 2012 11:33:33 +0100
> 
> I was looking in "(elisp) Window Sizes" for a function to give me the
> width of the text area of a window and found `window-body-width'.
> However, this function gives me different results in terminal and GUI
> modes, when linum-mode is enabled.
> 
> In terminal emacs, `window-body-width' includes the width of the line
> number, while in gui emacs it doesn't. In both cases, the line number
> width is returned correctly by `(window-margins)'.

It's a bug in window-body-width, now fixed in the development sources,
thanks to your report.  It should exclude the display margins from the
width calculation on TTYs as well.




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

* Re: window-width, the terminal and linum-mode
       [not found] ` <mailman.16102.1356457168.855.help-gnu-emacs@gnu.org>
@ 2012-12-27 16:22   ` Hans-Peter Deifel
  0 siblings, 0 replies; 4+ messages in thread
From: Hans-Peter Deifel @ 2012-12-27 16:22 UTC (permalink / raw)
  To: help-gnu-emacs

On Di, Dez 25 2012, Eli Zaretskii wrote:
>> I was looking in "(elisp) Window Sizes" for a function to give me the
>> width of the text area of a window and found `window-body-width'.
>> However, this function gives me different results in terminal and GUI
>> modes, when linum-mode is enabled.
>> 
>> In terminal emacs, `window-body-width' includes the width of the line
>> number, while in gui emacs it doesn't. In both cases, the line number
>> width is returned correctly by `(window-margins)'.
>
> It's a bug in window-body-width, now fixed in the development sources,
> thanks to your report.  It should exclude the display margins from the
> width calculation on TTYs as well.

Very cool. Thank you very much.

HP


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

end of thread, other threads:[~2012-12-27 16:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-25 10:33 window-width, the terminal and linum-mode Hans-Peter Deifel
2012-12-25 11:12 ` Constantin Kulikov
2012-12-25 17:39 ` Eli Zaretskii
     [not found] ` <mailman.16102.1356457168.855.help-gnu-emacs@gnu.org>
2012-12-27 16:22   ` Hans-Peter Deifel

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