summaryrefslogtreecommitdiff
path: root/lisp/erc/erc-log.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-03-18 23:14:33 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2021-03-18 23:14:33 -0400
commitf463633f007a92418f1ea7d46347824d51373aa3 (patch)
treeea1edcc4443a6f2e4fe722eac9704ce2a1112831 /lisp/erc/erc-log.el
parent050b830b698dfe62737428d35fec80f561692b07 (diff)
downloademacs-f463633f007a92418f1ea7d46347824d51373aa3.tar.gz
lisp/erc: Use lexical-binding
Also remove various redundant `:group` arguments. * lisp/erc/erc-backend.el (define-erc-response-handler): Move `declare` after the docstring. * lisp/erc/erc-capab.el: Use lexical-binding. (erc-capab-identify-activate): Simplify with `member`. * lisp/erc/erc-dcc.el (erc-dcc): Move before erc-dcc-mode definition, which refers to it. (erc-dcc-chat-accept): Remove unused vars `nick` and `buffer`. * lisp/erc/erc-imenu.el: Use lexical-binding. (erc-create-imenu-index): Remove unused var `prev-pos`. * lisp/erc/erc-match.el: Use lexical-binding. (erc-match-message): Remove unused var `old-pt`. (erc-match-message): Strength-reduce `eval` to `symbol-value`. * lisp/erc/erc-page.el: Use lexical-binding. (erc-page): Move Custom group before `erg-page-mode` which refers to it. * lisp/erc/erc-replace.el: Use lexical-binding. (erc-replace-insert): Use `functionp`. * lisp/erc/erc-status-sidebar.el: Use lexical-binding. (erc-status-sidebar-open): Remove unused var `sidebar-window`. * lisp/erc/erc.el: Fix header to use the customary 3 semi-colons. (erc-fill-column): Declare variable. * lisp/erc/erc-autoaway.el: Use lexical-binding. * lisp/erc/erc-ezbounce.el: Use lexical-binding. * lisp/erc/erc-fill.el: Use lexical-binding. * lisp/erc/erc-goodies.el: Use lexical-binding. * lisp/erc/erc-ibuffer.el: Use lexical-binding. * lisp/erc/erc-identd.el: Use lexical-binding. * lisp/erc/erc-join.el: Use lexical-binding. * lisp/erc/erc-lang.el: Use lexical-binding. * lisp/erc/erc-log.el: Use lexical-binding. * lisp/erc/erc-menu.el: Use lexical-binding. * lisp/erc/erc-netsplit.el: Use lexical-binding. * lisp/erc/erc-networks.el: Use lexical-binding. * lisp/erc/erc-pcomplete.el: Use lexical-binding. * lisp/erc/erc-ring.el: Use lexical-binding. * lisp/erc/erc-speedbar.el: Use lexical-binding. * lisp/erc/erc-spelling.el: Use lexical-binding. * lisp/erc/erc-truncate.el: Use lexical-binding. * lisp/erc/erc-xdcc.el: Use lexical-binding.
Diffstat (limited to 'lisp/erc/erc-log.el')
-rw-r--r--lisp/erc/erc-log.el57
1 files changed, 23 insertions, 34 deletions
diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el
index 22fd3d27136..ddd00afd73b 100644
--- a/lisp/erc/erc-log.el
+++ b/lisp/erc/erc-log.el
@@ -1,4 +1,4 @@
-;;; erc-log.el --- Logging facilities for ERC.
+;;; erc-log.el --- Logging facilities for ERC. -*- lexical-binding: t; -*-
;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
@@ -112,7 +112,6 @@ SERVER and PORT are the parameters that were used to connect to BUFFERs
If you want to write logs into different directories, make a
custom function which returns the directory part and set
`erc-log-channels-directory' to its name."
- :group 'erc-log
:type '(choice (const :tag "#channel!nick@server:port.txt"
erc-generate-log-file-name-long)
(const :tag "#channel!nick@network.txt"
@@ -124,7 +123,6 @@ custom function which returns the directory part and set
(defcustom erc-truncate-buffer-on-save nil
"Erase the contents of any ERC (channel, query, server) buffer when it is saved."
- :group 'erc-log
:type 'boolean)
(defcustom erc-enable-logging t
@@ -138,7 +136,6 @@ This variable is buffer local. Setting it via \\[customize] sets the
default value.
Log files are stored in `erc-log-channels-directory'."
- :group 'erc-log
:type '(choice boolean
function))
(make-variable-buffer-local 'erc-enable-logging)
@@ -153,14 +150,12 @@ If this is the name of a function, the function will be called
with the buffer, target, nick, server, and port arguments. See
`erc-generate-log-file-name-function' for a description of these
arguments."
- :group 'erc-log
:type '(choice directory
(function "Function")
(const :tag "Disable logging" nil)))
(defcustom erc-log-insert-log-on-open nil
"Insert log file contents into the buffer if a log file exists."
- :group 'erc-log
:type 'boolean)
(defcustom erc-save-buffer-on-part t
@@ -168,7 +163,6 @@ arguments."
If you set this to nil, you may want to enable both
`erc-log-write-after-send' and `erc-log-write-after-insert'."
- :group 'erc-log
:type 'boolean)
(defcustom erc-save-queries-on-quit t
@@ -176,7 +170,6 @@ If you set this to nil, you may want to enable both
If you set this to nil, you may want to enable both
`erc-log-write-after-send' and `erc-log-write-after-insert'."
- :group 'erc-log
:type 'boolean)
(defcustom erc-log-write-after-send nil
@@ -184,7 +177,6 @@ If you set this to nil, you may want to enable both
If you set this to nil, you may want to enable both
`erc-save-buffer-on-part' and `erc-save-queries-on-quit'."
- :group 'erc-log
:type 'boolean)
(defcustom erc-log-write-after-insert nil
@@ -193,7 +185,6 @@ logged ERC buffer.
If you set this to nil, you may want to enable both
`erc-save-buffer-on-part' and `erc-save-queries-on-quit'."
- :group 'erc-log
:type 'boolean)
(defcustom erc-log-file-coding-system 'emacs-mule
@@ -201,15 +192,13 @@ If you set this to nil, you may want to enable both
This should ideally, be a \"catch-all\" coding system, like
`emacs-mule', or `iso-2022-7bit'."
- :type 'coding-system
- :group 'erc-log)
+ :type 'coding-system)
(defcustom erc-log-filter-function nil
"If non-nil, pass text through the given function before writing it to
a log file.
The function should take one argument, which is the text to filter."
- :group 'erc-log
:type '(choice (function "Function")
(const :tag "No filtering" nil)))
@@ -232,31 +221,31 @@ also be a predicate function. To only log when you are not set away, use:
(null (erc-away-time)))))"
;; enable
((when erc-log-write-after-insert
- (add-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs))
+ (add-hook 'erc-insert-post-hook #'erc-save-buffer-in-logs))
(when erc-log-write-after-send
- (add-hook 'erc-send-post-hook 'erc-save-buffer-in-logs))
- (add-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs)
- (add-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs)
- (add-hook 'kill-emacs-hook 'erc-log-save-all-buffers)
- (add-hook 'erc-quit-hook 'erc-conditional-save-queries)
- (add-hook 'erc-part-hook 'erc-conditional-save-buffer)
+ (add-hook 'erc-send-post-hook #'erc-save-buffer-in-logs))
+ (add-hook 'erc-kill-buffer-hook #'erc-save-buffer-in-logs)
+ (add-hook 'erc-kill-channel-hook #'erc-save-buffer-in-logs)
+ (add-hook 'kill-emacs-hook #'erc-log-save-all-buffers)
+ (add-hook 'erc-quit-hook #'erc-conditional-save-queries)
+ (add-hook 'erc-part-hook #'erc-conditional-save-buffer)
;; append, so that 'erc-initialize-log-marker runs first
- (add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append)
+ (add-hook 'erc-connect-pre-hook #'erc-log-setup-logging 'append)
(dolist (buffer (erc-buffer-list))
(erc-log-setup-logging buffer)))
;; disable
- ((remove-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs)
- (remove-hook 'erc-send-post-hook 'erc-save-buffer-in-logs)
- (remove-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs)
- (remove-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs)
- (remove-hook 'kill-emacs-hook 'erc-log-save-all-buffers)
- (remove-hook 'erc-quit-hook 'erc-conditional-save-queries)
- (remove-hook 'erc-part-hook 'erc-conditional-save-buffer)
- (remove-hook 'erc-connect-pre-hook 'erc-log-setup-logging)
+ ((remove-hook 'erc-insert-post-hook #'erc-save-buffer-in-logs)
+ (remove-hook 'erc-send-post-hook #'erc-save-buffer-in-logs)
+ (remove-hook 'erc-kill-buffer-hook #'erc-save-buffer-in-logs)
+ (remove-hook 'erc-kill-channel-hook #'erc-save-buffer-in-logs)
+ (remove-hook 'kill-emacs-hook #'erc-log-save-all-buffers)
+ (remove-hook 'erc-quit-hook #'erc-conditional-save-queries)
+ (remove-hook 'erc-part-hook #'erc-conditional-save-buffer)
+ (remove-hook 'erc-connect-pre-hook #'erc-log-setup-logging)
(dolist (buffer (erc-buffer-list))
(erc-log-disable-logging buffer))))
-(define-key erc-mode-map "\C-c\C-l" 'erc-save-buffer-in-logs)
+(define-key erc-mode-map "\C-c\C-l" #'erc-save-buffer-in-logs)
;;; functionality referenced from erc.el
(defun erc-log-setup-logging (buffer)
@@ -357,13 +346,13 @@ The result is converted to lowercase, as IRC is case-insensitive."
buffer target nick server port)
erc-log-channels-directory)))))
-(defun erc-generate-log-file-name-with-date (buffer &rest ignore)
+(defun erc-generate-log-file-name-with-date (buffer &rest _ignore)
"This function computes a short log file name.
The name of the log file is composed of BUFFER and the current date.
This function is a possible value for `erc-generate-log-file-name-function'."
(concat (buffer-name buffer) "-" (format-time-string "%Y-%m-%d") ".txt"))
-(defun erc-generate-log-file-name-short (buffer &rest ignore)
+(defun erc-generate-log-file-name-short (buffer &rest _ignore)
"This function computes a short log file name.
In fact, it only uses the buffer name of the BUFFER argument, so
you can affect that using `rename-buffer' and the-like. This
@@ -371,7 +360,7 @@ function is a possible value for
`erc-generate-log-file-name-function'."
(concat (buffer-name buffer) ".txt"))
-(defun erc-generate-log-file-name-long (buffer target nick server port)
+(defun erc-generate-log-file-name-long (_buffer target nick server port)
"Generates a log-file name in the way ERC always did it.
This results in a file name of the form #channel!nick@server:port.txt.
This function is a possible value for `erc-generate-log-file-name-function'."
@@ -385,7 +374,7 @@ This function is a possible value for `erc-generate-log-file-name-function'."
(declare-function erc-network-name "erc-networks" ())
-(defun erc-generate-log-file-name-network (buffer target nick server port)
+(defun erc-generate-log-file-name-network (buffer target nick server _port)
"Generates a log-file name using the network name rather than server name.
This results in a file name of the form #channel!nick@network.txt.
This function is a possible value for `erc-generate-log-file-name-function'."