Subject: bug#46557: 28.0.50; Visual glitches in text mode when tab-bar visibility is altered at load time

From: Bastian Beranek <[email-masked]>
Date: Tue, 16 Feb 2021 12:05:51 +0100

The following recipe creates a broken visual appearance of emacs in text
mode, at least on GNU/Linux:

1) Create a test.el file with these lines:

(set-frame-parameter nil 'tab-bar-lines 0)
(set-frame-parameter nil 'tab-bar-lines 1)
(set-frame-parameter nil 'tab-bar-lines 0)

2) Start emacs in text mode with:
emacs -nw -Q -l test.el

3) Create a few tabs with "C-x t 2"

The menu-bar is not showing after emacs starts. In addition, tabs start
to appear in two lines. Other visual artifacts (lines jumping around for
example) will become apparent after using emacs for a while.

In the real world this problem appeared because I had customized a
variable (tab-bar-select-tab-modifiers) that ran:

(tab-bar-mode -1)
(tab-bar-mode 1)

in its :set function.

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.25)
 of 2021-02-13 built on bastian-desktop
Repository revision: d3a399dd299bf7e811cf42950d5f8ac67f063b36
Repository branch: makepkg
Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-sound=alsa --with-modules --with-nativecomp --without-gconf
 --without-gsettings --enable-link-time-optimization
 --with-x-toolkit=gtk3 --without-xaw3d --without-cairo
 --without-compress-install 'CFLAGS=-march=native -O2 -pipe -fno-plt
 -flto -fuse-linker-plugin -flto -fuse-linker-plugin'
 CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
ACL DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2
LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XFT XIM
XPM GTK3 ZLIB

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

Major mode: Article

Minor modes in effect:
  recentf-mode: t
  helm-fuzzier-mode: t
  async-bytecomp-package-mode: t
  helm-flx-mode: t
  projectile-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  flx-ido-mode: t
  ido-everywhere: t
  shell-dirtrack-mode: t
  show-paren-mode: t
  global-hi-lock-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/beischer/.emacs.d/elpa/cmake-mode-20210104.1831/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
~/.emacs.d/lisp/buff-menu+ hides /usr/share/emacs/site-lisp/various/buff-menu+
~/.emacs.d/lisp/my-term hides /usr/share/emacs/site-lisp/various/my-term
~/.emacs.d/lisp/buff-menu hides /usr/share/emacs/site-lisp/various/buff-menu
~/.emacs.d/lisp/qt-pro hides /usr/share/emacs/site-lisp/various/qt-pro
~/.emacs.d/lisp/buff-menu hides /usr/share/emacs/28.0.50/lisp/buff-menu
~/.emacs.d/lisp/tab-bar hides /usr/share/emacs/28.0.50/lisp/tab-bar

Features:
(shadow emacsbug jka-compr mailalias smtpmail sendmail recentf flow-fill
qp sort smiley gnus-cite mail-extr gnus-async gnus-bcklg gnus-agent
gnus-srvr gnus-score score-mode nnvirtual nntp gnus-ml gnus-msg nndoc
gnus-cache gnus-dup gnus-art mm-uu mml2015 mm-view mml-smime smime dig
gnus-sum shr kinsoku svg dom gnus-group gnus-undo gnus-start gnus-dbus
dbus gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo gnus-spec
gnus-int gnus-range gnus-win gnus nnheader mm-archive gnutls url-cache
debbugs-gnu debbugs soap-client url-http url-auth url-gw rng-xsd rng-dt
rng-util xsd-regexp xml magit-extras mule-util vc vc-dispatcher misearch
multi-isearch ido-completing-read+ memoize cus-edit minibuf-eldef vc-git
bug-reference whitespace cap-words superword subword company-oddmuse
company-keywords company-etags etags fileloop generator company-gtags
company-dabbrev-code company-dabbrev company-files company-clang
company-capf company-cmake company-semantic company-template
company-bbdb company-edbi edbi sql view company-jedi jedi-core
python-environment epc ctable concurrent deferred tree-sitter-langs
tree-sitter-langs-build tar-mode arc-mode archive-mode pp tree-sitter-hl
tree-sitter tree-sitter-load tree-sitter-cli tsc tsc-dyn tsc-dyn-get
dired-aux tsc-obsolete ccls ccls-member-hierarchy
ccls-inheritance-hierarchy ccls-call-hierarchy ccls-tree ccls-code-lens
ccls-semantic-highlight ccls-common lsp-ui lsp-ui-flycheck lsp-ui-doc
goto-addr lsp-ui-imenu lsp-ui-peek lsp-ui-sideline flycheck lsp-ui-util
lsp-mode lsp-protocol xref project tree-widget wid-edit spinner
network-stream nsm markdown-mode lv inline ht ewoc dash-functional
bindat cmake-project helm-fuzzier helm async-bytecomp
helm-global-bindings helm-easymenu helm-source eieio-compat
helm-multi-match helm-lib async helm-flx f s tramp-cache projectile
ibuf-ext ibuffer ibuffer-loaddefs dropdown-list yasnippet-snippets
yasnippet my-term vterm face-remap term disp-table ehelp vterm-module
term/xterm xterm cmake-mode rst qt-pro pastebin ams-meeting calc-mouse
calc-yank calc-ext calc calc-loaddefs calc-macs realgud realgud-zshdb
realgud:zshdb-track-mode realgud:zshdb-core realgud:zshdb-init
realgud-trepan3k realgud:trepan3k-track-mode realgud:trepan3k-core
realgud:trepan3k-init realgud-trepan2 realgud:trepan2-track-mode
realgud:trepan2-core realgud:trepan2-init realgud-trepanpl
realgud:trepanpl-track-mode realgud:trepanpl-core realgud:trepanpl-init
realgud-trepanjs realgud:trepanjs-track-mode realgud:trepanjs-core
realgud:trepanjs-init realgud-lang-js realgud-trepan
realgud:trepan-track-mode realgud:trepan-core realgud:trepan-init
realgud-remake realgud:remake-track-mode realgud:remake-core
realgud:remake-init realgud-rdebug realgud-rdebug-track-mode
realgud-rdebug-core realgud-rdebug-init realgud-lang-ruby realgud-perldb
realgud:perldb-track-mode realgud:perldb-core realgud:perldb-init
realgud-lang-perl realgud-pdb realgud:pdb-track-mode realgud:pdb-core
realgud:pdb-init realgud-lang-python python tramp-sh realgud-kshdb
realgud:kshdb-track-mode realgud:kshdb-core realgud:kshdb-init
realgud-gub realgud:gub-track-mode realgud:gub-core realgud:gub-init
realgud-gdb realgud:gdb-track-mode realgud:gdb-init realgud:gdb-core
realgud-bashdb realgud:bashdb-track-mode realgud:bashdb-core
realgud:bashdb-init realgud-lang-posix-shell realgud:run
realgud-locals-mode realgud-breakpoint-mode realgud-backtrack-mode
realgud-track-mode realgud-backtrace-mode realgud-attach
realgud-lang-java realgud-track realgud-shortkey realgud-menu
realgud-eval realgud-cmds realgud-send realgud-window realgud-utils
eshell realgud-init realgud-file realgud-core realgud-reset
realgud-buffer-helper realgud-buffer-breakpoint realgud-buffer-backtrace
realgud-locals realgud-buffer-locals realgud-buffer-command
realgud-buffer-info realgud-lochist org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete
org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob-core ob-eval org-table ol org-keys org-compat org-macs
org-loaddefs find-func cal-menu calendar cal-loaddefs realgud-bp
realgud-bp-image-data realgud-lang esh-mode esh-cmd esh-ext esh-opt
esh-proc esh-io esh-arg esh-module esh-groups esh-util realgud-loc
realgud-buffer-source realgud-key key realgud-follow realgud-fringe
realgud-helper loc-changes realgud-regexp realgud-custom load-relative
ivy delsel ivy-faces ivy-overlay colir color company hide-lines
buff-menu+ magit-submodule magit-obsolete magit-popup magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log which-func imenu magit-diff smerge-mode diff
diff-mode git-commit log-edit message rmc puny rfc822 mml mml-sec epa
derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader
pcvs-util add-log magit-core magit-autorevert autorevert filenotify
magit-margin magit-transient magit-process with-editor server magit-mode
transient easy-mmode magit-git magit-section magit-utils crm dash
hideshow flx-ido advice flx ido dired-x dired dired-loaddefs cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs flymake-proc flymake thingatpt vc-cvs finder-inf edmacro kmacro
emacs-x-theme tramp tramp-loaddefs trampver tramp-integration files-x
tramp-compat shell pcomplete parse-time iso8601 time-date ls-lisp
format-spec paren grep compile text-property-search comint ansi-color
ring linum hi-lock cus-start cus-load tex-site comp comp-cstr warnings
rx cl-extra help-mode realgud-recursive-autoloads info package easymenu
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie 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 url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic 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 charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face pcase macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process nativecomp emacs)

Memory information:
((conses 16 1040393 380066)
 (symbols 48 64112 40)
 (strings 32 242123 70791)
 (string-bytes 1 7741606)
 (vectors 16 94737)
 (vector-slots 8 1812716 598229)
 (floats 8 650 1243)
 (intervals 56 6500 7273)
 (buffers 984 36))