* bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + changed face height = mess
@ 2024-12-14 12:57 toomas
2024-12-14 13:26 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: toomas @ 2024-12-14 12:57 UTC (permalink / raw)
To: 74866
----------------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))
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + changed face height = mess
2024-12-14 12:57 bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + changed face height = mess toomas
@ 2024-12-14 13:26 ` Eli Zaretskii
2024-12-14 17:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2024-12-14 13:26 UTC (permalink / raw)
To: toomas, martin rudalics; +Cc: 74866
> From: toomas@rosin.ee
> 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
FWIW, I cannot reproduce this, neither in Emacs 29.2 nor in the
current emacs-30 branch (which will soon become Emacs 30.1).
Martin, any comments?
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + changed face height = mess
2024-12-14 13:26 ` Eli Zaretskii
@ 2024-12-14 17:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-14 19:09 ` bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + ch Toomas Rosin
0 siblings, 1 reply; 7+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-14 17:16 UTC (permalink / raw)
To: Eli Zaretskii, toomas; +Cc: 74866
> Martin, any comments?
Looks like an idiosyncrasy of 'set-face-attribute'. The following seems
to work here. Don't ask me why.
(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 . nil)))))
(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)
(set-face-attribute 'default nil :height 57)
(fit-frame-to-buffer))))
martin
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + ch
2024-12-14 17:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-12-14 19:09 ` Toomas Rosin
2024-12-17 13:07 ` Stefan Kangas
0 siblings, 1 reply; 7+ messages in thread
From: Toomas Rosin @ 2024-12-14 19:09 UTC (permalink / raw)
To: martin rudalics; +Cc: Eli Zaretskii, 74866
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + ch
2024-12-14 19:09 ` bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + ch Toomas Rosin
@ 2024-12-17 13:07 ` Stefan Kangas
2024-12-17 13:15 ` Toomas Rosin
2024-12-18 10:05 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 7+ messages in thread
From: Stefan Kangas @ 2024-12-17 13:07 UTC (permalink / raw)
To: Toomas Rosin, martin rudalics; +Cc: Eli Zaretskii, 74866
Toomas Rosin <toomas@rosin.ee> writes:
> 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?
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + ch
2024-12-17 13:07 ` Stefan Kangas
@ 2024-12-17 13:15 ` Toomas Rosin
2024-12-18 10:05 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 7+ messages in thread
From: Toomas Rosin @ 2024-12-17 13:15 UTC (permalink / raw)
To: Stefan Kangas; +Cc: martin rudalics, Eli Zaretskii, 74866
Stefan Kangas <stefankangas@gmail.com> wrote:
> So is there a bug here?
I would say there is, because Martin's fix is more of a workaround than
regular coding. At least there seems to be no way to arrive at this
hack by reading the documentation.
T.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + ch
2024-12-17 13:07 ` Stefan Kangas
2024-12-17 13:15 ` Toomas Rosin
@ 2024-12-18 10:05 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 7+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-18 10:05 UTC (permalink / raw)
To: Stefan Kangas, Toomas Rosin; +Cc: Eli Zaretskii, 74866
> Toomas Rosin <toomas@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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-12-18 10:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-14 12:57 bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + changed face height = mess toomas
2024-12-14 13:26 ` Eli Zaretskii
2024-12-14 17:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-14 19:09 ` bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + ch Toomas Rosin
2024-12-17 13:07 ` Stefan Kangas
2024-12-17 13:15 ` Toomas Rosin
2024-12-18 10:05 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.