GNU bug report logs - #79665
31.0.50; ERC 5.7: Only perform erc-log-insert-log-on-open setup once

Previous Next

Package: emacs;

Reported by: "J.P." <jp <at> neverwas.me>

Date: Tue, 21 Oct 2025 02:43:02 UTC

Severity: normal

Tags: patch

Found in version 31.0.50

To reply to this bug, email your comments to 79665 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to emacs-erc <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#79665; Package emacs. (Tue, 21 Oct 2025 02:43:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "J.P." <jp <at> neverwas.me>:
New bug report received and forwarded. Copy sent to emacs-erc <at> gnu.org, bug-gnu-emacs <at> gnu.org. (Tue, 21 Oct 2025 02:43:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; ERC 5.7: Only perform erc-log-insert-log-on-open setup once
Date: Mon, 20 Oct 2025 19:36:43 -0700
[Message part 1 (text/plain, inline)]
Tags: patch

This change aims to make the option `erc-log-insert-log-on-open' more
usable by expanding its type to include a predicate function and by
providing one such predicate to cover the most popular use case. As with
anything involving chat logs, it's probably best to exercise extra
caution here, so input from anyone familiar with the option or the
module is most welcome.

AFAICT, the main issue with this option is that its implementation is
hampered by the fact that the module itself tries to make its own
functionality available buffer-locally, in a bid to gain some of the
flexibility now offered by local modules. In doing so, the setup code
responsible for inserting logs on behalf of `erc-log-insert-log-on-open'
ends up potentially running multiple times per session, when it should
only be doing so once.

Users annoyed at seeing the same overlapping log contents inserted
back-to-back atop their buffers can do

  (setopt erc-log-insert-log-on-open 'erc-log-new-target-buffer-p)

which should ensure the insertion code only runs once, when a target
buffer is first created. It also suppresses insertion completely in
server buffers, which most users probably prefer, I'm guessing. The
behavior associated with the option's old "on" value of t should remain
unchanged, so anyone with a decades old log-rotation scheme designed to
counteract such redundancy shouldn't be affected.

This patch also fixes a related issue in which `erc-last-saved-position'
gets stuck after the prompt, thus preventing logs from being saved when
`erc-log-insert-log-on-open' is non-nil. Thanks to Libera user Lionyx
for reporting this, which has likely been around since at least ERC 5.4
and Emacs 28.1. Based on the nature of 5caa4dea "Don't insert erc logs
at the end", which touches adjacent code, I'm speculating that the issue
may have been introduced sometime afterwards, which would put it around
Emacs 25-ish.



In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.49, cairo version 1.18.2) of 2025-10-20 built on localhost
Repository revision: 72255c99925b7856c71f1655c53d68473d87f803
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12401008
System Description: Fedora Linux 42 (Workstation Edition)

Configured using:
 'configure --enable-check-lisp-object-type --enable-checking=yes,glyphs
 'CFLAGS=-O0 -g3'
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ 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 XINERAMA XINPUT2 XPM
XRANDR GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  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
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-nonselected-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:
None found.

Features:
(shadow sort mail-extr erc auth-source cl-seq eieio eieio-core cl-macs
icons json map format-spec erc-backend erc-networks byte-opt gv
erc-common erc-compat compat erc-loaddefs compile comint ansi-osc
ansi-color ring comp-run bytecomp byte-compile comp-common rx emacsbug
lisp-mnt 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
mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail mail-parse
rfc2231 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 gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process tty-child-frames native-compile emacs)

Memory information:
((conses 16 95908 10301) (symbols 48 10150 0) (strings 32 28134 4447)
 (string-bytes 1 836666) (vectors 16 19082)
 (vector-slots 8 194269 9450) (floats 8 30 1) (intervals 56 347 0)
 (buffers 1064 12))

[0001-5.7-Only-perform-erc-log-insert-log-on-open-setup-on.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79665; Package emacs. (Thu, 23 Oct 2025 00:14:01 GMT) Full text and rfc822 format available.

Message #8 received at 79665 <at> debbugs.gnu.org (full text, mbox):

From: Rahul Martim Juliato <rahuljuliato <at> gmail.com>
To: 79665 <at> debbugs.gnu.org
Subject: Re: bug#79665: ERC 5.7 log setup
Date: Wed, 22 Oct 2025 21:13:14 -0300
I was affected by this issue and have just tested the patch, with a few
minor adjustments in my ERC configuration. It works well here.

The adjustments on my side, as described in the patch, were:

  (setopt erc-log-insert-log-on-open 'erc-log-new-target-buffer-p)
  (add-to-list 'erc-modules 'log)

Thanks for fixing this!

-- 
Rahul Martim Juliato




This bug report was last modified 13 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.