1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00

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.)
This commit is contained in:
F. Jason Park 2023-01-19 21:07:27 -08:00
parent 3d81ecf0a9
commit 5011554529
5 changed files with 27 additions and 23 deletions

View File

@ -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:

View File

@ -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."

View File

@ -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))

View File

@ -36,6 +36,7 @@
;;; Code:
(require 'erc)
(require 'erc-goodies)
(require 'speedbar)
(condition-case nil (require 'dframe) (error nil))

View File

@ -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