1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-12 09:28:24 +00:00

Add 'erc-version' and use it to display ERC version consistently

* lisp/erc/erc.el (erc-version): New constant holding the current ERC
version, now used in the function with the same name to produce a
version string for use across ERC for consistency.  Also, add another
optional argument, 'bold-erc', which when non-nil, marks the "ERC"
portion of the string with the control character for bold display.
(erc-quit/part-reason-default): Use the 'erc-version' function for a
consistent version string.
(erc-cmd-SV): Mention the ERC version number from the 'erc-version'
constant.
(erc-ctcp-query-VERSION): Use the 'erc-version' function for a
consistent version string.
This commit is contained in:
Amin Bandali 2021-10-06 21:50:56 -04:00
parent bc941846d9
commit 5afa07919e
No known key found for this signature in database
GPG Key ID: 8B44A0CDC7B956F2

View File

@ -69,6 +69,9 @@
(require 'iso8601)
(eval-when-compile (require 'subr-x))
(defconst erc-version "5.3"
"This version of ERC.")
(defvar erc-official-location
"https://www.gnu.org/software/emacs/erc.html (mailing list: emacs-erc@gnu.org)"
"Location of the ERC client on the Internet.")
@ -3613,7 +3616,7 @@ If USER is omitted, close the current query buffer if one exists
(defun erc-quit/part-reason-default ()
"Default quit/part message."
(format "\C-bERC\C-b (IRC client for Emacs %s)" emacs-version))
(erc-version nil 'bold-erc))
(defun erc-quit-reason-normal (&optional s)
@ -3766,7 +3769,8 @@ the message given by REASON."
(defun erc-cmd-SV ()
"Say the current ERC and Emacs version into channel."
(erc-send-message (format "I'm using ERC with GNU Emacs %s (%s%s)%s."
(erc-send-message (format "I'm using ERC %s with GNU Emacs %s (%s%s)%s."
erc-version
emacs-version
system-configuration
(concat
@ -4845,8 +4849,8 @@ See also `erc-display-message'."
(unless erc-disable-ctcp-replies
(erc-send-ctcp-notice
nick (format
"VERSION \C-bERC\C-b - an IRC client for Emacs %s (\C-b%s\C-b)"
emacs-version
"VERSION %s (\C-b%s\C-b)"
(erc-version nil 'bold-erc)
erc-official-location)))
nil)
@ -6632,12 +6636,18 @@ P may be an integer or a service name."
s
n))))
(defun erc-version (&optional here)
(defun erc-version (&optional here bold-erc)
"Show the version number of ERC in the minibuffer.
If optional argument HERE is non-nil, insert version number at point."
If optional argument HERE is non-nil, insert version number at point.
If optional argument BOLD-ERC is non-nil, display \"ERC\" as bold."
(interactive "P")
(let ((version-string
(format "ERC (IRC client for Emacs %s)" emacs-version)))
(format "%s %s (IRC client for GNU Emacs %s)"
(if bold-erc
"\C-bERC\C-b"
"ERC")
erc-version
emacs-version)))
(if here
(insert version-string)
(if (called-interactively-p 'interactive)