Subject: Re: bug#56457: 29.0.50; set-frame-width and frame-width are not exactly complimentary

From: Po Lu <[email-masked]>
Date: Sat, 09 Jul 2022 12:56:44 +0800

Pankaj Jangid <[email-masked]> 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?