emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-28 5afa079 3/4: Add 'erc-version' and use it to display ERC versio


From: Amin Bandali
Subject: emacs-28 5afa079 3/4: Add 'erc-version' and use it to display ERC version consistently
Date: Wed, 6 Oct 2021 23:02:58 -0400 (EDT)

branch: emacs-28
commit 5afa07919ee6b2e90ad55048835049eb53faa843
Author: Amin Bandali <bandali@gnu.org>
Commit: Amin Bandali <bandali@gnu.org>

    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.
---
 lisp/erc/erc.el | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 308812f..c87238d 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]