unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73443: 29.4; ERC 5.6.1-git: erc-track mode line face color broken with left timestamps
@ 2024-09-23 20:04 tmarjeski
  2024-09-24  1:22 ` J.P.
       [not found] ` <87tte5zvzl.fsf@neverwas.me>
  0 siblings, 2 replies; 7+ messages in thread
From: tmarjeski @ 2024-09-23 20:04 UTC (permalink / raw)
  To: 73443; +Cc: emacs-erc


When setting erc-insert-timestamp-function to 'erc-insert-timestamp-left
the erc-track channel names in the mode line do not respect the nick
face color of whoever sent the message. The result is that the face
color is white or the color of the timestamp face, whereas with
'erc-insert-timestamp-right the color is of the nick that sent a
message.

Reproduction steps:
1. emacs -Q
2. (setq erc-insert-timestamp-function 'erc-insert-timestamp-left
         erc-timestamp-format "[%H:%M") ;; possibly unnecessary
   (erc-track-mode) ;; enable track mode in mode line
3. Connect to ERC
4. Join a few channels so the names are legible
5. Go to scratch or irc server buffer, wait for a message on a channel
6. Notice that the channel name is not the color of the nick who sent
the message


In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43,
cairo version 1.18.0)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: Arch Linux

Configured using:
 'configure --with-x-toolkit=gtk3 --with-native-compilation=aot
 --sysconfdir=/etc --prefix=/usr --libexecdir=/usr/lib
 --with-tree-sitter --localstatedir=/var --with-cairo
 --disable-build-details --with-harfbuzz --with-libsystemd
 --with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt
 -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer -g
 -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto'
 'LDFLAGS=-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro
 -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto'
 'CXXFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g
 -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF 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 GTK3 ZLIB

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

Major mode: ERC

Minor modes in effect:
  erc-ring-mode: t
  erc-nicks-mode: t
  erc-netsplit-mode: t
  erc-menu-mode: t
  erc-list-mode: t
  erc-imenu-mode: t
  erc-pcomplete-mode: t
  erc-button--phantom-users-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-autojoin-mode: t
  erc-irccontrols-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-scrolltobottom-mode: t
  erc-spelling-mode: t
  flyspell-mode: t
  erc-track-mode: (t erc-nicks--setup-track-integration)
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-networks-mode: t
  diff-hl-flydiff-mode: t
  global-diff-hl-mode: t
  electric-pair-mode: t
  apheleia-global-mode: t
  global-treesit-auto-mode: t
  corfu-popupinfo-mode: t
  global-corfu-mode: t
  corfu-mode: t
  marginalia-mode: t
  vertico-mode: t
  which-key-mode: t
  global-ligature-mode: t
  ligature-mode: t
  global-auto-revert-mode: t
  global-display-line-numbers-mode: t
  desktop-save-mode: t
  recentf-mode: t
  save-place-mode: t
  straight-use-package-mode: t
  straight-package-neutering-mode: t
  override-global-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/trev/.emacs.d/straight/build/external-completion/external-completion hides /usr/share/emacs/29.4/lisp/external-completion
/home/trev/.emacs.d/straight/build/transient/transient hides /usr/share/emacs/29.4/lisp/transient
/home/trev/.emacs.d/straight/build/jsonrpc/jsonrpc hides /usr/share/emacs/29.4/lisp/jsonrpc
/home/trev/.emacs.d/straight/build/eglot/eglot hides /usr/share/emacs/29.4/lisp/progmodes/eglot
/home/trev/.emacs.d/straight/build/xref/xref hides /usr/share/emacs/29.4/lisp/progmodes/xref
/home/trev/.emacs.d/straight/build/project/project hides /usr/share/emacs/29.4/lisp/progmodes/project
/home/trev/.emacs.d/straight/build/flymake/flymake hides /usr/share/emacs/29.4/lisp/progmodes/flymake
/home/trev/.emacs.d/straight/build/erc/erc-button hides /usr/share/emacs/29.4/lisp/erc/erc-button
/home/trev/.emacs.d/straight/build/erc/erc-backend hides /usr/share/emacs/29.4/lisp/erc/erc-backend
/home/trev/.emacs.d/straight/build/erc/erc-ibuffer hides /usr/share/emacs/29.4/lisp/erc/erc-ibuffer
/home/trev/.emacs.d/straight/build/erc/erc-compat hides /usr/share/emacs/29.4/lisp/erc/erc-compat
/home/trev/.emacs.d/straight/build/erc/erc-capab hides /usr/share/emacs/29.4/lisp/erc/erc-capab
/home/trev/.emacs.d/straight/build/erc/erc hides /usr/share/emacs/29.4/lisp/erc/erc
/home/trev/.emacs.d/straight/build/erc/erc-status-sidebar hides /usr/share/emacs/29.4/lisp/erc/erc-status-sidebar
/home/trev/.emacs.d/straight/build/erc/erc-identd hides /usr/share/emacs/29.4/lisp/erc/erc-identd
/home/trev/.emacs.d/straight/build/erc/erc-replace hides /usr/share/emacs/29.4/lisp/erc/erc-replace
/home/trev/.emacs.d/straight/build/erc/erc-sasl hides /usr/share/emacs/29.4/lisp/erc/erc-sasl
/home/trev/.emacs.d/straight/build/erc/erc-speedbar hides /usr/share/emacs/29.4/lisp/erc/erc-speedbar
/home/trev/.emacs.d/straight/build/erc/erc-notify hides /usr/share/emacs/29.4/lisp/erc/erc-notify
/home/trev/.emacs.d/straight/build/erc/erc-pcomplete hides /usr/share/emacs/29.4/lisp/erc/erc-pcomplete
/home/trev/.emacs.d/straight/build/erc/erc-list hides /usr/share/emacs/29.4/lisp/erc/erc-list
/home/trev/.emacs.d/straight/build/erc/erc-autoaway hides /usr/share/emacs/29.4/lisp/erc/erc-autoaway
/home/trev/.emacs.d/straight/build/erc/erc-xdcc hides /usr/share/emacs/29.4/lisp/erc/erc-xdcc
/home/trev/.emacs.d/straight/build/erc/erc-networks hides /usr/share/emacs/29.4/lisp/erc/erc-networks
/home/trev/.emacs.d/straight/build/erc/erc-page hides /usr/share/emacs/29.4/lisp/erc/erc-page
/home/trev/.emacs.d/straight/build/erc/erc-truncate hides /usr/share/emacs/29.4/lisp/erc/erc-truncate
/home/trev/.emacs.d/straight/build/erc/erc-lang hides /usr/share/emacs/29.4/lisp/erc/erc-lang
/home/trev/.emacs.d/straight/build/erc/erc-sound hides /usr/share/emacs/29.4/lisp/erc/erc-sound
/home/trev/.emacs.d/straight/build/erc/erc-fill hides /usr/share/emacs/29.4/lisp/erc/erc-fill
/home/trev/.emacs.d/straight/build/erc/erc-loaddefs hides /usr/share/emacs/29.4/lisp/erc/erc-loaddefs
/home/trev/.emacs.d/straight/build/erc/erc-ring hides /usr/share/emacs/29.4/lisp/erc/erc-ring
/home/trev/.emacs.d/straight/build/erc/erc-join hides /usr/share/emacs/29.4/lisp/erc/erc-join
/home/trev/.emacs.d/straight/build/erc/erc-desktop-notifications hides /usr/share/emacs/29.4/lisp/erc/erc-desktop-notifications
/home/trev/.emacs.d/straight/build/erc/erc-stamp hides /usr/share/emacs/29.4/lisp/erc/erc-stamp
/home/trev/.emacs.d/straight/build/erc/erc-netsplit hides /usr/share/emacs/29.4/lisp/erc/erc-netsplit
/home/trev/.emacs.d/straight/build/erc/erc-goodies hides /usr/share/emacs/29.4/lisp/erc/erc-goodies
/home/trev/.emacs.d/straight/build/erc/erc-track hides /usr/share/emacs/29.4/lisp/erc/erc-track
/home/trev/.emacs.d/straight/build/erc/erc-ezbounce hides /usr/share/emacs/29.4/lisp/erc/erc-ezbounce
/home/trev/.emacs.d/straight/build/erc/erc-common hides /usr/share/emacs/29.4/lisp/erc/erc-common
/home/trev/.emacs.d/straight/build/erc/erc-imenu hides /usr/share/emacs/29.4/lisp/erc/erc-imenu
/home/trev/.emacs.d/straight/build/erc/erc-services hides /usr/share/emacs/29.4/lisp/erc/erc-services
/home/trev/.emacs.d/straight/build/erc/erc-spelling hides /usr/share/emacs/29.4/lisp/erc/erc-spelling
/home/trev/.emacs.d/straight/build/erc/erc-match hides /usr/share/emacs/29.4/lisp/erc/erc-match
/home/trev/.emacs.d/straight/build/erc/erc-menu hides /usr/share/emacs/29.4/lisp/erc/erc-menu
/home/trev/.emacs.d/straight/build/erc/erc-dcc hides /usr/share/emacs/29.4/lisp/erc/erc-dcc
/home/trev/.emacs.d/straight/build/erc/erc-log hides /usr/share/emacs/29.4/lisp/erc/erc-log
/home/trev/.emacs.d/straight/build/eldoc/eldoc hides /usr/share/emacs/29.4/lisp/emacs-lisp/eldoc
/home/trev/.emacs.d/straight/build/seq/seq hides /usr/share/emacs/29.4/lisp/emacs-lisp/seq

Features:
(shadow sort mail-extr emacsbug message yank-media dired dired-loaddefs
rfc822 mml mml-sec gnus-util mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils cape orderless project consult
bookmark text-property-search pp ace-window avy markdown-mode thingatpt
noutline outline network-stream puny nsm erc-ring erc-nicks color
erc-netsplit erc-menu erc-list erc-imenu imenu erc-pcomplete pcomplete
comint ansi-osc ansi-color ring erc-button browse-url erc-fill erc-stamp
erc-join erc-goodies erc-spelling flyspell ispell erc-track erc-match
epa-file epa derived epg rfc6068 epg-config erc format-spec erc-backend
erc-networks erc-common erc-compat erc-loaddefs comp comp-cstr warnings
icons mule-util jka-compr time-date diff-hl-flydiff diff diff-hl
log-view pcvs-util vc-dir ewoc vc vc-git diff-mode vc-dispatcher
parinfer-rust-mode parinfer-rust-changes parinfer-rust track-changes
parinfer-rust-helper 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 password-cache json map url-vars mailcap
elec-pair rainbow-delimiters init erc-init erc-autoloads
markdown-mode-autoloads geiser-guile-autoloads geiser-autoloads
rust-mode-autoloads parinfer-rust-mode-autoloads eglot-autoloads
track-changes-autoloads jsonrpc-autoloads flymake-autoloads
project-autoloads xref-autoloads external-completion-autoloads
vterm-autoloads nerd-icons-dired-autoloads nerd-icons-autoloads
diff-hl-autoloads magit-autoloads magit-section-autoloads
git-commit-autoloads with-editor-autoloads dash-autoloads
rainbow-mode-autoloads apheleia-autoloads casual-ibuffer-autoloads
casual-avy-autoloads use-package-ensure casual-dired-autoloads
casual-lib-autoloads transient-autoloads envrc-autoloads
inheritenv-autoloads editorconfig-autoloads rainbow-delimiters-autoloads
ws-butler-autoloads treesit-auto treesit treesit-auto-autoloads
cape-autoloads corfu-doc-terminal-autoloads corfu-doc-autoloads
corfu-terminal-autoloads popon-autoloads orderless-autoloads
corfu-popupinfo byte-opt corfu corfu-autoloads consult-autoloads
marginalia marginalia-autoloads vertico compat vertico-autoloads
compat-autoloads info seq-autoloads undo-fu-autoloads
ace-window-autoloads avy-autoloads which-key which-key-autoloads
diminish diminish-autoloads doom-themes-ext-org doom-nord-theme pcase
doom-themes doom-themes-base doom-themes-autoloads finder-inf rx
ligature ligature-autoloads eldoc-autoloads use-package-diminish
autorevert filenotify display-line-numbers desktop frameset recentf
tree-widget wid-edit saveplace edmacro kmacro straight-autoloads
straight subr-x cl-extra help-mode cl-macs gv use-package-bind-key
bind-key easy-mmode cl-seq use-package-core cl-loaddefs cl-lib bytecomp
byte-compile early-init 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 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 399747 508253)
 (symbols 48 22267 36)
 (strings 32 77737 66785)
 (string-bytes 1 3078055)
 (vectors 16 46549)
 (vector-slots 8 1193570 637516)
 (floats 8 514 1662)
 (intervals 56 6087 28924)
 (buffers 984 21))





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#73443: 29.4; ERC 5.6.1-git: erc-track mode line face color broken with left timestamps
  2024-09-23 20:04 bug#73443: 29.4; ERC 5.6.1-git: erc-track mode line face color broken with left timestamps tmarjeski
@ 2024-09-24  1:22 ` J.P.
       [not found] ` <87tte5zvzl.fsf@neverwas.me>
  1 sibling, 0 replies; 7+ messages in thread
From: J.P. @ 2024-09-24  1:22 UTC (permalink / raw)
  To: tmarjeski; +Cc: emacs-erc, 73443

Hi,

tmarjeski@gmail.com writes:

> When setting erc-insert-timestamp-function to 'erc-insert-timestamp-left
> the erc-track channel names in the mode line do not respect the nick
> face color of whoever sent the message. The result is that the face
> color is white or the color of the timestamp face, whereas with
> 'erc-insert-timestamp-right the color is of the nick that sent a
> message.
>
> Reproduction steps:
> 1. emacs -Q
> 2. (setq erc-insert-timestamp-function 'erc-insert-timestamp-left
>          erc-timestamp-format "[%H:%M") ;; possibly unnecessary
>    (erc-track-mode) ;; enable track mode in mode line
> 3. Connect to ERC
> 4. Join a few channels so the names are legible
> 5. Go to scratch or irc server buffer, wait for a message on a channel
> 6. Notice that the channel name is not the color of the nick who sent
> the message

Unfortunately, I've not (yet) been able to reproduce this.

> In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43,
> cairo version 1.18.0)

Complicating things slightly is this bit from the subject line:

  "29.4; ERC 5.6.1-git"

Those two don't normally jive. Typically, when you install the devel
version from GNU ELPA, ERC reports its version as something like

  "5.6.1snapshot0.20240813.11230"

If straight.el is using its own non-tarball snapshots [1], it'd be nice
to get the actual version string (you mentioned something like this in
the Libera channel). If you're feeling lucky, please try

  (and-let*
      ((straight--default-directory (straight--repos-dir "erc"))
       (ref (straight-vc 'get-commit 'git "erc"))
       (output (straight--process-output "git" "show" "--stat" ref))
       (pat (rx bol (* ?\s) "Sourced from erc version "
                (group (+ (in "0-9.a-z-"))) " on GNU ELPA Devel"))
       ((string-match pat output))
       ((match-string 1 output))))

and share the result (if it doesn't bork your Emacs first).

[1] https://github.com/emacs-straight/erc.git

Also, in your description above, "the color of the nick that sent a
message" appears to suggest you want the `nicks' module loaded (it's not
by default and isn't part of the ERC that ships with Emacs 29.4).
Anyway, perhaps the recipe should contain something like

  (setopt erc-modules (add-to-list 'erc-modules 'nicks))

or similar.

> Major mode: ERC
>
> Minor modes in effect:
>   erc-ring-mode: t
>   erc-nicks-mode: t
    ^~~~~~~~~~~~~~~~~

I realize this list of modes is merely gleaned from the Emacs process
that generated the bug report and not necessarily the one exhibiting the
bug. Nevertheless, I'm compelled to wonder if your straight.el
configuration isn't somehow inadvertently "contaminating" the session
launched from your emacs -Q recipe behind the scenes?

>   erc-scrolltobottom-mode: t
>   erc-spelling-mode: t
>   flyspell-mode: t
>   erc-track-mode: (t erc-nicks--setup-track-integration)
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BTW, this strange value is definitely a bug (that I believe I can fix).
But it's likely unrelated to your issue, sadly.

> Load-path shadows:
[...]
> /home/trev/.emacs.d/straight/build/erc/erc-fill hides
>   /usr/share/emacs/29.4/lisp/erc/erc-fill
> /home/trev/.emacs.d/straight/build/erc/erc-loaddefs hides
>   /usr/share/emacs/29.4/lisp/erc/erc-loaddefs

If these load paths or ones like it are in fact generated from the
suspected straight.el snapshots mentioned above _and_ are meant to be
present in your -Q recipe's session, please specify something like

  emacs -Q
  -L /home/trev/.emacs.d/straight/build/erc
  -l /home/trev/.emacs.d/straight/build/erc/erc-autoloads.el

if possible. Better still would be a full recipe for a clean install
from scratch. For example:

1. $ mkdir -p /tmp/bug73443/.emacs.d/
2. Put this in /tmp/bug73443/.emacs.d/init.el:

  ;; -*- lexical-binding: t; -*-

  ;; straight.el boilerplate
  (defvar bootstrap-version)
  (let ((bootstrap-file
         (expand-file-name
          "straight/repos/straight.el/bootstrap.el"
          (or (bound-and-true-p straight-base-dir)
              user-emacs-directory)))
        (bootstrap-version 7))
    (unless (file-exists-p bootstrap-file)
      (with-current-buffer
          (url-retrieve-synchronously
           "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
           'silent 'inhibit-cookies)
        (goto-char (point-max))
        (eval-print-last-sexp)))
    (load bootstrap-file nil 'nomessage))

  (straight-use-package 'use-package)
  (setq straight-use-package-by-default t)

  ;; Config for ERC recipe
  (use-package erc
    :defer t
    :config
    (setopt erc-modules
            (seq-union '(nicks scrolltobottom spelling) erc-modules))
    :custom
    (erc-insert-timestamp-function #'erc-insert-timestamp-left))

3. $ HOME=/tmp/bug73443 emacs
4. M-x restart-emacs RET
5. M-x erc-tls RET ... RET

FWIW, using the above setup, I don't notice the behavior described nor
any difference in the mode line with `erc-insert-timestamp-function' set
to 'erc-insert-timestamp-right' or its default. If you're able to
confirm this, then perhaps we can assume there's indeed been some kind
of "contamination," at which point it may be worth adding `use-package'
declarations for some of the other built-in modes and packages present
when the bug occurred. If you're able to narrow it down to an
unfavorable combination, perhaps we can teach ERC to integrate better
with those culprits.

Cheers.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#73443: Fwd: bug#73443: 29.4; ERC 5.6.1-git: erc-track mode line face color broken with left timestamps
       [not found]   ` <87r0998tqe.fsf@trevarch.mail-host-address-is-not-set>
@ 2024-09-24  6:53     ` Trevor Arjeski
       [not found]     ` <CACPvkDxUsaMRtL18NxbYd=w2dObuc++bvBQQe2Nms1D6_4zWNg@mail.gmail.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Trevor Arjeski @ 2024-09-24  6:53 UTC (permalink / raw)
  To: J.P.; +Cc: emacs-erc, 73443

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

"J.P." <jp@neverwas.me> writes:

> Complicating things slightly is this bit from the subject line:
>
>   "29.4; ERC 5.6.1-git"
>

Agreed. I don't even really want to begin debugging this. Perhaps we
should consider the issue moot unless verifiable on Emacs 30+ or master.

> FWIW, using the above setup, I don't notice the behavior described nor
> any difference in the mode line with `erc-insert-timestamp-function' set
> to 'erc-insert-timestamp-right' or its default.

I was not able to reproduce the issue either with your provided config
using 'erc-insert-timestamp-left (also needed to turn on erc-track-mode).

Thanks for looking into this.

[-- Attachment #2: Type: text/html, Size: 965 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#73443: Fwd: bug#73443: 29.4; ERC 5.6.1-git: erc-track mode line face color broken with left timestamps
       [not found]     ` <CACPvkDxUsaMRtL18NxbYd=w2dObuc++bvBQQe2Nms1D6_4zWNg@mail.gmail.com>
@ 2024-09-24  7:03       ` J.P.
       [not found]       ` <871q19y1lz.fsf@neverwas.me>
  1 sibling, 0 replies; 7+ messages in thread
From: J.P. @ 2024-09-24  7:03 UTC (permalink / raw)
  To: Trevor Arjeski; +Cc: emacs-erc, 73443

Trevor Arjeski <tmarjeski@gmail.com> writes:

> "J.P." <jp@neverwas.me> writes:
>
>> Complicating things slightly is this bit from the subject line:
>>
>>   "29.4; ERC 5.6.1-git"
>>
> The version output with your snippet: 5.6.1snapshot0.20240813.11230

OK, that's what I get when I install straight.el from scratch. So at
least we're synced.

>
> Agreed. I don't even really want to begin debugging this. Perhaps we
> should consider the issue moot unless verifiable on Emacs 30+ or master.

You could start by "bisecting" the non-ERC parts of your config or the
non-ERC modes listed in the gathered facts from your initial report
(default stuff commented out):

  // erc-ring-mode: t
  // erc-nicks-mode: t                // config
  // erc-netsplit-mode: t
  // erc-menu-mode: t
  // erc-list-mode: t
  // erc-imenu-mode: t
  // erc-pcomplete-mode: t
  // erc-button--phantom-users-mode: t
  // erc-button-mode: t
  // erc-fill-mode: t
  // erc-stamp-mode: t
  // erc-autojoin-mode: t
  // erc-irccontrols-mode: t
  // erc-move-to-prompt-mode: t
  // erc-readonly-mode: t
  // erc-scrolltobottom-mode: t         // config
  // erc-spelling-mode: t               // config
  // flyspell-mode: t                   // config (spell module)
  // erc-track-mode: t
  // erc-track-minor-mode: t
  // erc-match-mode: t
  // erc-networks-mode: t
  diff-hl-flydiff-mode: t
  global-diff-hl-mode: t
  electric-pair-mode: t
  apheleia-global-mode: t
  global-treesit-auto-mode: t
  corfu-popupinfo-mode: t
  global-corfu-mode: t
  corfu-mode: t
  marginalia-mode: t
  vertico-mode: t
  which-key-mode: t
  global-ligature-mode: t
  ligature-mode: t
  global-auto-revert-mode: t
  global-display-line-numbers-mode: t
  desktop-save-mode: t
  recentf-mode: t
  save-place-mode: t
  // straight-use-package-mode: t       // config
  // straight-package-neutering-mode: t // config
  override-global-mode: t
  // global-eldoc-mode: t
  // show-paren-mode: t
  // electric-indent-mode: t
  // mouse-wheel-mode: t
  // file-name-shadow-mode: t
  // global-font-lock-mode: t
  // font-lock-mode: t
  // blink-cursor-mode: t
  column-number-mode: t
  // line-number-mode: t
  // transient-mark-mode: t
  // auto-composition-mode: t
  // auto-encryption-mode: t
  // auto-compression-mode: t

So, essentially, you'd just be adding like half of these to the base
config from my previous reply, e.g.,

  (use-package diff-hl ...) ; where "..." means "your config details"
  (use-package elec-pair :straight nil :init (electric-pair-mode +1))
  (use-package apheleia ...)
  ;; [...]
  (use-package vertico ...)

And if the bug is still present, remove half of those, and so on. But if
it's absent, switch to the other half and test again. Let me know if
that doesn't make sense. (And apologies if you're already familiar with
this method.)

>  
>> FWIW, using the above setup, I don't notice the behavior described nor
>> any difference in the mode line with `erc-insert-timestamp-function' set
>> to 'erc-insert-timestamp-right' or its default.
>
> I was not able to reproduce the issue either with your provided config
> using 'erc-insert-timestamp-left (also needed to turn on erc-track-mode).

FYI, you actually don't _need_ to explicitly activate any minor modes
for modules that appear in `erc-modules', which `track' (i.e.,
`erc-track-mode') does by default. I know the ";;; Commentary" front
matter atop ERC's libraries makes it seem otherwise, but that's because
they're ancient and were never updated. Sorry about that (good first
issue, though). So, yeah, rule of thumb: if `erc-modules' contains some
module `foo', you almost never need

  (erc-foo-mode +1)

in your config, at least not for built-in modules. That said, doing so
is superfluous and basically benign.

>
> Thanks for looking into this.

No problem!





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#73443: Fwd: bug#73443: 29.4; ERC 5.6.1-git: erc-track mode line face color broken with left timestamps
       [not found]       ` <871q19y1lz.fsf@neverwas.me>
@ 2024-09-24  8:08         ` Trevor Arjeski
       [not found]         ` <87ed59o4nq.fsf@gmail.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Trevor Arjeski @ 2024-09-24  8:08 UTC (permalink / raw)
  To: J.P.; +Cc: emacs-erc, 73443

"J.P." <jp@neverwas.me> writes:

> You could start by "bisecting" the non-ERC parts of your config or the
> non-ERC modes listed in the gathered facts from your initial report
> (default stuff commented out):

After a bisect, I was able to find the culprit:

      (erc-fill-function 'erc-fill-static)

Toggling this to and from the default - 'erc-fill-variable - allows me
to reproduce the issue consistently.

My guess is that the track parser does not like the extra padding
between the timestamp and nick, but I haven't yet looked into the code.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#73443: Fwd: bug#73443: 29.4; ERC 5.6.1-git: erc-track mode line face color broken with left timestamps
       [not found]         ` <87ed59o4nq.fsf@gmail.com>
@ 2024-09-25  0:36           ` J.P.
       [not found]           ` <87v7ykvabp.fsf@neverwas.me>
  1 sibling, 0 replies; 7+ messages in thread
From: J.P. @ 2024-09-25  0:36 UTC (permalink / raw)
  To: Trevor Arjeski; +Cc: emacs-erc, 73443

[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]

Trevor Arjeski <tmarjeski@gmail.com> writes:

> "J.P." <jp@neverwas.me> writes:
>
>> You could start by "bisecting" the non-ERC parts of your config or the
>> non-ERC modes listed in the gathered facts from your initial report
>> (default stuff commented out):
>
> After a bisect, I was able to find the culprit:
>
>       (erc-fill-function 'erc-fill-static)
>
> Toggling this to and from the default - 'erc-fill-variable - allows me
> to reproduce the issue consistently.

Thanks for getting to the bottom of this. I was indeed able to reproduce
it with user options alone.

>
> My guess is that the track parser does not like the extra padding
> between the timestamp and nick, but I haven't yet looked into the code.

Yes, that's essentially what's happening. The new internal function that
extracts all faces in a message acted too aggressively in abandoning its
search after encountering a region without any face properties. So while
this issue is most visible when using `nicks' highlighting, it's
actually always present and therefore somewhat pernicious. The attached
patch should fix the problem.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-5.6.1-Skip-indentation-when-gathering-faces-in-erc-t.patch --]
[-- Type: text/x-patch, Size: 10714 bytes --]

From c9c74f6f3691ffe9a35558bcbd764381d127f36d Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@neverwas.me>
Date: Mon, 23 Sep 2024 13:48:19 -0700
Subject: [PATCH] [5.6.1] Skip indentation when gathering faces in erc-track

* lisp/erc/erc-nicks.el (erc-nicks-mode, erc-nicks-enable)
(erc-nicks-disable): Use correct name for `track' module hook.
* lisp/erc/erc-track.el (erc-make-mode-line-buffer-name): Don't error
when optional COUNT is nil.
(erc-track-modified-channels): Use new name for face-finding function.
(erc-track--get-faces-in-current-message, erc-track--collect-faces-in):
Rename former to latter to better reflect expanded utility, which can
span gaps, including newlines and indentation that don't have
face-related properties.
* test/lisp/erc/erc-track-tests.el (erc-track--collect-faces-in): New
test.  (Bug#73443)
---
 lisp/erc/erc-nicks.el            |   3 +-
 lisp/erc/erc-track.el            |  42 +++++------
 test/lisp/erc/erc-track-tests.el | 126 ++++++++++++++++++++++++++++++-
 3 files changed, 148 insertions(+), 23 deletions(-)

diff --git a/lisp/erc/erc-nicks.el b/lisp/erc/erc-nicks.el
index ccf65f15abd..65a12c927bd 100644
--- a/lisp/erc/erc-nicks.el
+++ b/lisp/erc/erc-nicks.el
@@ -580,7 +580,7 @@ nicks
    (setf (alist-get "Edit face" erc-button--nick-popup-alist nil nil #'equal)
          #'erc-nicks-customize-face)
    (erc-nicks--setup-track-integration)
-   (add-hook 'erc-track-mode #'erc-nicks--setup-track-integration 50 t)
+   (add-hook 'erc-track-mode-hook #'erc-nicks--setup-track-integration 50 t)
    (advice-add 'widget-create-child-and-convert :filter-args
                #'erc-nicks--redirect-face-widget-link))
   ((kill-local-variable 'erc-nicks--face-table)
@@ -598,6 +598,7 @@ nicks
                     #'erc-nicks--highlight-button)
    (remove-function (local 'erc-track--alt-normals-function)
                     #'erc-nicks--check-normals)
+   (remove-hook 'erc-track-mode-hook #'erc-nicks--setup-track-integration t)
    (setf (alist-get "Edit face"
                     erc-button--nick-popup-alist nil 'remove #'equal)
          nil)
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index 39a4775ddca..f40960e4a22 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -768,7 +768,7 @@ erc-make-mode-line-buffer-name
   ;; (really?), 3. the defun needs to switch to BUFFER, so we would
   ;; need to save that value somewhere.
   (let ((map (make-sparse-keymap))
-	(name (if erc-track-showcount
+        (name (if (and count erc-track-showcount)
 		  (concat string
 			  erc-track-showcount-string
 			  (int-to-string count))
@@ -992,7 +992,7 @@ erc-track-modified-channels
         (when-let
             ((faces (if erc-track-ignore-normal-contenders-p
                         (erc-faces-in (buffer-string))
-                      (erc-track--get-faces-in-current-message)))
+                      (erc-track--collect-faces-in)))
              (normals erc-track--normal-faces)
              (erc-track-faces-priority-list
               `(,@erc-track--attn-faces ,@erc-track-faces-priority-list))
@@ -1057,25 +1057,25 @@ erc-faces-in
 (defvar erc-track--face-reject-function nil
   "Function called with face in current buffer to massage or reject.")
 
-(defun erc-track--get-faces-in-current-message ()
-  "Collect all faces in the narrowed buffer.
-Return a cons of a hash table and a list ordered from most
-recently seen to earliest seen."
-  (let ((i (text-property-not-all (point-min) (point-max) 'font-lock-face nil))
-        (seen (make-hash-table :test #'equal))
-        ;;
-        (rfaces ())
-        (faces (make-hash-table :test #'equal)))
-    (while-let ((i)
-                (cur (get-text-property i 'face)))
-      (unless (gethash cur seen)
-        (puthash cur t seen)
-        (when erc-track--face-reject-function
-          (setq cur (funcall erc-track--face-reject-function cur)))
-        (when cur
-          (push cur rfaces)
-          (puthash cur t faces)))
-      (setq i (next-single-property-change i 'font-lock-face)))
+(defun erc-track--collect-faces-in ()
+  "Collect all faces in the (presumably narrowed) current buffer.
+Return a cons cell of a hash table and a list ordered from most recently
+seen to least."
+  (let* ((prop (if noninteractive 'font-lock-face 'face))
+         (p (text-property-not-all (point-min) (point-max) prop nil))
+         (seen (and p (make-hash-table :test #'equal)))
+         (faces (make-hash-table :test #'equal))
+         (rfaces ()))
+    (while p
+      (when-let ((cur (get-text-property p prop)))
+        (unless (gethash cur seen)
+          (puthash cur t seen)
+          (when erc-track--face-reject-function
+            (setq cur (funcall erc-track--face-reject-function cur)))
+          (when cur
+            (push cur rfaces)
+            (puthash cur t faces))))
+      (setq p (next-single-property-change p prop)))
     (cons faces rfaces)))
 
 ;;; Buffer switching
diff --git a/test/lisp/erc/erc-track-tests.el b/test/lisp/erc/erc-track-tests.el
index 3288c42a42e..8149138a971 100644
--- a/test/lisp/erc/erc-track-tests.el
+++ b/test/lisp/erc/erc-track-tests.el
@@ -22,8 +22,12 @@
 
 ;;; Code:
 
-(require 'ert)
 (require 'erc-track)
+(require 'ert-x)
+(eval-and-compile
+  (let ((load-path (cons (ert-resource-directory) load-path)))
+    (require 'erc-tests-common)))
+
 
 (ert-deftest erc-track--shorten-aggressive-nil ()
   "Test non-aggressive erc track buffer name shortening."
@@ -286,4 +290,124 @@ erc-track--select-mode-line-face
      (a b (b a))
      (a b (a b)))))
 
+(ert-deftest erc-track--collect-faces-in ()
+  (with-current-buffer (get-buffer-create "*erc-track--get-faces-in*")
+    (erc-tests-common-prep-for-insertion)
+    (goto-char (point-min))
+    (skip-chars-forward "\n")
+
+    (let ((ts #("[04:37]"
+                0 1 ( erc--msg 0 field erc-timestamp
+                      font-lock-face erc-timestamp-face)
+                1 7 ( field erc-timestamp
+                      font-lock-face erc-timestamp-face)))
+          bounds)
+
+      (with-silent-modifications
+
+        (push (list (point)) bounds)
+        (insert ; JOIN
+         ts "      " ; iniital `fill' indentation lacks properties
+         #("*** You have joined channel #chan" 0 33
+           (font-lock-face erc-notice-face))
+         "\n")
+        (setcdr (car bounds) (point))
+
+        (push (list (point)) bounds)
+        (insert ; 353
+         ts "      "
+         #("*** Users on #chan: bob alice dummy tester"
+           0 30 (font-lock-face erc-notice-face)
+           30 35 (font-lock-face erc-current-nick-face)
+           35 42 (font-lock-face erc-notice-face))
+         "\n" #("                 @fsbot" ; but intervening HAS properties
+                0 23 (font-lock-face erc-notice-face)))
+        (setcdr (car bounds) (point))
+
+        (push (list (point)) bounds)
+        (insert ; PRIVMSG
+         "\n" ts "  "
+         #("<alice> bob: Thou canst not come to me: I come to"
+           0 1 (font-lock-face erc-default-face)
+           ;; erc-dangerous-host-face -> erc-nicks-alice-face (undefined)
+           1 6 (font-lock-face (erc-dangerous-host-face erc-nick-default-face))
+           6 8 (font-lock-face erc-default-face)
+           ;; erc-pal-face -> erc-nicks-bob-face (undefined)
+           8 11 (font-lock-face (erc-pal-face erc-default-face))
+           11 49 (font-lock-face erc-default-face))
+         "\n" #("                 thee."
+                0 22 (font-lock-face erc-default-face))
+         "\n")
+        (setcdr (car bounds) (point)))
+
+      (goto-char (point-max))
+      (should (equal (setq bounds (nreverse bounds))
+                     '((3 . 50) (50 . 129) (129 . 212))))
+
+      ;; For these result assertions, the insertion order of the table
+      ;; elements should mirror that of the consed lists.
+
+      ;; Baseline
+      (narrow-to-region 1 3)
+      (let ((result (erc-track--collect-faces-in)))
+        (should-not (map-pairs (car result)))
+        (should-not (cdr result)))
+
+      ;; JOIN
+      (narrow-to-region (car (nth 0 bounds)) (cdr (nth 0 bounds)))
+      (let ((result (erc-track--collect-faces-in)))
+        (should (seq-set-equal-p
+                 (map-pairs (car result)) '((erc-timestamp-face . t)
+                                            (erc-notice-face . t))))
+        (should (equal (cdr result) '(erc-notice-face erc-timestamp-face))))
+
+      ;; 353
+      (narrow-to-region (car (nth 1 bounds)) (cdr (nth 1 bounds)))
+      (let ((result (erc-track--collect-faces-in)))
+        (should (seq-set-equal-p (map-pairs (car result))
+                                 '((erc-timestamp-face . t)
+                                   (erc-notice-face . t)
+                                   (erc-current-nick-face . t))))
+        (should (equal (cdr result) '(erc-current-nick-face
+                                      erc-notice-face
+                                      erc-timestamp-face))))
+
+      ;; PRIVMSG
+      (narrow-to-region (car (nth 2 bounds)) (cdr (nth 2 bounds)))
+      (let ((result (erc-track--collect-faces-in)))
+        (should (seq-set-equal-p
+                 (map-pairs (car result))
+                 '((erc-timestamp-face . t)
+                   (erc-default-face . t)
+                   ((erc-dangerous-host-face erc-nick-default-face) . t)
+                   ((erc-pal-face erc-default-face) . t))))
+        (should (equal (cdr result)
+                       '((erc-pal-face erc-default-face)
+                         (erc-dangerous-host-face erc-nick-default-face)
+                         erc-default-face
+                         erc-timestamp-face))))
+
+      ;; Entire buffer.
+      (narrow-to-region (car (nth 0 bounds)) erc-insert-marker)
+      (let ((result (erc-track--collect-faces-in)))
+        (should (seq-set-equal-p
+                 (map-pairs (car result))
+                 '((erc-timestamp-face . t)
+                   (erc-notice-face . t)
+                   (erc-current-nick-face . t)
+                   (erc-default-face . t)
+                   ((erc-dangerous-host-face erc-nick-default-face) . t)
+                   ((erc-pal-face erc-default-face) . t))))
+        (should (equal (cdr result)
+                       '((erc-pal-face erc-default-face)
+                         (erc-dangerous-host-face erc-nick-default-face)
+                         erc-default-face
+                         erc-current-nick-face
+                         erc-notice-face
+                         erc-timestamp-face)))))
+
+    (widen)
+    (when noninteractive
+      (kill-buffer))))
+
 ;;; erc-track-tests.el ends here
-- 
2.46.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#73443: Fwd: bug#73443: 29.4; ERC 5.6.1-git: erc-track mode line face color broken with left timestamps
       [not found]           ` <87v7ykvabp.fsf@neverwas.me>
@ 2024-09-25  4:54             ` Trevor Arjeski
  0 siblings, 0 replies; 7+ messages in thread
From: Trevor Arjeski @ 2024-09-25  4:54 UTC (permalink / raw)
  To: J.P.; +Cc: emacs-erc, 73443


I applied the patch and it's working on my end! Thanks J.P!







^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-09-25  4:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 20:04 bug#73443: 29.4; ERC 5.6.1-git: erc-track mode line face color broken with left timestamps tmarjeski
2024-09-24  1:22 ` J.P.
     [not found] ` <87tte5zvzl.fsf@neverwas.me>
     [not found]   ` <87r0998tqe.fsf@trevarch.mail-host-address-is-not-set>
2024-09-24  6:53     ` bug#73443: Fwd: " Trevor Arjeski
     [not found]     ` <CACPvkDxUsaMRtL18NxbYd=w2dObuc++bvBQQe2Nms1D6_4zWNg@mail.gmail.com>
2024-09-24  7:03       ` J.P.
     [not found]       ` <871q19y1lz.fsf@neverwas.me>
2024-09-24  8:08         ` Trevor Arjeski
     [not found]         ` <87ed59o4nq.fsf@gmail.com>
2024-09-25  0:36           ` J.P.
     [not found]           ` <87v7ykvabp.fsf@neverwas.me>
2024-09-25  4:54             ` Trevor Arjeski

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).