all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#56457: 29.0.50; set-frame-width and frame-width are not exactly complimentary
@ 2022-07-09  3:28 Pankaj Jangid
  2022-07-09  3:54 ` Pankaj Jangid
  2022-07-09  4:56 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 7+ messages in thread
From: Pankaj Jangid @ 2022-07-09  3:28 UTC (permalink / raw)
  To: 56457


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))





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#56457: 29.0.50; set-frame-width and frame-width are not exactly complimentary
  2022-07-09  3:28 bug#56457: 29.0.50; set-frame-width and frame-width are not exactly complimentary Pankaj Jangid
@ 2022-07-09  3:54 ` Pankaj Jangid
  2022-07-09  4:56 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 7+ messages in thread
From: Pankaj Jangid @ 2022-07-09  3:54 UTC (permalink / raw)
  To: 56457

More info:

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#56457: 29.0.50; set-frame-width and frame-width are not exactly complimentary
  2022-07-09  3:28 bug#56457: 29.0.50; set-frame-width and frame-width are not exactly complimentary Pankaj Jangid
  2022-07-09  3:54 ` Pankaj Jangid
@ 2022-07-09  4:56 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-07-09  7:04   ` Pankaj Jangid
  1 sibling, 1 reply; 7+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-09  4:56 UTC (permalink / raw)
  To: Pankaj Jangid; +Cc: 56457

Pankaj Jangid <pankaj@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?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#56457: 29.0.50; set-frame-width and frame-width are not exactly complimentary
  2022-07-09  4:56 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-07-09  7:04   ` Pankaj Jangid
  2022-07-09  7:47     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 7+ messages in thread
From: Pankaj Jangid @ 2022-07-09  7:04 UTC (permalink / raw)
  To: Po Lu; +Cc: 56457

Po Lu <luangruo@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#56457: 29.0.50; set-frame-width and frame-width are not exactly complimentary
  2022-07-09  7:04   ` Pankaj Jangid
@ 2022-07-09  7:47     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-07-09  8:18       ` Pankaj Jangid
  0 siblings, 1 reply; 7+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-09  7:47 UTC (permalink / raw)
  To: Pankaj Jangid; +Cc: 56457

Pankaj Jangid <pankaj@codeisgreat.org> writes:

> Po Lu <luangruo@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#56457: 29.0.50; set-frame-width and frame-width are not exactly complimentary
  2022-07-09  7:47     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-07-09  8:18       ` Pankaj Jangid
  2022-07-09  8:21         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 7+ messages in thread
From: Pankaj Jangid @ 2022-07-09  8:18 UTC (permalink / raw)
  To: Po Lu; +Cc: 56457

Po Lu <luangruo@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#56457: 29.0.50; set-frame-width and frame-width are not exactly complimentary
  2022-07-09  8:18       ` Pankaj Jangid
@ 2022-07-09  8:21         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 7+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-09  8:21 UTC (permalink / raw)
  To: Pankaj Jangid; +Cc: 56457

Pankaj Jangid <pankaj@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-07-09  8:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-09  3:28 bug#56457: 29.0.50; set-frame-width and frame-width are not exactly complimentary Pankaj Jangid
2022-07-09  3:54 ` Pankaj Jangid
2022-07-09  4:56 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-09  7:04   ` Pankaj Jangid
2022-07-09  7:47     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-09  8:18       ` Pankaj Jangid
2022-07-09  8:21         ` Po Lu 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.