GNU bug report logs -
#74866
29.4; fit-frame-to-window + no vertical scroll bar + changed face height = mess
Previous Next
Reported by: toomas <at> rosin.ee
Date: Sat, 14 Dec 2024 12:58:04 UTC
Severity: normal
Merged with 74867
Found in version 29.4
Full log
Message #25 received at 74866 <at> debbugs.gnu.org (full text, mbox):
> Toomas Rosin <toomas <at> rosin.ee> writes:
Toomas please include me in the recipients.
>> Thank you, this got the damn thing working for me. As the lines about
>> vertical scroll bars and font size were from my init.el, I was loath to
>> clutter my function with them and hoped to get away with only adding the
>> `vertical-scroll-bars' item to the `frame-attributes' arg of
>> `make-frame'. And indeed, this worked. So the final form of my MWM
>> looks like this:
>>
>> ;;; init.el:
>> (setq-default vertical-scroll-bar nil)
>> (set-face-attribute 'default nil :height 75)
>>
>> ;;; main code:
>> (defun fit (lin col)
>> "Fit some text (LIN lines and COL columns) into a newly created frame."
>> (interactive)
>> (let ((buf (get-buffer-create "*foo*"))
>> (frm (make-frame
>> `((z-group . above)
>> (vertical-scroll-bars . ,vertical-scroll-bar)))))
>> (with-current-buffer buf
>> (erase-buffer)
>> (setq mode-line-format '(""))
>> (dotimes (_ lin) (insert (format "%s\n" (make-string col ?x))))
>> (goto-char (point-min)))
>> (with-selected-frame frm
>> (switch-to-buffer buf)
>> (fit-frame-to-buffer))))
>>
>> Cheers, T.
>
> So is there a bug here?
It might be a synchronization problem. When in the new frame I type M-x
fit-frame-to-buffer, it behaves as intended here.
Whatever it is, I'd suggest to never ever use the idiom
(setq-default vertical-scroll-bar nil)
'vertical-scroll-bar' is an automatically buffer-local variable meant to
override what the frame specifies for any buffer displayed in it. But
the size hints Emacs sends to the window manager are derived from the
settings for the frame. So it's easily possible that the window manager
truncates the frame size to the next size specified by our size
increments just that in the case at hand the base width would still
include the vertical scroll bar. In fact, here I have to set
'frame-resize-pixelwise' to t to make your scenario work even without
the 'set-face-attribute' call.
So if you want to turn off vertical scroll bars for all frames please
use a (vertical-scroll-bars . nil) entry in 'default-frame-alist'.
Whether 'set-face-attribute' DTRT and how it is involved in the scenario
at hand is a question I'd prefer not to answer. If it affects the
canonical line height or column width of a frame, it should find its way
into the size hints for each frame. Otherwise, chaos may result.
martin
This bug report was last modified 180 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.