Subject: bug#67678: 30.0.50; Turning off menu-bar-mode after setting some default face attributes causes bad initial rendering

From: Mekeor Melire <[email-masked]>
Date: Thu, 07 Dec 2023 07:35:36 +0000

When I run "emacs -Q -l the-following-snippet.el",

--8<---------------cut here---------------start------------->8---
;; this snippet does provoke the bug.
(set-face-attribute 'default nil :weight 'medium)
(menu-bar-mode 0)
--8<---------------cut here---------------end--------------->8---

I find an Emacs frame with bad initial rendering: There is no text
visible. See attached screenshot.

When I resize the frame, the rendering is corrected, i.e. the text of
the scratch buffer becomes visible.

The bug IS ALSO provoked when the first S-expressions is replaced with
one of the following:

--8<---------------cut here---------------start------------->8---
;; either
(custom-set-faces '(default ((t :weight medium)) t))
;; or
(custom-set-faces '(default ((t :height 110)) t))
;; or
(custom-theme-set-faces 'user '(default ((t :slant italic)) t))
;; or similar.
--8<---------------cut here---------------end--------------->8---

The bug IS NOT provoked when the order of the two S-expressions is
reversed, for example:

--8<---------------cut here---------------start------------->8---
;; this snippet does not provoke the bug.
(menu-bar-mode 0)
(set-face-attribute 'default nil :weight 'medium)
--8<---------------cut here---------------end--------------->8---

The bug IS NOT provoked when any face other than "default" is altered,
for example:

--8<---------------cut here---------------start------------->8---
;; this snippet does not provoke the bug.
(set-face-attribute 'link nil :weight 'medium)
(menu-bar-mode 0)
--8<---------------cut here---------------end--------------->8---

The bug IS NOT provoked for some face-attributes, e.g. ":box" and
":underline":

--8<---------------cut here---------------start------------->8---
;; this snippet does not provoke the bug.
(set-face-attribute 'default nil :box t)
(menu-bar-mode 0)
--8<---------------cut here---------------end--------------->8---

The person with nickname "twb" in #emacs on irc.libera.chat suggests
"there is just a 'and then rerender' command missing somewhere".
Personally, I wonder if there is a mistake how menu-bar.el handles
a customized default face. See:

https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/menu-bar.el?h=e4e1e268c8e9f7de6fe5d4b05beb595a1781c02c#n839

I'm not sure if it's relevant but I use the tiling window manager
XMonad.

In GNU Emacs 30.0.50 (build 1, x86_64-unknown-linux-gnu, Motif Version
2.3.8, cairo version 1.16.0)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Guix System

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash
 SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash
 --prefix=/gnu/store/whmdrrv8db90a238jgjy24hd13diljfl-emacs-next-motif-30.0.50-1.9d27b95
 --enable-fast-install --build=x86_64-unknown-linux-gnu
 --with-x-toolkit=motif --with-modules --with-native-compilation=aot
 --disable-build-details'

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

Important settings:
  value of $EMACSLOADPATH: /home/user/.guix-profile/share/emacs/site-lisp:/home/user/.guix-profile/share/emacs/site-lisp:/gnu/store/whmdrrv8db90a238jgjy24hd13diljfl-emacs-next-motif-30.0.50-1.9d27b95/share/emacs/30.0.50/lisp
  value of $EMACSNATIVELOADPATH: /home/user/.guix-profile/lib/emacs/native-site-lisp:/home/user/.guix-profile/lib/emacs/native-site-lisp
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-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
  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:
/gnu/store/0mifjgb3nk2swyj2m6b2zqdf63y1m6aj-emacs-transient-0.4.3-0.cc0fa80/share/emacs/site-lisp/transient-0.4.3-0.cc0fa80/transient hides /gnu/store/whmdrrv8db90a238jgjy24hd13diljfl-emacs-next-motif-30.0.50-1.9d27b95/share/emacs/30.0.50/lisp/transient

Features:
(shadow sort mail-extr compile comint ansi-osc ansi-color ring comp
comp-cstr warnings icons rx cl-seq cl-macs gv cl-extra help-mode
bytecomp byte-compile emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date subr-x mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils 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 lcms2
dynamic-setting system-font-setting font-render-setting cairo motif
x-toolkit x multi-tty move-toolbar make-network-process native-compile
emacs)

Memory information:
((conses 16 90564 9685) (symbols 48 7873 0) (strings 32 22105 3160)
 (string-bytes 1 748587) (vectors 16 17797)
 (vector-slots 8 354875 6922) (floats 8 33 41) (intervals 56 279 0)
 (buffers 992 11))