Subject: 26.1; set-frame-width sometimes does not work on OSX

From: Markus Triska <[email-masked]>
Date: Sat, 09 Nov 2019 10:21:13 +0100

When I do:

    $ emacs -Q -l frame.el

where frame.el consists of the forms:

    (defface item-frame
      '((((class color))
         (:family "DejaVu Sans Mono"
          :height 151)))
      "Face for frame to demonstrate the issue.")

    (progn
      (set-frame-font (face-font 'item-frame))
      (set-frame-width nil 102)
      (set-frame-position nil
                          (/ (- (display-pixel-width) (frame-pixel-width)) 2)
                          (cdr (frame-position))))

and then, in the resulting Emacs instance, do:

    M-: (frame-width) RET

I get: 80.

However, the expected result is 102, because the form
(set-frame-width nil 102) above sets the frame width to 102.

I get the expected value of 102 if I remove the call to
set-frame-position. This is unexpected, because whether
set-frame-position is called should not influence the frame width.

When I evaluate the form (set-frame-width nil 102) in the resulting
Emacs instance, the frame width is set to 102 as expected.

Thank you for looking into this!

All the best,
Markus

In GNU Emacs 26.1 (build 1, x86_64-apple-darwin15.3.0, X toolkit, Xaw scroll bars)
 of 2018-09-22 built on mt-mb
Windowing system distributor 'The X.Org Foundation', version 11.0.11502000

Configured using:
 'configure --prefix=/opt/local --without-ns --without-dbus
 --without-gconf --without-libotf --without-m17n-flt --without-gpm
 --with-gnutls --with-xml2 --with-modules --infodir
 /opt/local/share/info/emacs --with-x-toolkit=lucid --without-xaw3d
 --without-imagemagick --with-xpm --with-jpeg --with-tiff --with-gif
 --with-png --with-lcms2 --without-rsvg --with-xft 'CFLAGS=-pipe -Os
 -arch x86_64' CPPFLAGS=-I/opt/local/include 'LDFLAGS=-L/opt/local/lib
 -Wl,-headerpad_max_install_names -lfreetype -lfontconfig -Wl,-no_pie
 -arch x86_64''

Configured features:
XPM JPEG TIFF GIF PNG GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE XFT
ZLIB TOOLKIT_SCROLL_BARS LUCID X11 MODULES THREADS LCMS2

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