bug#81614: 30.2; quit-window unexpectedly changes the width of window
Eli Zaretskii <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
> Date: Sat, 15 Aug 2026 14:10:18 +0500 > From: Rahguzar via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" <[email protected]> > > I am attaching a patch that fixes the issue for me. Thanks. Martin, any comments? > Rahguzar <[email protected]> writes: > > > Dear Emacs maintainers, > > > > To reproduce starting with emacs -Q, evaluate the following code in > > scratch buffer: > > > > (progn > > (display-buffer (messages-buffer) '(display-buffer-in-direction > > (direction . right))) > > (display-buffer (get-buffer-create "*buffer-2*") > > '(display-buffer-below-selected)) > > (display-buffer (get-buffer-create "*buffer-1*") > > '(display-buffer-same-window)) > > (select-window (window-next-sibling))) > > > > and then do C-x w q twice. The second quit-window changes the width of > > the two windows. > > > > I think the responsible code is this snippet from 'quit-restore-window' > > > > (when (and (integerp (nth 3 quad)) > > (if (window-combined-p window) > > (/= (nth 3 quad) (window-total-height window)) > > (/= (nth 3 quad) (window-total-width window)))) > > ;; Try to resize WINDOW to its old height but don't signal an > > ;; error. > > (condition-case nil > > (window-resize > > window > > (- (nth 3 quad) (if (window-combined-p window) > > (window-total-height window) > > (window-total-width window))) > > (window-combined-p window t)) > > (error nil))) > > > > As far as I can tell by searching around in 'window.el' the > > 'quit-restore' parameter only ever stores the height of the window. This > > matches the description of 'quit-restore' in Info node (elisp) Quitting > > Windows. But the code above instead changes the width of the window if > > the window is not vertically combined. > > > > Best, > > Rahguzar > > > > > > In GNU Emacs 30.2 (build 1, aarch64-redhat-linux-gnu, GTK+ Version > > 3.24.52, cairo version 1.18.4) of 2026-05-14 built on > > 3aa749ead9044621a9c0d9b695f453cd > > System Description: Fedora Linux Asahi Remix 44 (Forty Four) > > > > Configured using: > > 'configure --build=aarch64-redhat-linux-gnu > > --host=aarch64-redhat-linux-gnu --program-prefix= > > --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr > > --bindir=/usr/bin --sbindir=/usr/bin --sysconfdir=/etc > > --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 > > --libexecdir=/usr/libexec --localstatedir=/var --runstatedir=/run > > --sharedstatedir=/var/lib --mandir=/usr/share/man > > --infodir=/usr/share/info --disable-gc-mark-trace --with-cairo > > --with-dbus --with-gif --with-gpm=no --with-harfbuzz --with-jpeg > > --with-modules --with-native-compilation=aot --with-pgtk --with-png > > --with-rsvg --with-sqlite3 --with-tiff --with-tree-sitter --with-webp > > --with-xpm build_alias=aarch64-redhat-linux-gnu > > host_alias=aarch64-redhat-linux-gnu CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2 > > -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches > > -pipe -Wall -Werror=format-security > > -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS > > -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong > > -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 > > -mbranch-protection=standard -fasynchronous-unwind-tables > > -fstack-clash-protection -fno-omit-frame-pointer > > -mno-omit-leaf-frame-pointer ' 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed > > -Wl,-z,pack-relative-relocs -Wl,-z,now > > -specs=/usr/lib/rpm/redhat/redhat-hardened-ld > > -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors > > -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 > > -specs=/usr/lib/rpm/redhat/redhat-package-notes ' CXX=g++ 'CXXFLAGS=-O2 > > -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches > > -pipe -Wall -Werror=format-security > > -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS > > -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong > > -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 > > -mbranch-protection=standard -fasynchronous-unwind-tables > > -fstack-clash-protection -fno-omit-frame-pointer > > -mno-omit-leaf-frame-pointer ' > > PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig' > > > > Configured features: > > ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG > > LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY > > INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF > > TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB > > > > Important settings: > > value of $LANG: en_US.utf8 > > locale-coding-system: utf-8-unix > > > > Major mode: mu4e:main > > > > Minor modes in effect: > > corfu-history-mode: t > > corfu-popupinfo-mode: t > > server-mode: t > > mu4e-search-minor-mode: t > > mu4e-update-minor-mode: t > > mu4e-context-minor-mode: t > > satchel-mode: t > > nerd-icons-completion-mode: t > > marginalia-mode: t > > vertico-multiform-mode: t > > vertico-mode: t > > evil-goggles-mode: t > > anzu-mode: t > > evil-mode: t > > evil-local-mode: t > > recentf-mode: t > > savehist-mode: t > > save-place-mode: t > > electric-pair-mode: t > > override-global-mode: t > > pixel-scroll-precision-mode: t > > repeat-mode: t > > midnight-mode: t > > global-eldoc-mode: t > > 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 > > minibuffer-regexp-mode: t > > buffer-read-only: t > > size-indication-mode: t > > line-number-mode: t > > transient-mark-mode: t > > auto-composition-mode: t > > auto-encryption-mode: t > > auto-compression-mode: t > > abbrev-mode: t > > > > Load-path shadows: > > /home/azeem/.local/state/emacs/elpaca/builds/transient/transient hides /usr/share/emacs/30.2/lisp/transient > > /home/azeem/.local/state/emacs/elpaca/builds/ef-themes/theme-loaddefs hides /usr/share/emacs/30.2/lisp/theme-loaddefs > > /home/azeem/.local/state/emacs/elpaca/builds/compat/compat hides /usr/share/emacs/30.2/lisp/emacs-lisp/compat > > > > Features: > > (shadow emacsbug help-fns radix-tree tex-mode shell embark-org > > embark-consult embark timezone link-hint ffap goto-addr avy fabs consult > > undo-fu-session cus-start vertico-sort woman man nerd-icons-corfu > > dabbrev cape-char delsel corfu-history corfu-popupinfo corfu-auto corfu > > evil-embrace embrace expand-region text-mode-expansions > > the-org-mode-expansions org-element org-persist xdg org-id org-refile > > org-element-ast inline avl-tree generator er-basic-expansions > > expand-region-core expand-region-custom evil-surround jit-spell ispell > > face-remap pdf-roll pdf-annot tablist tablist-filter > > semantic/wisent/comp semantic/wisent semantic/wisent/wisent > > semantic/util-modes semantic/util semantic semantic/tag semantic/lex > > semantic/fw mode-local cedet facemenu pdf-outline inspirehep-pdf > > companion-mode inspirehep reftex reftex-loaddefs reftex-vars bibtex > > pdf-links pdf-isearch let-alist pdf-misc imenu pdf-tools package > > url-handlers pdf-view pdf-cache pdf-info tq pdf-util pdf-macs image-mode > > exif gnus-fun smerge-mode diff diff-mode track-changes jka-compr > > shr-color qp mm-archive sort smiley gnus-cite mail-extr textsec > > uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check > > gnus-async gnus-bcklg visual-wrap gnus-ml disp-table nndraft nnmh > > vertico-repeat epa-file network-stream nsm gnus-agent gnus-srvr > > gnus-score score-mode nnvirtual nntp gnus-cache help-at-pt server cape > > mu4e mu4e-org org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro > > org-src sh-script smie treesit executable ob-comint org-pcomplete > > pcomplete org-list org-footnote org-faces org-entities noutline outline > > org-version ob-emacs-lisp ob-core ob-eval org-cycle org-table ol > > org-fold org-fold-core org-keys oc org-loaddefs find-func org-compat > > org-macs format-spec mu4e-notification notifications mu4e-main smtpmail > > mu4e-view mu4e-mime-parts crm cal-menu calendar cal-loaddefs > > mu4e-headers mu4e-thread mu4e-actions mu4e-compose mu4e-draft gnus-msg > > 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 iso8601 gnus-spec gnus-int gnus-range > > gnus-win gnus nnheader range mu4e-search mu4e-lists mu4e-bookmarks > > mu4e-mark mu4e-message shr pixel-fill kinsoku url-file svg xml dom > > browse-url flow-fill mule-util hl-line mu4e-contacts mu4e-update > > mu4e-folders mu4e-context mu4e-query-items mu4e-server mu4e-modeline > > mu4e-vars mu4e-helpers mu4e-config mu4e-window ido message sendmail > > yank-media puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config > > gnus-util time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 > > rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils > > gmm-utils mailheader mu4e-obsolete usher satchel ibuf-ext ibuffer > > ibuffer-loaddefs bookmark nerd-icons-completion nerd-icons > > nerd-icons-faces nerd-icons-data nerd-icons-data-mdicon > > nerd-icons-data-flicon nerd-icons-data-codicon nerd-icons-data-devicon > > nerd-icons-data-sucicon nerd-icons-data-wicon nerd-icons-data-faicon > > nerd-icons-data-powerline nerd-icons-data-octicon > > nerd-icons-data-pomicon nerd-icons-data-ipsicon marginalia > > vertico-multiform vertico evil-goggles pulse ef-reverie-theme ef-themes > > modus-themes color pdf-loader anzu advice evil evil-integration > > evil-maps evil-commands reveal evil-jumps evil-command-window evil-types > > evil-search evil-ex evil-macros evil-repeat evil-states evil-core comp > > comp-cstr cl-extra help-mode comp-run comp-common evil-common rect > > evil-vars edmacro kmacro orderless compat compat-31 yeetube-autoloads > > keymap-popup-autoloads filechooser-autoloads wile-autoloads > > usher-autoloads undo-fu-session-autoloads magit-autoloads > > transient-autoloads ef-themes-autoloads modus-themes-autoloads > > jit-spell-autoloads satchel-autoloads rmk-usb-autoloads > > pdf-tools-autoloads tablist-autoloads xr-autoloads link-hint-autoloads > > avy-autoloads yaml-mode-autoloads markdown-mode-autoloads > > password-store-autoloads with-editor-autoloads magit-section-autoloads > > llama-autoloads cape-autoloads embark-consult-autoloads fabs-autoloads > > consult-hoogle-autoloads consult-autoloads corfu-autoloads > > embark-autoloads marginalia-autoloads nerd-icons-completion-autoloads > > orderless-autoloads vertico-autoloads helpful-autoloads > > macrostep-autoloads eat-autoloads compat-autoloads inspirehep-autoloads > > nerd-icons-corfu-autoloads nerd-icons-autoloads > > haskell-ng-mode-autoloads companion-mode-autoloads eww-hacks-autoloads > > evil-embrace-autoloads embrace-autoloads expand-region-autoloads > > evil-surround-autoloads evil-nerd-commenter-autoloads > > evil-goggles-autoloads anzu-autoloads evil-autoloads goto-chg-autoloads > > eshell-syntax-highlighting-autoloads package-lint-flymake-autoloads > > package-lint-autoloads dash-autoloads highlight-quoted-autoloads > > dirt-autoloads diredfl-autoloads trashed-autoloads cond-let-autoloads > > recentf tree-widget savehist saveplace elec-pair bind-key easy-mmode > > ibuf-macs flymake project compile text-property-search comint ansi-osc > > ansi-color warnings thingatpt elpaca-menu-elpa dired-x dired > > dired-loaddefs pcase pixel-scroll cua-base ring repeat rx midnight > > cus-edit pp cus-load wid-edit elpaca-menu-melpa url url-proxy > > url-privacy url-expand url-methods url-history url-cookie > > generate-lisp-file url-domsuf url-util url-parse auth-source cl-seq > > eieio eieio-core icons password-cache json subr-x map url-vars mailcap > > elpaca-menu-org elpaca-git elpaca byte-opt cl-macs gv bytecomp > > byte-compile elpaca-process cl-loaddefs cl-lib elpaca-autoloads rmc > > iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook > > vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win > > term/common-win touch-screen pgtk-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 > > dynamic-setting system-font-setting font-render-setting cairo gtk pgtk > > lcms2 multi-tty move-toolbar make-network-process native-compile emacs) > > > > Memory information: > > ((conses 16 1471415 290527) (symbols 48 50723 4) > > (strings 32 411050 15448) (string-bytes 1 9870195) > > (vectors 16 111719) (vector-slots 8 1670896 171029) > > (floats 8 934 14628) (intervals 56 101106 2393) (buffers 992 41)) > > >From 024c7947ecd45b8686b3c7edaa546ec32c7e1551 Mon Sep 17 00:00:00 2001 > From: Rahguzar <[email protected]> > Date: Sat, 15 Aug 2026 13:28:36 +0500 > Subject: [PATCH] Don't change width in quit restore (bug#81614) > > * lisp/window.el (quit-restore-window): only resize > vertically combined windows > --- > lisp/window.el | 17 ++++++----------- > 1 file changed, 6 insertions(+), 11 deletions(-) > > diff --git a/lisp/window.el b/lisp/window.el > index fef2f3d4666..f3b33023f79 100644 > --- a/lisp/window.el > +++ b/lisp/window.el > @@ -5481,19 +5481,14 @@ quit-restore-window > (eq (nth 3 quit-restore) buffer))) > ;; Show another buffer stored in quit-restore(-prev) parameter. > (when (and (integerp (nth 3 quad)) > - (if (window-combined-p window) > - (/= (nth 3 quad) (window-total-height window)) > - (/= (nth 3 quad) (window-total-width window)))) > + (window-combined-p window) > + (/= (nth 3 quad) (window-total-height window))) > ;; Try to resize WINDOW to its old height but don't signal an > ;; error. > - (condition-case nil > - (window-resize > - window > - (- (nth 3 quad) (if (window-combined-p window) > - (window-total-height window) > - (window-total-width window))) > - (window-combined-p window t)) > - (error nil))) > + (ignore-errors > + (window-resize > + window > + (- (nth 3 quad) (window-total-height window))))) > (set-window-dedicated-p window nil) > ;; Restore WINDOW's previous buffer, start and point position. > (set-window-buffer-start-and-point > -- > 2.55.0 >