GNU bug report logs - #79013
`window-state-put' uses incorrect alist key `'min-weight' but should use `'min-width'.

Previous Next

Package: emacs;

Reported by: Derick Eddington <kcired <at> pm.me>

Date: Mon, 14 Jul 2025 08:18:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


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

From: Derick Eddington <kcired <at> pm.me>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: `window-state-put' uses incorrect alist key `'min-weight' but should
 use `'min-width'.
Date: Mon, 14 Jul 2025 08:13:27 +0000
To reproduce:

    $ emacs -Q --batch --eval \
            "(window-state-put '(((min-height . 12)
                                  (min-width . 20)
                                  (min-height-ignore . 7)
                                  (min-width-ignore . 8)
                                  (min-height-safe . 3)
                                  (min-width-safe . 4))
                                 vc
                                 (total-width . 200)
                                 (total-height . 60)
                                 (normal-height . 1.0)
                                 (normal-width . 1.0)
                                 (combination-limit)))"

Which causes the following error:

    Wrong type argument: number-or-marker-p, nil

because (in the definition of `window-state-put'):

         (min-width (cdr (assq
                          (if pixelwise 'min-pixel-width 'min-weight)
                          head)))

binds `min-width' to `nil' because `'min-weight' is (correctly) not in
the input alist.

and so:
                 (> min-width (window-size window t pixelwise)))
causes the error.

Whereas, if you substitute the incorrect key it's currently using,
`'min-weight' for `'min-width', in the input alist, then it does not
error.  But that would be invalid because it's supposed to use
`'min-width', like `window-state-get' returns.

This mistake was introduced in commit 880e615 "Support resizing frames
and windows pixelwise." in the year 2013.  Previously, `'min-width' had
been used, but when that commit introduced `'min-pixel-width' it also
typoed as `'min-weight' its attempt at preserving the `'min-width'.

I'll be submitting a patch to fix this.

The fix is simply:

--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6803,7 +6803,7 @@ was killed since STATE was made, it will consult the variable
 			   (if pixelwise 'min-pixel-height 'min-height)
 			   head)))
 	 (min-width (cdr (assq
-			  (if pixelwise 'min-pixel-width 'min-weight)
+			  (if pixelwise 'min-pixel-width 'min-width)
 			  head)))
 	 ;; Bind the following two variables.  `window--state-put-1' has
 	 ;; to fully control them (see Bug#50867 and Bug#64405).



In GNU Emacs 30.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43,
cairo version 1.18.2)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: NixOS 24.11 (Vicuna)

Configured using:
 'configure
 --prefix=/nix/store/bdf77bcxc565y83iyw4i26fyq3wgv07j-emacs-gtk3-30.1
 --disable-build-details --with-modules --with-x-toolkit=gtk3
 --with-cairo --with-xft --with-compress-install
 --with-toolkit-scroll-bars --with-native-compilation
 --without-imagemagick --with-mailutils --without-small-ja-dic
 --with-tree-sitter --with-xinput2 --without-xwidgets --with-dbus
 --with-selinux'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $EMACSLOADPATH: 
  value of $EMACSNATIVELOADPATH: 
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/d

Minor modes in effect:
  magit-wip-initial-backup-mode: t
  magit-wip-before-change-mode: t
  magit-wip-after-apply-mode: t
  magit-wip-after-save-mode: t
  magit-wip-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  server-mode: t
  which-key-mode: t
  show-smartparens-global-mode: t
  show-smartparens-mode: t
  smartparens-global-strict-mode: t
  smartparens-strict-mode: t
  smartparens-mode: t
  savehist-mode: t
  minibuffer-depth-indicate-mode: t
  counsel-mode: t
  ivy-mode: t
  global-flycheck-mode: t
  global-diff-hl-mode: t
  global-company-mode: t
  company-mode: t
  pixel-scroll-precision-mode: t
  global-visual-wrap-prefix-mode: t
  visual-wrap-prefix-mode: t
  global-so-long-mode: t
  delete-selection-mode: t
  override-global-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  hs-minor-mode: t

Load-path shadows:
/home/z/.nix-profile/share/emacs/site-lisp/cmake-mode hides /nix/store/vmrqlbknjdhnyddp9c39w48j18rmzz7w-emacs-packages-deps/share/emacs/site-lisp/elpa/cmake-mode-20250304.1338/cmake-mode
/nix/store/vmrqlbknjdhnyddp9c39w48j18rmzz7w-emacs-packages-deps/share/emacs/site-lisp/site-start hides /nix/store/bdf77bcxc565y83iyw4i26fyq3wgv07j-emacs-gtk3-30.1/share/emacs/site-lisp/site-start
/nix/store/vmrqlbknjdhnyddp9c39w48j18rmzz7w-emacs-packages-deps/share/emacs/site-lisp/elpa/transient-0.8.8/transient hides /nix/store/bdf77bcxc565y83iyw4i26fyq3wgv07j-emacs-gtk3-30.1/share/emacs/30.1/lisp/transient
/nix/store/vmrqlbknjdhnyddp9c39w48j18rmzz7w-emacs-packages-deps/share/emacs/site-lisp/elpa/compat-30.1.0.0/compat hides /nix/store/bdf77bcxc565y83iyw4i26fyq3wgv07j-emacs-gtk3-30.1/share/emacs/30.1/lisp/emacs-lisp/compat
/nix/store/vmrqlbknjdhnyddp9c39w48j18rmzz7w-emacs-packages-deps/share/emacs/site-lisp/elpa/eldoc-1.15.0/eldoc hides /nix/store/bdf77bcxc565y83iyw4i26fyq3wgv07j-emacs-gtk3-30.1/share/emacs/30.1/lisp/emacs-lisp/eldoc
/nix/store/vmrqlbknjdhnyddp9c39w48j18rmzz7w-emacs-packages-deps/share/emacs/site-lisp/elpa/seq-2.24/seq hides /nix/store/bdf77bcxc565y83iyw4i26fyq3wgv07j-emacs-gtk3-30.1/share/emacs/30.1/lisp/emacs-lisp/seq

Features:
(lsp-zig lsp-yang lsp-yaml lsp-xml lsp-wgsl lsp-volar lsp-vimscript
lsp-vhdl lsp-vetur lsp-html lsp-verilog lsp-vala lsp-v lsp-typespec
lsp-typeprof lsp-ttcn3 lsp-ts-query lsp-trunk lsp-toml lsp-tilt lsp-tex
lsp-terraform lsp-svelte lsp-steep lsp-sqls lsp-sql lsp-sorbet
lsp-solidity lsp-solargraph lsp-semgrep lsp-rust lsp-ruff
lsp-ruby-syntax-tree lsp-ruby-lsp lsp-rubocop lsp-roslyn lsp-roc lsp-rf
lsp-remark lsp-racket lsp-r lsp-qml lsp-python-ty lsp-pylsp lsp-pyls
lsp-pwsh lsp-purescript lsp-postgres lsp-pls lsp-php lsp-perlnavigator
lsp-perl lsp-openscad lsp-ocaml lsp-nushell lsp-nix lsp-nim lsp-nginx
lsp-nextflow lsp-move lsp-mojo lsp-mint lsp-meson lsp-mdx lsp-matlab
lsp-marksman lsp-markdown lsp-magik lsp-fennel lsp-lua lsp-lisp
lsp-kubernetes-helm lsp-kotlin lsp-json lsp-jq lsp-javascript lsp-idris
lsp-haxe lsp-hack lsp-groovy lsp-graphql lsp-golangci-lint lsp-glsl
lsp-gleam lsp-gdscript lsp-fsharp lsp-futhark lsp-fortran lsp-eslint
lsp-erlang lsp-emmet lsp-elm lsp-elixir lsp-earthly lsp-dockerfile
lsp-dhall lsp-d lsp-cypher lsp-cucumber lsp-copilot lsp-css lsp-c3
lsp-csharp gnutls lsp-crystal lsp-credo lsp-cobol lsp-cmake lsp-clojure
lsp-clangd lsp-bufls lsp-go lsp-completion lsp-beancount lsp-bash
lsp-awk lsp-autotools lsp-astro lsp-asm lsp-ansible lsp-angular lsp-ada
lsp-semantic-tokens lsp-actionscript my-lsp lsp-ui lsp-ui-flycheck
lsp-ui-doc lsp-ui-imenu lsp-ui-peek lsp-ui-sideline lsp-ui-util lsp-mode
lsp-protocol tree-widget spinner smartparens-markdown markdown-mode
color lv inline ht f s sh-script smie treesit executable lpr shadow sort
mail-extr cl-print debug backtrace emacsbug ispell tabify man mm-archive
network-stream url-cache define-word rng-nxml rng-valid rng-loc rng-uri
rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap nxml-util nxml-enc xmltok url-http
url-auth url-gw nsm let-alist descr-text magit-dired gitconfig-mode
conf-mode noutline outline home-end keypress-multi-event misearch
multi-isearch hideshow jka-compr my-tramp my-ssh tramp-sh shortdoc
help-fns radix-tree view open-junk-file ibuffer-project
my-ibuffer-project my-ibuffer ibuf-ext ibuffer ibuffer-loaddefs
mc-hide-unmatched-lines-mode mc-mark-more smartparens-html sgml-mode
facemenu dom mc-cycle-cursors multiple-cursors-core rect ivy-overlay
goto-addr vc-svn vc-git bug-reference magit-extras mule-util face-remap
my-ivy tramp-cache time-stamp vagrant-tramp term disp-table ehelp tramp
trampver tramp-integration files-x tramp-message tramp-compat parse-time
iso8601 tramp-loaddefs my-magit cus-start 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 magit-repos magit-apply
magit-wip magit-log which-func imenu magit-diff smerge-mode diff
git-commit log-edit message sendmail yank-media puny dired-x dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader add-log magit-core magit-autorevert autorevert filenotify
magit-margin magit-transient magit-process with-editor shell pcomplete
server magit-mode transient benchmark magit-git magit-base magit-section
format-spec cursor-sensor crm llama comp comp-cstr warnings comp-run
comp-common compat time-date my-modeline which-key smartparens-config
smartparens-text smartparens-go smartparens advice loadhist dash
savehist mb-depth counsel xdg swiper ivy ivy-faces colir flycheck
find-func diff-hl log-view pcvs-util vc-dir ewoc vc vc-dispatcher
diff-mode track-changes company-oddmuse company-keywords company-etags
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-bbdb company rx ibuf-macs edmacro kmacro
my-utils cl-extra help-mode cus-edit pp wid-edit pixel-scroll cua-base
visual-wrap so-long delsel cus-load go-mode find-file ffap thingatpt
etags fileloop generator xref project compile text-property-search
comint ansi-osc ansi-color ring use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core all-the-icons-autoloads capnp-mode-autoloads
charmap-autoloads cmake-mode-autoloads company-autoloads
counsel-fd-autoloads counsel-tramp-autoloads counsel-autoloads
csv-mode-autoloads define-word-autoloads diff-hl-autoloads
expand-region-autoloads fd-dired-autoloads flycheck-autoloads
git-modes-autoloads go-mode-autoloads home-end-autoloads
ibuffer-project-autoloads ivy-hydra-autoloads hydra-autoloads
keypress-multi-event-autoloads lsp-ivy-autoloads lsp-ui-autoloads
lsp-mode-autoloads ht-autoloads f-autoloads lua-mode-autoloads
lv-autoloads magit-autoloads markdown-mode-autoloads
multiple-cursors-autoloads nasm-mode-autoloads nix-mode-autoloads
magit-section-autoloads llama-autoloads open-junk-file-autoloads
rg-autoloads rust-mode-autoloads s-autoloads smartparens-autoloads
spinner-autoloads swiper-autoloads ivy-autoloads toml-mode-autoloads
transient-autoloads vagrant-tramp-autoloads dash-autoloads
wgrep-autoloads info with-editor-autoloads yaml-mode-autoloads package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs icons
password-cache json subr-x map byte-opt gv bytecomp byte-compile
url-vars cl-loaddefs cl-lib my-platform 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 touch-screen
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 x-toolkit xinput2 x multi-tty move-toolbar make-network-process
native-compile emacs)

Memory information:
((conses 16 834130 1802202) (symbols 48 56114 118) (strings 32 262292 128804)
 (string-bytes 1 7721712) (vectors 16 87633) (vector-slots 8 1471073 1203671) (floats 8 500 22139)
 (intervals 56 50245 31224) (buffers 992 36))





This bug report was last modified 2 days ago.

Previous Next


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