Subject: Re: bug#56514: 29.0.50; Improve ERC's URI scheme integration for irc:// links

From: "J.P." <[email-masked]>
Date: Wed, 16 Nov 2022 06:22:59 -0800

Quick note:

> diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el
> index 03bd8f1352..340d90ba96 100644
> --- a/lisp/erc/erc-compat.el
> +++ b/lisp/erc/erc-compat.el
> @@ -32,6 +32,7 @@
>  ;;; Code:
> [...] 
> +
> +(when (< emacs-major-version 29)
> +  (unless (assoc "\\`irc6?s?://" browse-url-default-handlers)
> +    (push '("\\`irc6?s?://" . erc-compat--29-browse-url-irc)
> +          browse-url-default-handlers)))

This won't work on 27, so we'll probably have to do something like

  (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))
        ((boundp 'browse-url-browser-function) ; 27
         (require 'browse-url)
         (let ((existing browse-url-browser-function))
           (setq browse-url-browser-function
                 (if (functionp existing)
                     (lambda (u &rest r)
                       (apply (if (string-match-p "\\`irc6?s?://" u)
                                  #'erc-compat--29-browse-url-irc
                                existing)
                              u r))
                   (cons '("\\`irc6?s?://" . erc-compat--29-browse-url-irc)
                         existing))))))

> +
>  (provide 'erc-compat)