GNU bug report logs - #56457
29.0.50; set-frame-width and frame-width are not exactly complimentary

Previous Next

Package: emacs;

Reported by: Pankaj Jangid <pankaj <at> codeisgreat.org>

Date: Sat, 9 Jul 2022 03:29:02 UTC

Severity: normal

Found in version 29.0.50

To reply to this bug, email your comments to 56457 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#56457; Package emacs. (Sat, 09 Jul 2022 03:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pankaj Jangid <pankaj <at> codeisgreat.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 09 Jul 2022 03:29:02 GMT) Full text and rfc822 format available.

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

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; set-frame-width and frame-width are not exactly complimentary
Date: Sat, 09 Jul 2022 08:58:46 +0530
I have written a small lisp function to toggle width of frame to twice
and half. This is not behaving as desired. Here is my lisp.

--8<---------------cut here---------------start------------->8---
(defun my/toggle-frame-width ()
  "Toggle \"frame-width\"."
  (interactive)
  
  (let ((width (frame-width)))
	(if (and (> width 75) (< width 85))
		(set-frame-width nil (* width 2))
	  (set-frame-width nil (/ width 2))
	(message "Frame size: %sx%s" (frame-width) (frame-height)))))
(global-set-key (kbd "<f9>") 'my/toggle-frame-width)
--8<---------------cut here---------------end--------------->8---

Steps:
1. emacs -Q
2. Evaluate above lisp. (WARN) This binds <f9> also.
3. Pres <f9> a couple of times 

Result:
After a couple of iterations. The frame-width is getting smaller and
smaller.

Desired behaviour:
It should only toggle the width to double and half alternately.



In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2022-07-09 built on anant
Repository revision: 29c8866c7fcd325995c6fc9b2b18537855fee52c
Repository branch: master
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --prefix=/home/pankaj/.local --with-pgtk'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XIM
GTK3 ZLIB

Important settings:
  value of $LANG: en_IN.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Group

Minor modes in effect:
  gnus-undo-mode: t
  winner-mode: t
  windmove-mode: t
  editorconfig-mode: t
  marginalia-mode: t
  which-key-mode: t
  hl-line-mode: t
  savehist-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
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort vc-hg vc-git diff-mode vc-bzr vc-src vc-sccs vc-svn vc-cvs
vc-rcs log-view pcvs-util vc vc-dispatcher mail-extr emacsbug gnus-async
gnus-ml disp-table nndraft nnmh utf-7 nnml nnfolder cl-extra epa-file
network-stream nsm gnus-agent gnus-srvr gnus-score score-mode nnvirtual
gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig nntp
gnus-cache gnus-sum shr pixel-fill kinsoku url-file url-dired svg dom
gnus-group gnus-undo .gnus gnus-start gnus-dbus dbus xml gnus-cloud
nnimap nnmail mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int
gnus-range message sendmail yank-media puny dired dired-loaddefs 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 gnus nnheader gnus-util mail-utils range
mm-util mail-prsvr wid-edit checkdoc lisp-mnt corfu init my-init
org-element avl-tree generator org org-macro org-footnote org-pcomplete
pcomplete org-list org-faces org-entities noutline outline easy-mmode
org-version ob-plantuml ob-sql ob-css ob-js ob-java ob-C cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs ob-python python ob-R ob ob-tangle org-src ob-ref ob-lob
ob-table ob-exp ob-comint ob-emacs-lisp ob-core ob-eval org-table
oc-basic bibtex iso8601 time-date ol org-keys oc org-compat advice
org-macs org-loaddefs format-spec cal-menu calendar cal-loaddefs server
winner windmove modus-vivendi-theme modus-themes delight eglot array
filenotify jsonrpc ert pp ewoc debug backtrace help-mode find-func xref
flymake-proc flymake warnings pcase project imenu editorconfig
rust-utils thingatpt rust-mode rust-rustfmt rust-playpen rust-compile
compile text-property-search comint ansi-color ring rust-cargo
marginalia which-key exec-path-from-shell hl-line savehist avoid
cus-load finder-inf tex-site cider-autoloads clojure-mode-autoloads
compat-autoloads corfu-autoloads denote-autoloads
dockerfile-mode-autoloads eglot-autoloads rx marginalia-autoloads
markdown-mode-autoloads php-mode-autoloads prettier-autoloads
f-autoloads dash-autoloads request-autoloads rust-mode-autoloads
use-package-ensure-system-package-autoloads system-packages-autoloads
info vertico-autoloads which-key-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 eieio-loaddefs
password-cache json subr-x map byte-opt gv bytecomp byte-compile cconv
url-vars cl-loaddefs cl-lib early-init rmc iso-transl tooltip eldoc
paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode
mwheel term/pgtk-win pgtk-win term/common-win 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
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 make-network-process emacs)

Memory information:
((conses 16 818637 38632)
 (symbols 48 37719 0)
 (strings 32 158969 5703)
 (string-bytes 1 4933609)
 (vectors 16 59200)
 (vector-slots 8 724066 31648)
 (floats 8 367 165)
 (intervals 56 690 0)
 (buffers 992 26))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56457; Package emacs. (Sat, 09 Jul 2022 03:55:01 GMT) Full text and rfc822 format available.

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

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: 56457 <at> debbugs.gnu.org
Subject: Re: 29.0.50; set-frame-width and frame-width are not exactly
 complimentary
Date: Sat, 09 Jul 2022 09:24:38 +0530
More info:

If I remove "--with-pgtk" from build configuration then it works
fine. So the issue is with the PGTK builds.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56457; Package emacs. (Sat, 09 Jul 2022 04:58:02 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Pankaj Jangid <pankaj <at> codeisgreat.org>
Cc: 56457 <at> debbugs.gnu.org
Subject: Re: bug#56457: 29.0.50; set-frame-width and frame-width are not
 exactly complimentary
Date: Sat, 09 Jul 2022 12:56:44 +0800
Pankaj Jangid <pankaj <at> codeisgreat.org> writes:

> I have written a small lisp function to toggle width of frame to twice
> and half. This is not behaving as desired. Here is my lisp.
>
> (defun my/toggle-frame-width ()
>   "Toggle \"frame-width\"."
>   (interactive)
>   
>   (let ((width (frame-width)))
> 	(if (and (> width 75) (< width 85))
> 		(set-frame-width nil (* width 2))
> 	  (set-frame-width nil (/ width 2))
> 	(message "Frame size: %sx%s" (frame-width) (frame-height)))))
> (global-set-key (kbd "<f9>") 'my/toggle-frame-width)
>
> Steps:
> 1. emacs -Q
> 2. Evaluate above lisp. (WARN) This binds <f9> also.
> 3. Pres <f9> a couple of times 
>
> Result:
> After a couple of iterations. The frame-width is getting smaller and
> smaller.
>
> Desired behaviour:
> It should only toggle the width to double and half alternately.

What happens if you set `frame-resize-pixelwise' to nil, and create a
new frame?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56457; Package emacs. (Sat, 09 Jul 2022 07:05:01 GMT) Full text and rfc822 format available.

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

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 56457 <at> debbugs.gnu.org
Subject: Re: bug#56457: 29.0.50; set-frame-width and frame-width are not
 exactly complimentary
Date: Sat, 09 Jul 2022 12:34:39 +0530
Po Lu <luangruo <at> yahoo.com> writes:

> What happens if you set `frame-resize-pixelwise' to nil, and create a
> new frame?

frame-resize-pixelwise is set to default value i.e. nil and with this
when I create new a frame using make-frame-command it creates a new
frame with frame-width 79. Repeating this any number of times has the
same outcome.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56457; Package emacs. (Sat, 09 Jul 2022 07:48:02 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Pankaj Jangid <pankaj <at> codeisgreat.org>
Cc: 56457 <at> debbugs.gnu.org
Subject: Re: bug#56457: 29.0.50; set-frame-width and frame-width are not
 exactly complimentary
Date: Sat, 09 Jul 2022 15:47:04 +0800
Pankaj Jangid <pankaj <at> codeisgreat.org> writes:

> Po Lu <luangruo <at> yahoo.com> writes:
>
>> What happens if you set `frame-resize-pixelwise' to nil, and create a
>> new frame?
>
> frame-resize-pixelwise is set to default value i.e. nil and with this
> when I create new a frame using make-frame-command it creates a new
> frame with frame-width 79. Repeating this any number of times has the
> same outcome.

Sorry, I meant to set it to a non-nil value.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56457; Package emacs. (Sat, 09 Jul 2022 08:19:01 GMT) Full text and rfc822 format available.

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

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 56457 <at> debbugs.gnu.org
Subject: Re: bug#56457: 29.0.50; set-frame-width and frame-width are not
 exactly complimentary
Date: Sat, 09 Jul 2022 13:48:34 +0530
Po Lu <luangruo <at> yahoo.com> writes:

>>> What happens if you set `frame-resize-pixelwise' to nil, and create a
>>> new frame?
>>
>> frame-resize-pixelwise is set to default value i.e. nil and with this
>> when I create new a frame using make-frame-command it creates a new
>> frame with frame-width 79. Repeating this any number of times has the
>> same outcome.
>
> Sorry, I meant to set it to a non-nil value.

If I set it to "t" then my toggle function also works correctly. And the
new frames are launched with frame-width 80. Here is my slightly updated
lisp,

--8<---------------cut here---------------start------------->8---
(custom-set-variables
 '(frame-resize-pixelwise t))

(defun my/cycle-frame-width ()
  "Cycle \"frame-width\"."
  (interactive)
  
  (let ((width (frame-width)))
	(if (and (> width 75) (< width 85))
		(set-frame-width nil (* width 2))
	  (set-frame-width nil (/ width 2)))
	(message "Frame size: %sx%s" (frame-width) (frame-height))))
(global-set-key (kbd "<f9>") 'my/cycle-frame-width)
--8<---------------cut here---------------end--------------->8---

The only issue now is that, the "(message..." statement prints width as
83. I don't know why. If I evaluate (frame-width), it shows 80.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56457; Package emacs. (Sat, 09 Jul 2022 08:22:02 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Pankaj Jangid <pankaj <at> codeisgreat.org>
Cc: 56457 <at> debbugs.gnu.org
Subject: Re: bug#56457: 29.0.50; set-frame-width and frame-width are not
 exactly complimentary
Date: Sat, 09 Jul 2022 16:21:09 +0800
Pankaj Jangid <pankaj <at> codeisgreat.org> writes:

> If I set it to "t" then my toggle function also works correctly. And the
> new frames are launched with frame-width 80. Here is my slightly updated
> lisp,
>
> (custom-set-variables
>  '(frame-resize-pixelwise t))
>
> (defun my/cycle-frame-width ()
>   "Cycle \"frame-width\"."
>   (interactive)
>   
>   (let ((width (frame-width)))
> 	(if (and (> width 75) (< width 85))
> 		(set-frame-width nil (* width 2))
> 	  (set-frame-width nil (/ width 2)))
> 	(message "Frame size: %sx%s" (frame-width) (frame-height))))
> (global-set-key (kbd "<f9>") 'my/cycle-frame-width)
>
> The only issue now is that, the "(message..." statement prints width as
> 83. I don't know why. If I evaluate (frame-width), it shows 80.

Then that's a known problem with PGTK.  I will look into it some more in
the near future, but it's probably a GTK bug.




This bug report was last modified 1 year and 284 days ago.

Previous Next


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