From bb3c10396885cb1334fb56eaf4c7a0fdada65e73 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Fri, 16 Jan 2026 16:43:15 -0800 Subject: [PATCH] Avoid nested erc-display-message in alert utility * lisp/erc/erc.el (erc--warn-once-before-connect): Don't call `erc-display-message' from insertion hooks because doing so places an unnecessary burden on the caller to preserve the insertion marker and "msg prop" environment. --- lisp/erc/erc.el | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 572b73188e3..6facb7966b0 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1693,11 +1693,18 @@ time `erc-mode-hook' runs for any connection." (declare (indent 1)) (cl-assert (stringp (car args))) (if (derived-mode-p 'erc-mode) - (unless (or (erc-with-server-buffer ; needs `erc-server-process' - (apply #'erc-button--display-error-notice-with-keys - (current-buffer) args) - t) - erc--target) ; unlikely + (unless + (or (erc-with-server-buffer ; needs `erc-server-process' + (let ((fn + (lambda (buffer) + (erc-with-buffer (buffer) + (apply #'erc-button--display-error-notice-with-keys + buffer args))))) + (if erc--msg-props + (run-at-time nil nil fn (current-buffer)) + (funcall fn (current-buffer)))) + t) + erc--target) ; unlikely (let (hook) (setq hook (lambda (_)