summaryrefslogtreecommitdiff
path: root/lisp/erc/erc-goodies.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/erc/erc-goodies.el')
-rw-r--r--lisp/erc/erc-goodies.el65
1 files changed, 31 insertions, 34 deletions
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index aef68810dfa..fc9a8d39ef4 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -1,4 +1,4 @@
-;; erc-goodies.el --- Collection of ERC modules
+;;; erc-goodies.el --- Collection of ERC modules -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
@@ -37,7 +37,7 @@
"Setup Imenu support in an ERC buffer."
(setq-local imenu-create-index-function #'erc-create-imenu-index))
-(add-hook 'erc-mode-hook 'erc-imenu-setup)
+(add-hook 'erc-mode-hook #'erc-imenu-setup)
(autoload 'erc-create-imenu-index "erc-imenu" "Imenu index creation function")
;;; Automatically scroll to bottom
@@ -53,16 +53,16 @@ argument to `recenter'."
(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)
- (add-hook 'erc-insert-done-hook 'erc-possibly-scroll-to-bottom)
+ ((add-hook 'erc-mode-hook #'erc-add-scroll-to-bottom)
+ (add-hook 'erc-insert-done-hook #'erc-possibly-scroll-to-bottom)
(dolist (buffer (erc-buffer-list))
(with-current-buffer buffer
(erc-add-scroll-to-bottom))))
- ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)
- (remove-hook 'erc-insert-done-hook 'erc-possibly-scroll-to-bottom)
+ ((remove-hook 'erc-mode-hook #'erc-add-scroll-to-bottom)
+ (remove-hook 'erc-insert-done-hook #'erc-possibly-scroll-to-bottom)
(dolist (buffer (erc-buffer-list))
(with-current-buffer buffer
- (remove-hook 'post-command-hook 'erc-scroll-to-bottom t)))))
+ (remove-hook 'post-command-hook #'erc-scroll-to-bottom t)))))
(defun erc-possibly-scroll-to-bottom ()
"Like `erc-add-scroll-to-bottom', but only if window is selected."
@@ -77,7 +77,7 @@ the value of `erc-input-line-position'.
This works whenever scrolling happens, so it's added to
`window-scroll-functions' rather than `erc-insert-post-hook'."
- (add-hook 'post-command-hook 'erc-scroll-to-bottom nil t))
+ (add-hook 'post-command-hook #'erc-scroll-to-bottom nil t))
(defun erc-scroll-to-bottom ()
"Recenter WINDOW so that `point' is on the last line.
@@ -104,10 +104,10 @@ variable `erc-input-line-position'."
;;; Make read only
(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)
- (add-hook 'erc-send-post-hook 'erc-make-read-only))
- ((remove-hook 'erc-insert-post-hook 'erc-make-read-only)
- (remove-hook 'erc-send-post-hook 'erc-make-read-only)))
+ ((add-hook 'erc-insert-post-hook #'erc-make-read-only)
+ (add-hook 'erc-send-post-hook #'erc-make-read-only))
+ ((remove-hook 'erc-insert-post-hook #'erc-make-read-only)
+ (remove-hook 'erc-send-post-hook #'erc-make-read-only)))
(defun erc-make-read-only ()
"Make all the text in the current buffer read-only.
@@ -119,14 +119,14 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'."
;;; Move to prompt when typing text
(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)
+ ((add-hook 'erc-mode-hook #'erc-move-to-prompt-setup)
(dolist (buffer (erc-buffer-list))
(with-current-buffer buffer
(erc-move-to-prompt-setup))))
- ((remove-hook 'erc-mode-hook 'erc-move-to-prompt-setup)
+ ((remove-hook 'erc-mode-hook #'erc-move-to-prompt-setup)
(dolist (buffer (erc-buffer-list))
(with-current-buffer buffer
- (remove-hook 'pre-command-hook 'erc-move-to-prompt t)))))
+ (remove-hook 'pre-command-hook #'erc-move-to-prompt t)))))
(defun erc-move-to-prompt ()
"Move the point to the ERC prompt if this is a self-inserting command."
@@ -138,15 +138,15 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'."
(defun erc-move-to-prompt-setup ()
"Initialize the move-to-prompt module for XEmacs."
- (add-hook 'pre-command-hook 'erc-move-to-prompt nil t))
+ (add-hook 'pre-command-hook #'erc-move-to-prompt nil t))
;;; Keep place in unvisited channels
(define-erc-module keep-place nil
"Leave point above un-viewed text in other channels."
- ((add-hook 'erc-insert-pre-hook 'erc-keep-place))
- ((remove-hook 'erc-insert-pre-hook 'erc-keep-place)))
+ ((add-hook 'erc-insert-pre-hook #'erc-keep-place))
+ ((remove-hook 'erc-insert-pre-hook #'erc-keep-place)))
-(defun erc-keep-place (ignored)
+(defun erc-keep-place (_ignored)
"Move point away from the last line in a non-selected ERC buffer."
(when (and (not (eq (window-buffer (selected-window))
(current-buffer)))
@@ -183,8 +183,8 @@ does not appear in the ERC buffer after the user presses ENTER.")
"This mode distinguishes non-commands.
Commands listed in `erc-insert-this' know how to display
themselves."
- ((add-hook 'erc-pre-send-functions 'erc-send-distinguish-noncommands))
- ((remove-hook 'erc-pre-send-functions 'erc-send-distinguish-noncommands)))
+ ((add-hook 'erc-pre-send-functions #'erc-send-distinguish-noncommands))
+ ((remove-hook 'erc-pre-send-functions #'erc-send-distinguish-noncommands)))
(defun erc-send-distinguish-noncommands (state)
"If STR is an ERC non-command, set `insertp' in STATE to nil."
@@ -211,20 +211,17 @@ highlighting effects. When this variable is non-nil, it can cause Emacs to run
slowly on systems lacking sufficient CPU speed. In chatty channels, or in an
emergency (message flood) it can be turned off to save processing time. See
`erc-toggle-interpret-controls'."
- :group 'erc-control-characters
:type '(choice (const :tag "Highlight control characters" t)
(const :tag "Remove control characters" remove)
(const :tag "Display raw control characters" nil)))
(defcustom erc-interpret-mirc-color nil
"If non-nil, ERC will interpret mIRC color codes."
- :group 'erc-control-characters
:type 'boolean)
(defcustom erc-beep-p nil
"Beep if C-g is in the server message.
The value `erc-interpret-controls-p' must also be t for this to work."
- :group 'erc-control-characters
:type 'boolean)
(defface erc-bold-face '((t :weight bold))
@@ -372,10 +369,10 @@ The value `erc-interpret-controls-p' must also be t for this to work."
(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))
- ((remove-hook 'erc-insert-modify-hook 'erc-controls-highlight)
- (remove-hook 'erc-send-modify-hook 'erc-controls-highlight)))
+ ((add-hook 'erc-insert-modify-hook #'erc-controls-highlight)
+ (add-hook 'erc-send-modify-hook #'erc-controls-highlight))
+ ((remove-hook 'erc-insert-modify-hook #'erc-controls-highlight)
+ (remove-hook 'erc-send-modify-hook #'erc-controls-highlight)))
(defun erc-controls-interpret (str)
"Return a copy of STR after dealing with IRC control characters.
@@ -546,10 +543,10 @@ Else interpretation is turned off."
"This mode translates text-smileys such as :-) into pictures.
This requires the function `smiley-region', which is defined in
smiley.el, which is part of Gnus."
- ((add-hook 'erc-insert-modify-hook 'erc-smiley)
- (add-hook 'erc-send-modify-hook 'erc-smiley))
- ((remove-hook 'erc-insert-modify-hook 'erc-smiley)
- (remove-hook 'erc-send-modify-hook 'erc-smiley)))
+ ((add-hook 'erc-insert-modify-hook #'erc-smiley)
+ (add-hook 'erc-send-modify-hook #'erc-smiley))
+ ((remove-hook 'erc-insert-modify-hook #'erc-smiley)
+ (remove-hook 'erc-send-modify-hook #'erc-smiley)))
(defun erc-smiley ()
"Smilify a region.
@@ -560,8 +557,8 @@ This function should be used with `erc-insert-modify-hook'."
;; Unmorse
(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))
- ((remove-hook 'erc-insert-modify-hook 'erc-unmorse)))
+ ((add-hook 'erc-insert-modify-hook #'erc-unmorse))
+ ((remove-hook 'erc-insert-modify-hook #'erc-unmorse)))
(defun erc-unmorse ()
"Unmorse some text.