>From 8cd02bc9c0b54cb0812aebac137ed1828e395a31 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Thu, 19 Jan 2023 21:07:27 -0800 Subject: [PATCH 3/3] [5.6] Don't require erc-goodies in erc.el * lisp/erc/erc-common.el: (erc--features-to-modules): Add mappings from erc-goodies. * lisp/erc/erc-goodies.el: Sort `defvar' forward declarations for maintainability. (erc-irccontrols-mode, erc-enable-irccontrols, erc-disable-irccontrols): Add and remove key for `erc-toggle-interpret-controls' to `erc-mode-map'. * lisp/erc/erc.el: Add some forward declarations from `erc-goodies' and remove the `require' call for `erc-goodies' at the end of the file. (erc-mode-map): Remove C-c C-c binding for `erc-toggle-interpret-controls'. (erc-update-mode-line-buffer): Only strip control chars when `erc-irccontrols-mode' is active. This is arguably a minor breaking change perhaps deserving of a NEWS entry. --- lisp/erc/erc-common.el | 10 +++++++++- lisp/erc/erc-goodies.el | 11 +++++++---- lisp/erc/erc.el | 10 ++++++---- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lisp/erc/erc-common.el b/lisp/erc/erc-common.el index 994555acecf..e567a108191 100644 --- a/lisp/erc/erc-common.el +++ b/lisp/erc/erc-common.el @@ -96,7 +96,15 @@ erc--features-to-modules (erc-page page ctcp-page) (erc-sound sound ctcp-sound) (erc-stamp stamp timestamp) - (erc-services services nickserv)) + (erc-services services nickserv) + (erc-goodies scrolltobottom) + (erc-goodies readonly) + (erc-goodies move-to-prompt) + (erc-goodies keep-place) + (erc-goodies noncommands) + (erc-goodies irccontrols) + (erc-goodies smiley) + (erc-goodies unmorse)) "Migration alist mapping a library feature to module names. Keys need not be unique: a library may define more than one module. Sometimes a module's downcased alias will be its diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el index 05a21019042..0bf4bb9537c 100644 --- a/lisp/erc/erc-goodies.el +++ b/lisp/erc/erc-goodies.el @@ -38,9 +38,10 @@ erc-controls-highlight-regexp (defvar erc-controls-remove-regexp) (defvar erc-input-marker) (defvar erc-insert-marker) -(defvar erc-server-process) -(defvar erc-modules) (defvar erc-log-p) +(defvar erc-mode-map) +(defvar erc-modules) +(defvar erc-server-process) (declare-function erc-buffer-list "erc" (&optional predicate proc)) (declare-function erc-error "erc" (&rest args)) @@ -384,9 +385,11 @@ erc-get-fg-color-face (define-erc-module irccontrols nil "This mode enables the interpretation of IRC control chars." ((add-hook 'erc-insert-modify-hook #'erc-controls-highlight) - (add-hook 'erc-send-modify-hook #'erc-controls-highlight)) + (add-hook 'erc-send-modify-hook #'erc-controls-highlight) + (define-key erc-mode-map "\C-c\C-c" #'erc-toggle-interpret-controls)) ((remove-hook 'erc-insert-modify-hook #'erc-controls-highlight) - (remove-hook 'erc-send-modify-hook #'erc-controls-highlight))) + (remove-hook 'erc-send-modify-hook #'erc-controls-highlight) + (erc-compat-call define-key erc-mode-map "\C-c\C-c" nil t))) (defun erc-controls-interpret (str) "Return a copy of STR after dealing with IRC control characters. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index ff1820cfaf2..007f70b8671 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -134,11 +134,14 @@ erc-scripts ;; Forward declarations (defvar erc-message-parsed) +(defvar erc-irccontrols-mode) (defvar tabbar--local-hlf) (defvar motif-version-string) (defvar gtk-version-string) +(declare-function erc-controls-strip "erc-goodies" (str)) + ;; tunable connection and authentication parameters (defcustom erc-server nil @@ -1188,7 +1191,6 @@ erc-mode-map (define-key map [home] #'erc-bol) (define-key map "\C-c\C-a" #'erc-bol) (define-key map "\C-c\C-b" #'erc-switch-to-buffer) - (define-key map "\C-c\C-c" #'erc-toggle-interpret-controls) (define-key map "\C-c\C-d" #'erc-input-action) (define-key map "\C-c\C-e" #'erc-toggle-ctcp-autoresponse) (define-key map "\C-c\C-f" #'erc-toggle-flood-control) @@ -6847,7 +6849,9 @@ erc-update-mode-line-buffer (?m . ,(erc-format-channel-modes)) (?n . ,(or (erc-current-nick) "")) (?N . ,(erc-format-network)) - (?o . ,(or (erc-controls-strip erc-channel-topic) "")) + (?o . ,(or (and erc-irccontrols-mode + (erc-controls-strip erc-channel-topic)) + "")) (?p . ,(erc-port-to-string erc-session-port)) (?s . ,(erc-format-target-and/or-server)) (?S . ,(erc-format-target-and/or-network)) @@ -7385,6 +7389,4 @@ erc-handle-irc-url (provide 'erc) -;; FIXME this is a temporary stopgap for Emacs 29. -(require 'erc-goodies) ;;; erc.el ends here -- 2.38.1