diff options
Diffstat (limited to 'modules/erc-config.el')
| -rw-r--r-- | modules/erc-config.el | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/modules/erc-config.el b/modules/erc-config.el index c0fa9c325..4eac812c4 100644 --- a/modules/erc-config.el +++ b/modules/erc-config.el @@ -33,6 +33,33 @@ ;; is read at load time below (erc-user-full-name), so a standalone .elc needs it. (require 'user-constants) +;; ERC loads lazily (use-package :commands), so these symbols aren't bound at +;; this file's compile time. Declare them to keep the byte-compiler quiet +;; without forcing an eager require. + +;; Functions provided by the erc package. +(declare-function erc-buffer-list "erc") +(declare-function erc-server-process-alive "erc") +(declare-function erc-server-or-unjoined-channel-buffer-p "erc") +(declare-function erc-current-nick "erc") +(declare-function erc-join-channel "erc") +(declare-function erc-part-from-channel "erc") +(declare-function erc-quit-server "erc") + +;; Variables read/set in the use-package :config block below. +(defvar erc-log-channels-directory) +(defvar erc-track-exclude-types) +(defvar erc-track-exclude-server-buffer) +(defvar erc-track-visibility) +(defvar erc-track-switch-direction) +(defvar erc-track-showcount) +;; NOTE: erc-unique-buffers and erc-generate-buffer-name-function are not ERC +;; variables in Emacs 30.x (no defcustom/defvar in the package); the setq below +;; only creates inert globals. Declared here to silence the warning without +;; changing the existing (no-op) behavior -- see the SUSPICIOUS note. +(defvar erc-unique-buffers) +(defvar erc-generate-buffer-name-function) + ;; ------------------------------------ ERC ------------------------------------ ;; Server definitions and connection settings @@ -99,7 +126,7 @@ Change this value to use a different nickname.") (let ((server-buffers '())) (dolist (buf (erc-buffer-list)) (with-current-buffer buf - (when (and (erc-server-buffer-p) (erc-server-process-alive)) + (when (and (erc-server-or-unjoined-channel-buffer-p) (erc-server-process-alive)) (unless (member (buffer-name) server-buffers) (push (buffer-name) server-buffers))))) @@ -113,6 +140,8 @@ Change this value to use a different nickname.") server-buffers)) +(require 'system-lib) + (defun cj/erc-switch-to-buffer-with-completion () "Switch to an ERC buffer using completion. If no ERC buffers exist, prompt to connect to a server. @@ -121,7 +150,7 @@ Buffer names are shown with server context for clarity." (let* ((erc-buffers (erc-buffer-list)) (buffer-names (mapcar #'buffer-name erc-buffers))) (if buffer-names - (let ((selected (completing-read "Switch to ERC buffer: " buffer-names nil t))) + (let ((selected (completing-read "Switch to ERC buffer: " (cj/completion-table 'buffer buffer-names) nil t))) (switch-to-buffer selected)) (message "No ERC buffers found.") (when (y-or-n-p "Connect to an IRC server? ") @@ -132,7 +161,7 @@ Buffer names are shown with server context for clarity." "Return t if the current buffer is an active ERC server buffer." (and (derived-mode-p 'erc-mode) (erc-server-process-alive) - (erc-server-buffer-p))) + (erc-server-or-unjoined-channel-buffer-p))) (defun cj/erc-get-channels-for-current-server () @@ -158,7 +187,7 @@ Auto-adds # prefix if missing. Offers completion from configured channels." (let ((server-buffers (cl-remove-if-not (lambda (buf) (with-current-buffer buf - (and (erc-server-buffer-p) + (and (erc-server-or-unjoined-channel-buffer-p) (erc-server-process-alive)))) (erc-buffer-list)))) (if server-buffers @@ -338,16 +367,15 @@ NICK is the sender and MESSAGE is the message text." :after erc :hook (erc-mode . erc-nicks-mode)) -;; ------------------------------ ERC Yank To Gist ----------------------------- -;; automatically create a Gist if pasting more than 5 lines -;; this module requires https://github.com/defunkt/gist -;; via ruby: 'gem install gist' via the aur: yay -S gist - -(use-package erc-yank - :after erc - :bind - (:map erc-mode-map - ("C-y" . erc-yank))) +;; -------------------------------- ERC Yank ---------------------------------- +;; The erc-yank package was dropped 2026-06-20: a paste over 5 lines became a +;; PUBLIC gist (it called `gist -P', the clipboard paste flag, with no +;; `--private'), behind only a single y-or-n-p and with no guard if the `gist' +;; binary was absent -- a one-keystroke path to publishing whatever sat on the +;; system clipboard. No replacement binding is needed: erc-mode-map defines no +;; C-y of its own, so with erc-yank gone C-y falls through to the ordinary +;; global `yank' and a paste stays local. Gist a large snippet by hand when +;; that's actually wanted. (provide 'erc-config) ;;; erc-config.el ends here |
