1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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.
This commit is contained in:
Stefan Monnier 2021-03-18 23:14:33 -04:00
parent 050b830b69
commit f463633f00
35 changed files with 430 additions and 584 deletions

View file

@ -1,4 +1,4 @@
;;; erc-status-sidebar.el --- HexChat-like activity overview for ERC
;;; erc-status-sidebar.el --- HexChat-like activity overview for ERC -*- lexical-binding: t; -*-
;; Copyright (C) 2017, 2020-2021 Free Software Foundation, Inc.
@ -58,36 +58,30 @@
(defcustom erc-status-sidebar-buffer-name "*ERC Status*"
"Name of the sidebar buffer."
:type 'string
:group 'erc-status-sidebar)
:type 'string)
(defcustom erc-status-sidebar-mode-line-format "ERC Status"
"Mode line format for the status sidebar."
:type 'string
:group 'erc-status-sidebar)
:type 'string)
(defcustom erc-status-sidebar-header-line-format nil
"Header line format for the status sidebar."
:type '(choice (const :tag "No header line" nil)
string)
:group 'erc-status-sidebar)
string))
(defcustom erc-status-sidebar-width 15
"Default width of the sidebar (in columns)."
:type 'number
:group 'erc-status-sidebar)
:type 'number)
(defcustom erc-status-sidebar-channel-sort
'erc-status-sidebar-default-chansort
"Sorting function used to determine order of channels in the sidebar."
:type 'function
:group 'erc-status-sidebar)
:type 'function)
(defcustom erc-status-sidebar-channel-format
'erc-status-sidebar-default-chan-format
"Function used to format channel names for display in the sidebar."
:type 'function
:group 'erc-status-sidebar)
:type 'function)
(defun erc-status-sidebar-display-window ()
"Display the status buffer in a side window. Return the new window."
@ -152,7 +146,8 @@ containing it on the current frame is closed. See
(save-excursion
(let ((sidebar-exists (erc-status-sidebar-buffer-exists-p))
(sidebar-buffer (erc-status-sidebar-get-buffer))
(sidebar-window (erc-status-sidebar-get-window)))
;; (sidebar-window (erc-status-sidebar-get-window))
)
(unless sidebar-exists
(with-current-buffer sidebar-buffer
(erc-status-sidebar-mode)
@ -253,7 +248,7 @@ name stand out."
erc-disconnected-hook
erc-quit-hook))
(defun erc-status-sidebar--post-refresh (&rest ignore)
(defun erc-status-sidebar--post-refresh (&rest _ignore)
"Schedule sidebar refresh for execution after command stack is cleared.
Ignore arguments in IGNORE, allowing this function to be added to
@ -276,7 +271,7 @@ to the `window-configuration-change-hook'."
(when (and (eq (selected-window) (erc-status-sidebar-get-window))
(fboundp 'window-preserve-size))
(unless (eq (window-total-width) (window-min-size nil t))
(apply 'window-preserve-size (selected-window) t t nil))))
(apply #'window-preserve-size (selected-window) t t nil))))
(define-derived-mode erc-status-sidebar-mode special-mode "ERC Sidebar"
"Major mode for ERC status sidebar"
@ -298,8 +293,7 @@ to the `window-configuration-change-hook'."
;; erc-status-sidebar-mode initialization code, so it won't undo the
;; add-hook's we did in the previous expressions.
(add-hook 'change-major-mode-hook #'erc-status-sidebar-mode--unhook nil t)
(add-hook 'kill-buffer-hook #'erc-status-sidebar-mode--unhook nil t)
:group 'erc-status-sidebar)
(add-hook 'kill-buffer-hook #'erc-status-sidebar-mode--unhook nil t))
(provide 'erc-status-sidebar)
;;; erc-status-sidebar.el ends here