[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 5011554529b 12/37: Don't require erc-goodies in erc.el
From: |
F. Jason Park |
Subject: |
master 5011554529b 12/37: Don't require erc-goodies in erc.el |
Date: |
Sat, 8 Apr 2023 17:31:28 -0400 (EDT) |
branch: master
commit 5011554529bb874390edfc3060aee960b38e5aff
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>
Don't require erc-goodies in erc.el
* lisp/erc/erc-goodies.el: Obviate the need for forward declarations
by requiring `erc'. Add minor-mode autoloads for `scrolltobottom',
`readonly', `move-to-prompt', `keep-place', `noncommands',
`irccontrols', `smiley', and `unmorse'. Add Local variables footer
with `generated-autoload-file'.
(erc-controls-strip): Autoload this function.
* lisp/erc/erc-ibuffer.el: Require `erc-goodies' for
`erc-control-interpret'. The justification for the blanket `require'
is this module isn't a member of `erc-modules' by default.
* lisp/erc/erc-page.el: (erc-ctcp-query-PAGE): Require `erc-goodies'
and put forward declaration for `erc-control-interpret' atop file.
* lisp/erc/erc-speedbar.el: Require `erc-goodies' for the same reason
as erc-ibuffer.el.
* lisp/erc/erc.el: Remove `require' for `erc-goodies' at end of file
and `pp' at top of file because `pp-to-string' is autoloaded on Emacs
27. Also remove `require's for `thingatpt', `time-date', and
`iso8601'. They're all used sparingly and the latter two have only
been around for one major release, so their removal likely won't cause
much churn. And `thingatpt' already has a call-site `require', so the
top-level one is redundant, but autoload `word-at-point' anyway for
the benefit of third-party libraries like `hl-nicks'. Also wrap local
loaddefs `require' call in `eval-and-compile'.
(erc--read-time-period): Require dependencies. (Bug#60954.)
---
lisp/erc/erc-goodies.el | 28 ++++++++++++++--------------
lisp/erc/erc-ibuffer.el | 1 +
lisp/erc/erc-page.el | 3 +++
lisp/erc/erc-speedbar.el | 1 +
lisp/erc/erc.el | 17 ++++++++---------
5 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index 05a21019042..7ca155ef9d0 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -29,23 +29,10 @@
;;; Code:
-;;; Imenu support
-
(eval-when-compile (require 'cl-lib))
-(require 'erc-common)
-
(defvar 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)
-
-(declare-function erc-buffer-list "erc" (&optional predicate proc))
-(declare-function erc-error "erc" (&rest args))
-(declare-function erc-extract-command-from-line "erc" (line))
-(declare-function erc-beg-of-input-line "erc" nil)
+(require 'erc)
(defun erc-imenu-setup ()
"Setup Imenu support in an ERC buffer."
@@ -65,6 +52,7 @@ argument to `recenter'."
:group 'erc-display
:type '(choice integer (const nil)))
+;;;###autoload(autoload 'erc-scrolltobottom-mode "erc-goodies" nil t)
(define-erc-module scrolltobottom nil
"This mode causes the prompt to stay at the end of the window."
((add-hook 'erc-mode-hook #'erc-add-scroll-to-bottom)
@@ -116,6 +104,7 @@ variable `erc-input-line-position'."
(recenter (or erc-input-line-position -1)))))))
;;; Make read only
+;;;###autoload(autoload 'erc-readonly-mode "erc-goodies" nil t)
(define-erc-module readonly nil
"This mode causes all inserted text to be read-only."
((add-hook 'erc-insert-post-hook #'erc-make-read-only)
@@ -131,6 +120,7 @@ Put this function on `erc-insert-post-hook' and/or
`erc-send-post-hook'."
(put-text-property (point-min) (point-max) 'rear-nonsticky t))
;;; Move to prompt when typing text
+;;;###autoload(autoload 'erc-move-to-prompt-mode "erc-goodies" nil t)
(define-erc-module move-to-prompt nil
"This mode causes the point to be moved to the prompt when typing text."
((add-hook 'erc-mode-hook #'erc-move-to-prompt-setup)
@@ -155,6 +145,7 @@ Put this function on `erc-insert-post-hook' and/or
`erc-send-post-hook'."
(add-hook 'pre-command-hook #'erc-move-to-prompt nil t))
;;; Keep place in unvisited channels
+;;;###autoload(autoload 'erc-keep-place-mode "erc-goodies" nil t)
(define-erc-module keep-place nil
"Leave point above un-viewed text in other channels."
((add-hook 'erc-insert-pre-hook #'erc-keep-place))
@@ -193,6 +184,7 @@ Put this function on `erc-insert-post-hook' and/or
`erc-send-post-hook'."
If a command's function symbol is in this list, the typed command
does not appear in the ERC buffer after the user presses ENTER.")
+;;;###autoload(autoload 'erc-noncommands-mode "erc-goodies" nil t)
(define-erc-module noncommands nil
"This mode distinguishes non-commands.
Commands listed in `erc-insert-this' know how to display
@@ -381,6 +373,7 @@ The value `erc-interpret-controls-p' must also be t for
this to work."
(intern (concat "fg:erc-color-face" (number-to-string n))))
(t (erc-log (format " Wrong color: %s" n)) 'default))))
+;;;###autoload(autoload 'erc-irccontrols-mode "erc-goodies" nil t)
(define-erc-module irccontrols nil
"This mode enables the interpretation of IRC control chars."
((add-hook 'erc-insert-modify-hook #'erc-controls-highlight)
@@ -440,6 +433,7 @@ See `erc-interpret-controls-p' and
`erc-interpret-mirc-color' for options."
s))
(t s)))))
+;;;###autoload
(defun erc-controls-strip (str)
"Return a copy of STR with all IRC control characters removed."
(when str
@@ -553,6 +547,7 @@ Else interpretation is turned off."
(if erc-interpret-controls-p "ON" "OFF")))
;; Smiley
+;;;###autoload(autoload 'erc-smiley-mode "erc-goodies" nil t)
(define-erc-module smiley nil
"This mode translates text-smileys such as :-) into pictures.
This requires the function `smiley-region', which is defined in
@@ -569,6 +564,7 @@ This function should be used with `erc-insert-modify-hook'."
(smiley-region (point-min) (point-max))))
;; Unmorse
+;;;###autoload(autoload 'erc-unmorse-mode "erc-goodies" nil t)
(define-erc-module unmorse nil
"This mode causes morse code in the current channel to be unmorsed."
((add-hook 'erc-insert-modify-hook #'erc-unmorse))
@@ -611,3 +607,7 @@ servers. If called from a program, PROC specifies the
server process."
(provide 'erc-goodies)
;;; erc-goodies.el ends here
+
+;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
+;; End:
diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el
index 6699afe36a0..612814ac6da 100644
--- a/lisp/erc/erc-ibuffer.el
+++ b/lisp/erc/erc-ibuffer.el
@@ -32,6 +32,7 @@
(require 'ibuffer)
(require 'ibuf-ext)
(require 'erc)
+(require 'erc-goodies) ; `erc-controls-interpret'
(defgroup erc-ibuffer nil
"The Ibuffer group for ERC."
diff --git a/lisp/erc/erc-page.el b/lisp/erc/erc-page.el
index 6cba59c6946..a94678e5132 100644
--- a/lisp/erc/erc-page.el
+++ b/lisp/erc/erc-page.el
@@ -30,6 +30,8 @@
(require 'erc)
+(declare-function erc-controls-interpret "erc-goodies" (str))
+
(defgroup erc-page nil
"React to CTCP PAGE messages."
:group 'erc)
@@ -70,6 +72,7 @@ SENDER and MSG, so that might be easier to use."
This will call `erc-page-function', if defined, or it will just print
a message and `beep'. In addition to that, the page message is also
inserted into the server buffer."
+ (require 'erc-goodies) ; for `erc-controls-interpret'
(when (and erc-page-mode
(string-match "PAGE\\(\\s-+.*\\)?$" msg))
(let* ((m (match-string 1 msg))
diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el
index 5fca14e2365..a9443e0ea17 100644
--- a/lisp/erc/erc-speedbar.el
+++ b/lisp/erc/erc-speedbar.el
@@ -36,6 +36,7 @@
;;; Code:
(require 'erc)
+(require 'erc-goodies)
(require 'speedbar)
(condition-case nil (require 'dframe) (error nil))
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 27e9ec81b98..017f72476b1 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -58,17 +58,13 @@
;;; Code:
-(load "erc-loaddefs" 'noerror 'nomessage)
+(eval-and-compile (load "erc-loaddefs" 'noerror 'nomessage))
(require 'erc-networks)
(require 'erc-backend)
(require 'cl-lib)
(require 'format-spec)
-(require 'pp)
-(require 'thingatpt)
(require 'auth-source)
-(require 'time-date)
-(require 'iso8601)
(eval-when-compile (require 'subr-x) (require 'url-parse))
(defconst erc-version "5.6-git"
@@ -141,6 +137,11 @@
(defvar motif-version-string)
(defvar gtk-version-string)
+(declare-function decoded-time-period "time-date" (time))
+(declare-function iso8601-parse-duration "iso8601" (string))
+(declare-function word-at-point "thingatpt" (&optional no-properties))
+(autoload 'word-at-point "thingatpt") ; for hl-nicks
+
;; tunable connection and authentication parameters
(defcustom erc-server nil
@@ -3102,6 +3103,8 @@ returns the time spec converted to a number of seconds."
(string-to-number period))
;; Parse as a time spec.
(t
+ (require 'time-date)
+ (require 'iso8601)
(let ((time (condition-case nil
(iso8601-parse-duration
(concat (cond
@@ -6933,8 +6936,6 @@ shortened server name instead."
(cond (lag (format "lag:%.0f" lag))
(t ""))))
-;; erc-goodies is required at end of this file.
-
;; TODO when ERC drops Emacs 28, replace the expressions in the format
;; spec below with functions.
(defun erc-update-mode-line-buffer (buffer)
@@ -7484,6 +7485,4 @@ Customize `erc-url-connect-function' to override this."
(provide 'erc)
-;; FIXME this is a temporary stopgap for Emacs 29.
-(require 'erc-goodies)
;;; erc.el ends here
- master dfaeeba97cc 01/37: Change ERC version to 5.6-git, (continued)
- master dfaeeba97cc 01/37: Change ERC version to 5.6-git, F. Jason Park, 2023/04/08
- master 03eddc99242 07/37: Add probing erc-server-reconnect-function variant, F. Jason Park, 2023/04/08
- master b1007516cdf 02/37: Add subcommand dispatch facility to erc-cmd-HELP, F. Jason Park, 2023/04/08
- master 2d876a4ca94 15/37: Convert ERC's Imenu integration into proper module, F. Jason Park, 2023/04/08
- master 61ed0b43cdb 05/37: Split overlong outgoing messages in erc-sasl, F. Jason Park, 2023/04/08
- master 8184a815aff 34/37: Add erc-button helper for substituting command keys, F. Jason Park, 2023/04/08
- master 379d35695b1 28/37: Make some erc-stamp functions more limber, F. Jason Park, 2023/04/08
- master 1f1cd467c6a 33/37: Replace Info-goto-node with info in erc-button-alist, F. Jason Park, 2023/04/08
- master e69bd59ec59 09/37: Honor arbitrary CHANTYPES in ERC, F. Jason Park, 2023/04/08
- master d5435a0d822 25/37: Refactor marker initialization in erc-open, F. Jason Park, 2023/04/08
- master 5011554529b 12/37: Don't require erc-goodies in erc.el,
F. Jason Park <=
- master 0e4c07dc744 36/37: Allow erc-reuse-frames to favor connections, F. Jason Park, 2023/04/08
- master 89815631f24 10/37: Copy over upstream Compat macros to erc-compat, F. Jason Park, 2023/04/08
- master 9aa2806fdc3 13/37: Modify erc-mode-map in module definitions, F. Jason Park, 2023/04/08
- master 8793874616f 26/37: Adjust some old text properties in ERC buffers, F. Jason Park, 2023/04/08
- master 3d81ecf0a95 11/37: Leverage loaddefs for migrating ERC modules, F. Jason Park, 2023/04/08
- master 9f6a9cef97b 29/37: Put display properties to better use in erc-stamp, F. Jason Park, 2023/04/08
- master e3c4a648d16 31/37: Add variant for erc-match invisibility spec, F. Jason Park, 2023/04/08
- master c104e90888a 35/37: Make auth-source erc-services tests more readable, F. Jason Park, 2023/04/08
- master 0c3a069ae00 30/37: Convert erc-fill minor mode into a proper module, F. Jason Park, 2023/04/08
- master 2d3ae5d5e68 03/37: Add subcommand erc-cmd-HELP handler to erc-dcc, F. Jason Park, 2023/04/08