Subject: 29.4; fit-frame-to-window + no vertical scroll bar + changed face height = mess

From: [email-masked]
Date: Sat, 14 Dec 2024 14:57:31 +0200

----------------8<----------------8<----------------8<----------------

In "emacs -Q" under X (I have XFCE), evaluate:

(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)))))
    (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))))
;;; LIN and COL are arbitrary, make them sufficiently small.
(fit 9 23)

So far, so good.  Now evaluate the following:

(setq-default vertical-scroll-bar nil)
(set-face-attribute 'default nil :height 75)
(fit 9 23)

On my system, the frame's width is now one character short and the lines
do not fit in the new frame any more.

---------------->8---------------->8---------------->8----------------

In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41,
 cairo version 1.18.2) of 2024-12-10 built on localhost
Windowing system distributor 'The X.Org Foundation', version 11.0.12101014
System Description: Gentoo Linux

Configured using:
 'configure --prefix=/usr --build=x86_64-pc-linux-gnu
 --host=x86_64-pc-linux-gnu --mandir=/usr/share/man
 --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
 --localstatedir=/var/lib --datarootdir=/usr/share
 --disable-silent-rules --docdir=/usr/share/doc/emacs-29.4
 --htmldir=/usr/share/doc/emacs-29.4/html --libdir=/usr/lib64
 --program-suffix=-emacs-29 --includedir=/usr/include/emacs-29
 --infodir=/usr/share/info/emacs-29 --localstatedir=/var
 --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp
 --without-compress-install --without-hesiod --without-pop
 --with-file-notification=inotify --with-pdumper --enable-acl
 --with-dbus --without-modules --without-gameuser --with-libgmp
 --without-gpm --without-native-compilation --without-json
 --without-kerberos --without-kerberos5 --with-lcms2 --with-xml2
 --without-mailutils --without-selinux --without-sqlite3 --with-gnutls
 --without-libsystemd --with-threads --without-tree-sitter
 --without-wide-int --with-sound=alsa --with-zlib --with-x
 --without-pgtk --without-ns --without-gconf --without-gsettings
 --without-toolkit-scroll-bars --with-xpm --with-xft --with-cairo
 --without-harfbuzz --without-libotf --without-m17n-flt
 --with-x-toolkit=gtk3 --without-xwidgets --with-gif --with-jpeg
 --with-png --with-rsvg --with-tiff --without-webp --without-imagemagick
 --with-dumping=pdumper 'CFLAGS=-O2 -pipe -fno-fast-math
 -ffp-contract=off' CPPFLAGS= 'LDFLAGS=-Wl,-O1 -Wl,--as-needed
 -Wl,-z,pack-relative-relocs''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS JPEG LCMS2 LIBXML2 NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF X11 XDBE XIM XINPUT2
XPM GTK3 ZLIB

Important settings:
  value of $LANG: C.UTF8
  locale-coding-system: utf-8-unix

Major mode: Helpful

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  server-mode: t
  repeat-mode: t
  gdb-many-windows: t
  auto-insert-mode: t
  shell-dirtrack-mode: t
  desktop-save-mode: t
  windmove-mode: t
  display-time-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/usr/share/emacs/site-lisp/transient/transient hides /usr/share/emacs/29.4/lisp/transient
/usr/share/emacs/site-lisp/seq/seq hides /usr/share/emacs/29.4/lisp/emacs-lisp/seq

Features:
(shadow emacsbug cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine files-x etags fileloop xref project warnings sort
cal-move cl-print mh-search mh-thread cus-start cus-load mh-identity
mh-letter mh-comp mh-alias shr-color color textsec uni-scripts
idna-mapping ucs-normalize uni-confusable textsec-check qp mm-archive
mail-extr mh-mime mh-gnus dabbrev misearch multi-isearch vc-hg vc-bzr
vc-src vc-sccs vc-svn vc-cvs vc-rcs log-view vc bug-reference
magit-bookmark magit-submodule magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit package url-handlers magit-repos magit-apply magit-wip magit-log
magit-diff smerge-mode diff git-commit log-edit pcvs-util add-log
magit-core magit-autorevert magit-margin magit-transient magit-process
with-editor server magit-mode transient benchmark magit-git magit-base
magit-section cursor-sensor crm compat compat-30 org-clock diary-lib
diary-loaddefs face-remap image-file image-converter ttk-mt mh-show
goto-addr gnus-cite mh-seq mh-inc hl-line mh-tool-bar mh-acros mh-xface
mh-utils mh-folder which-func mh-scan mule-util repeat ttk rst
ttk-para-minutes ttk-bookmarks ttk-windows loop bookmark pp ttk-fonts
view autorevert vc-git diff-mode vc-dispatcher oc-basic ol-eww ol-rmail
ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu mml2015 mm-view
mml-smime smime gnutls dig gnus-sum gnus-group gnus-undo gnus-start
gnus-dbus dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time
gnus-spec gnus-int gnus-range message sendmail yank-media rfc822 mml
mml-sec epa derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils
mailheader gnus-win ol-docview doc-view filenotify jka-compr image-mode
exif ol-bibtex bibtex iso8601 ol-bbdb ol-w3m ol-doi org-link-doi
ebuild-mode skeleton mh-e mh-buffers mh-loaddefs dired dired-loaddefs
helpful cc-langs cc-vars cc-defs imenu trace edebug debug backtrace
info-look info f help-fns radix-tree elisp-refs s dash rect org-agenda
org-element org-persist org-id avl-tree generator org-refile org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint
org-pcomplete org-list org-footnote org-faces org-entities noutline
outline icons ob-emacs-lisp ob-core ob-eval org-cycle org-table ol
org-fold org-fold-core org-keys oc org-loaddefs find-func cal-menu
calendar cal-loaddefs org-version org-compat org-macs format-spec eww
xdg url-queue thingatpt shr pixel-fill kinsoku url-file svg xml dom
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util url-parse auth-source
eieio eieio-core password-cache url-vars mailcap puny mm-url gnus
nnheader gnus-util time-date mail-utils range wid-edit mm-util
mail-prsvr generic quail gdb-mi bindat gud autoinsert compile
text-property-search term disp-table shell pcomplete ehelp comint
ansi-osc ansi-color ring sh-script rx json subr-x map byte-opt smie
treesit executable edmacro kmacro desktop frameset windmove cl-macs gv
cl-extra help-mode cl-seq time use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core cl-loaddefs cl-lib bytecomp byte-compile
site-gentoo pcase rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting font-render-setting cairo move-toolbar gtk x-toolkit
xinput2 x multi-tty make-network-process emacs)

Memory information:
((conses 16 834942 136709)
 (symbols 48 50845 60)
 (strings 32 231167 12276)
 (string-bytes 1 6352031)
 (vectors 16 117969)
 (vector-slots 8 2666758 108652)
 (floats 8 538 622)
 (intervals 56 32979 1150)
 (buffers 976 61))