From: F. Jason Park Date: Mon, 12 Dec 2022 03:16:07 +0000 (-0800) Subject: ; Be nicer when updating browse-url var in erc-compat X-Git-Tag: emacs-29.0.90~1182 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=75f26646d4a569cfb485de4baddcda66ff44b2c3;p=emacs.git ; Be nicer when updating browse-url var in erc-compat * lisp/erc/erc-compat.el: Be more cautious about modifying `browse-url-default-handlers' when loading erc-compat on Emacs 28. A user may have already added an entry for irc:// URLs before loading `erc-compat'. --- diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el index bd932547586..77625398abd 100644 --- a/lisp/erc/erc-compat.el +++ b/lisp/erc/erc-compat.el @@ -391,8 +391,11 @@ If START or END is negative, it counts from the end." (cond ((fboundp 'browse-url-irc)) ; 29 ((boundp 'browse-url-default-handlers) ; 28 - (cl-pushnew '("\\`irc6?s?://" . erc-compat--29-browse-url-irc) - browse-url-default-handlers)) + (setf (alist-get "\\`irc6?s?://" browse-url-default-handlers + nil nil (lambda (a _) + (and (stringp a) + (string-match-p a "irc://localhost")))) + #'erc-compat--29-browse-url-irc)) ((boundp 'browse-url-browser-function) ; 27 (require 'browse-url) (let ((existing browse-url-browser-function))