GNU bug report logs - #17065
24.3.50; Revise line 5944 of window.el to use `window-width`, instead of `window-total-width`.

Previous Next

Package: emacs;

Reported by: Keith David Bershatsky <esq <at> lawlist.com>

Date: Sat, 22 Mar 2014 01:34:01 UTC

Severity: minor

Found in version 24.3.50

Full log


Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#17065: 24.3.50;
 Revise line 5944 of window.el to use `window-width`,
 instead of `window-total-width`.
Date: Sat, 22 Mar 2014 10:41:00 +0100
> (defun broken-example ()
>    (interactive)
>    (window--display-buffer
>     ;; buffer
>     (get-buffer-create "*test*")
>     ;; window
>     (split-window (selected-window) nil 'right)
>     ;; type
>     'window
>     ;; alist
>     '((window-width . 82))
>     ;; dedicated
>     t)
>    (message "Window Width:  %s" (window-width (get-buffer-window "*test*"))) )

Conceptually, the `window-width' alist entry specifies the new total
width of the window, including fringes, scrollbars and vertical
dividers.  You mean that specifiying the number of text columns is more
intuitive?  I might agree, but unfortunately _all_ window resizing
functions intepret "width" in terms of the total width of a window.
Making an exception for this special case would only increase the
confusion.

The confusion has historical reasons and was not considered important,
likely so, because side-by-side windows are in use more frequently only
over the past years.  If, with emacs -Q, I do

(let ((window (split-window (selected-window) -20 'right)))
  (window-body-width window))

I get 16 text columns for the new window which is likely not what I
expected as someone using this function for the first time with an
explicit SIZE argument.

In any case, I will have to adjust some doc-strings and the Elisp
manual.  So far the only hint is the doc-string of `split-window-right'
which says

  Here, SIZE includes the width of the window's scroll bar; if there are
  no scroll bars, it includes the width of the divider column to the
  window's right, if any.

but I'm struggling with this issue ever since.

martin




This bug report was last modified 3 years and 196 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.