Subject: 29.0.90; Propertized space in Org Agenda's mode-name

From: Gustavo Barros <[email-masked]>
Date: Fri, 14 Apr 2023 20:04:17 -0300

Hi All,

I've reported this some time ago at the Org bugtracker
(https://list.orgmode.org/[email-masked]/T/#u) and, since I
was testing the pre-release this week and the issue is still around, I
reiterated it.  But I was asked to report it to the Emacs bug tracker
instead, thus this report.

I met a particularly strange issue related to Org Agenda's
`mode-name'.  And one space in particular, the one that is added
before `org-agenda-current-span'.  The `mode-name' for the Agenda is
set by `org-agenda-set-mode-name', and inside it we find:

#+begin_src emacs-lisp
" "
'(:eval (org-agenda-span-name org-agenda-current-span))
#+end_src

Now, this space somehow gets propertized.

A recipe for it.  Start `emacs -Q'.  Set things up:

#+begin_src emacs-lisp
(setq org-agenda-files '("~/agenda.org"))
(setq eval-expression-print-level nil)
(setq eval-expression-print-length nil)
#+end_src

Let's say =agenda.org= contains:

#+begin_src org
,* TODO Task
SCHEDULED: <2023-04-14 Fri>
#+end_src

Call `M-x org-agenda RET a'.  Now examine `mode-name' with `M-:
mode-name RET' to get:

#+begin_src emacs-lisp
("Org-Agenda" "" #(" " 0 1 (org-category "agenda" tags nil
org-priority-highest 65 org-priority-lowest 67 time-of-day nil
duration nil breadcrumbs nil txt #("TODO Task" 0 9 (org-heading t
effort-minutes nil effort nil fontified nil)) level " " time "" extra
"Scheduled: " format (((org-prefix-has-time t) (org-prefix-has-tag
nil) (org-prefix-category-length 12) (org-prefix-has-effort nil)
(org-prefix-has-breadcrumbs nil)) (format " %s %s%s%s" (format "%s"
(if (member category-icon '("" nil)) "" (concat category-icon ""
(get-text-property 0 'extra-space category-icon)))) (format "%-12s"
(if (member category '("" nil)) "" (concat category ":"
(get-text-property 0 'extra-space category)))) (if (member time '(""
nil)) "" (format "%-12s" (concat time ""))) (format "%s" (if (member
extra '("" nil)) "" (concat extra " " (get-text-property 0
'extra-space extra)))))) dotime time org-not-done-regexp "\\(TODO\\)"
org-todo-regexp "\\(DONE\\|TODO\\)" org-complex-heading-regexp
"^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?:
+\\(.*?\\)\\)??\\(?:[     ]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[     ]*$"
done-face org-agenda-done mouse-face highlight help-echo "mouse-2 or
RET jump to Org file ~/agenda.org" undone-face org-scheduled-today
face org-scheduled-today org-marker #<marker (moves after insertion)
at 24 in agenda.org> org-hd-marker #<marker (moves after insertion) at
1 in agenda.org> type "scheduled" date (4 14 2023) ts-date 738624
warntime nil effort nil effort-minutes nil priority 1099 org-habit-p
nil todo-state #("TODO" 0 4 (fontified nil)))) (:eval
(org-agenda-span-name org-agenda-current-span)) "" "" "" " Ddl" "
Grid" "" "" "" "" "" "" "" "" "")
#+end_src

So, it appears that the Org Agenda buffer's properties are somehow
getting to that particular space in `mode-name'.  It completely beats
me how it is so but, alas, it is there.

This is a problem because, depending on what the content of your
agenda is, this might result in this space getting some visually
distinctive property.  In my case, I get a blank gap in the mode-line
at this point.  I couldn't generate a simple ECM that gets this
effect.  But, at this point, it should be clear it can happen, given
these properties are there.

Best regards,
Gustavo.

In GNU Emacs 29.0.90 (build 2, x86_64-pc-linux-gnu, GTK+ Version
 3.24.33, cairo version 1.16.0) of 2023-04-10 built on gusbrs-desktop
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Linux Mint 21.1

Configured using:
 'configure --with-mailutils --with-xwidgets --with-native-compilation
 --without-compress-install'

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 WEBP X11 XDBE XIM XINPUT2
XPM XWIDGETS GTK3 ZLIB

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

Major mode: Messages

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-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
  buffer-read-only: 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 mail-extr emacsbug diary-lib diary-loaddefs cal-iso
oc-basic ol-eww eww url-queue thingatpt mm-url ol-rmail ol-mhe ol-irc
ol-info ol-gnus nnselect gnus-art mm-uu mml2015 mm-view mml-smime smime
gnutls dig gnus-sum shr pixel-fill kinsoku url-file svg dom browse-url
url url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util url-parse auth-source eieio
eieio-core json map byte-opt url-vars gnus-group gnus-undo gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo
parse-time gnus-spec gnus-int gnus-range message sendmail mailcap
yank-media puny rfc822 mml mml-sec password-cache 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 text-property-search mail-utils range mm-util
mail-prsvr wid-edit ol-docview doc-view filenotify jka-compr image-mode
exif dired dired-loaddefs ol-bibtex bibtex iso8601 ol-bbdb ol-w3m ol-doi
org-link-doi face-remap org-agenda org-element org-persist xdg org-id
avl-tree generator org-refile org ob ob-tangle ob-ref ob-lob ob-table
ob-exp org-macro org-src ob-comint org-pcomplete pcomplete comint
ansi-osc ansi-color ring org-list org-footnote org-faces org-entities
noutline outline ob-emacs-lisp ob-core ob-eval org-cycle org-table
org-keys oc org-loaddefs find-func cal-menu calendar cal-loaddefs ol
org-fold org-fold-core org-compat org-version org-macs format-spec
time-date cl-loaddefs comp comp-cstr warnings icons subr-x rx cl-seq
cl-macs gv cl-extra help-mode bytecomp byte-compile 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 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 move-toolbar gtk x-toolkit
xinput2 x multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 258488 14637)
 (symbols 48 21279 0)
 (strings 32 72219 2491)
 (string-bytes 1 2252850)
 (vectors 16 39079)
 (vector-slots 8 711251 27711)
 (floats 8 337 81)
 (intervals 56 389 0)
 (buffers 984 13))