Subject: 30.0.60; Using mode-line-format-right-align in header line results in cutoff text

From: noa <[email-masked]>
Date: Sat, 29 Jun 2024 03:04:08 +0100

I would expect the header-line-format and mode-line-format to behave the same way when using the mode-line-format-right-align construct.  But instead, the behaviour is a little strange and appears to rely on the value of mode-line-format:

;; This will result in the right-aligned text being cut off.
(setq-default header-line-format '("foo" mode-line-format-right-align "bar"))

;; This will make both header and mode line align as expected.
(setq-default header-line-format '("foo" mode-line-format-right-align "bar"))
(setq-default mode-line-format '("foo" mode-line-format-right-align "bar"))

;; This will result in the right-aligned text being cut off.
(setq-default header-line-format '("foo" mode-line-format-right-align "bar"))
(setq-default mode-line-format nil)

;; This will result in the mode-line-format-right-align construct being ignored:
(setq-default header-line-format '("foo" mode-line-format-right-align "bar"))
(setq-default mode-line-format "baz")

;; This will result in the mode-line-format-right-align construct being ignored:
(setq-default header-line-format '("foo" mode-line-format-right-align "bar"))
(setq-default mode-line-format 'mode-line-modes)

So if the header line is set to use this construct, it only works correctly if the mode line is also using the construct.  The right aligned text in the header line will also be indented from the right to be in line with whatever is at the right of the mode line.

If the mode line is set to nil or a list which does not contain the construct, the right aligned portion of the header line will be cut off.

If the mode line is set to a string or a symbol, the right aligned portion of the header line is on the left hand side as if the construct were not there at all.

In GNU Emacs 30.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.16.0) of 2024-06-29 built on baby
Repository revision: df0eb5be1eac7763236a99ffeb6e2b3561955bd9
Repository branch: emacs-30
Windowing system distributor 'The X.Org Foundation', version 11.0.12201009
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-x-toolkit=gtk3 --with-imagemagick
 --with-tree-sitter --with-xwidgets --with-native-compilation=aot
 --with-mailutils'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
IMAGEMAGICK JPEG 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 WEBP X11 XDBE XIM
XINPUT2 XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  age-encryption-mode: t
  isearch-mb-mode: t
  global-aggressive-indent-mode: t
  aggressive-indent-mode: t
  elastic-table-mode: t
  elastic-indent-mode: t
  global-auto-revert-mode: t
  global-so-long-mode: t
  save-place-mode: t
  pixel-scroll-precision-mode: t
  recentf-mode: t
  display-time-mode: t
  display-battery-mode: t
  savehist-mode: t
  marginalia-mode: t
  global-jinx-mode: t
  jinx-mode: t
  jabber-activity-mode: t
  global-goto-address-mode: t
  goto-address-mode: t
  override-global-mode: t
  vertico-mouse-mode: t
  vertico-mode: t
  minibuffer-depth-indicate-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
  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
  window-divider-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  auto-save-visited-mode: t
  auto-save-mode: t

Load-path shadows:
/home/noa/.config/emacs/site-lisp/anzu hides /home/noa/.config/emacs/elpa/anzu-20240202.447/anzu
/home/noa/.config/emacs/site-lisp/orderless hides /home/noa/.config/emacs/elpa/orderless-20240606.1026/orderless
/home/noa/.config/emacs/site-lisp/dash hides /home/noa/.config/emacs/elpa/dash-20240510.1327/dash
/home/noa/.config/emacs/elpa/transient-20240623.1341/transient hides /usr/local/share/emacs/30.0.60/lisp/transient

Features:
(pulse shadow sort visual-fill-column mail-extr emacsbug message
yank-media rfc822 mml mml-sec epa derived epg epg-config gnus-util
text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail vertico-directory mule-util
help-fns radix-tree tramp-cmds cursor-sensor rmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils auth-source-passage age
rfc6068 cookie1 isearch-mb aggressive-indent elastic-table
elastic-indent elastic-tools pcase dash autorevert filenotify so-long
help-at-pt saveplace tramp-sh tramp trampver tramp-integration files-x
tramp-message tramp-compat shell parse-time iso8601 tramp-loaddefs
pixel-scroll cua-base recentf tree-widget time battery dbus savehist
dired dired-loaddefs marginalia jinx org-agenda org-element
org-persist xdg org-id org-element-ast inline avl-tree generator
org-refile org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-src sh-script smie treesit executable ob-comint org-pcomplete
pcomplete comint ansi-osc ansi-color ring org-list org-footnote
org-faces org-entities noutline outline org-version ob-emacs-lisp
ob-core ob-eval org-cycle org-table org-keys oc org-loaddefs find-func
cal-menu calendar cal-loaddefs ol rx org-fold org-fold-core org-compat
org-macs jabber jabber-time jabber-autoaway time-date
jabber-vcard-avatars jabber-chatstates jabber-events jabber-vcard
jabber-avatar jabber-activity jabber-watch jabber-modeline
jabber-ahc-presence jabber-ahc jabber-version jabber-ourversion
jabber-muc-nick-completion jabber-muc jabber-bookmarks
jabber-muc-nick-coloring color jabber-browse jabber-search
jabber-register jabber-widget jabber-chat jabber-history
jabber-chatbuffer jabber-roster format-spec jabber-carbons
jabber-presence jabber-private jabber-logon jabber-conn srv dns
starttls gnutls puny jabber-core jabber-keepalive jabber-ping
jabber-disco jabber-iq jabber-console sgml-mode facemenu dom
jabber-truncate ewoc jabber-alert jabber-keymap jabber-sasl sasl
sasl-anonymous sasl-login sasl-plain jabber-menu jabber-util fsm
jabber-xml xml goto-addr thingatpt delsel fixed-pitch cl-extra
help-mode use-package-core tubthumping-theme edmacro kmacro bind-key
easy-mmode vertico-mouse vertico compat mb-depth
aggressive-indent-autoloads anzu-autoloads consult-autoloads
dired-du-autoloads isearch-mb-autoloads jabber-autoloads fsm-autoloads
jinx-autoloads marginalia-autoloads markdown-mode-autoloads
nov-autoloads esxml-autoloads kv-autoloads orderless-autoloads
org-modern-autoloads pass-autoloads f-autoloads
password-store-otp-autoloads password-store-autoloads
persist-autoloads s-autoloads srv-autoloads
taxy-magit-section-autoloads taxy-autoloads magit-section-autoloads
dash-autoloads transient-autoloads valign-autoloads vertico-autoloads
visual-fill-column-autoloads info with-editor-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
password-cache json subr-x map byte-opt gv bytecomp byte-compile
url-vars cus-edit pp cus-load icons wid-edit cl-loaddefs cl-lib 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
xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo gtk x-toolkit xinput2 x
multi-tty move-toolbar make-network-process native-compile emacs)

Memory information:
((conses 16 385689 306172) (symbols 48 24817 5)
 (strings 32 91428 30898) (string-bytes 1 4096818) (vectors 16 46910)
 (vector-slots 8 1292544 256651) (floats 8 352 224)
 (intervals 56 3206 628) (buffers 992 14))

-- 
~noa (https://noa.pub)
 • I try to reply to formal emails in three sentences or fewer; excuse my brevity.
 • I queue replies and batch send them at intervals; excuse my untimeliness.