;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/erc/erc-incal.el ;; ;; all ERC: ;; https://dataswamp.org/~incal/emacs-init/erc/ (require 'erc) (require 'erc-element) (require 'erc-fill) (require 'erc-goodies) (require 'erc-iterate) (require 'erc-join) (require 'erc-kill) (require 'erc-log) (require 'erc-pcomplete) (require 'erc-ring) (require 'erc-scroll) (require 'erc-spell) (require 'mode-line) (require 'super) (require 'w3m-url) (require 'warnings) (setq erc-buffer-display 'buffer) (setq erc-interpret-controls-p t) (setq erc-show-speaker-membership-status nil) (setq erc-nick user-login-name) (setq erc-user-full-name user-login-name) (defun znc-connect () (interactive) (let*((ds-znc-name "znc") (ds-znc-server "127.0.0.1") (ds-znc-port 6668) (ds-znc-passwd (auth-source-pick-first-password :host ds-znc-name)) ) (erc :server ds-znc-server :port ds-znc-port :user erc-nick :nick erc-nick :password ds-znc-passwd) )) (defalias 'zconnect #'znc-connect) (let*((dataswamp-name "dataswamp") (dataswamp-org (format "%s.org" dataswamp-name)) (dataswamp-server (format "irc.%s" dataswamp-org)) (dataswamp-channel (erc-ensure-channel-name dataswamp-name)) (dataswamp-buffer (format "%s@%s" dataswamp-channel dataswamp-org)) (dataswamp-port 6697) (emacs-channel (erc-ensure-channel-name "emacs")) (libera-name "libera.chat") (libera-server (format "irc.eu.%s" libera-name)) (libera-password (auth-source-pick-first-password :host libera-name)) ) (setq erc-server dataswamp-server) (setq erc-port dataswamp-port) (setq erc-autojoin-channels-alist (list (list dataswamp-server dataswamp-channel "#ghost" "#ghost-reporting") (list libera-name dataswamp-channel))) (defun erc-send-libera-password () (interactive) (erc-cmd-MSG (format "NickServ IDENTIFY %s %s" user-login-name libera-password) )) (declare-function erc-send-libera-password nil) (defalias 'id #'erc-send-libera-password) (defun erc-get-connect-servers () (list (list libera-server libera-password t)) ) (declare-function erc-get-connect-servers nil) (defun goto-dataswamp () (interactive) (let ((cbuf (current-buffer)) (dbuf (get-buffer dataswamp-buffer)) (ebuf (get-buffer emacs-channel)) ) (if (eq cbuf dbuf) (switch-to-erc-buffer ebuf) (switch-to-erc-buffer dbuf) ))) (declare-function goto-dataswamp nil) ) ;; settings (setq erc-hide-list '("JOIN" "KICK" "MODE" "NICK" "PART" "QUIT")) (setq erc-header-line-format nil) (setq erc-interpret-mirc-color t) (setq erc-kill-server-buffer-on-quit t) (setq erc-pcomplete-nick-postfix ",") (setq erc-prompt "$") (setq erc-server-reconnect-attempts t) (setq warning-suppress-types '((erc))) ;; mode line (setq erc-mode-line-away-status-format "ERC - away") (setq erc-mode-line-format "%-41t%35S") ;; fill (setq erc-fill-function #'erc-fill-static) (setq erc-fill-static-center 12) ;; hide (defun erc-cmd-C () (interactive) (recenter 0) ) ;; keys (defun set-erc-element-keys (kmap) (define-key kmap [backtab] #'erc-element-prev) (keymap-set kmap "TAB" #'erc-element-next) ) (defun set-erc-keys () (let ((kmap erc-mode-map)) (disable-super-global-keys kmap) (set-erc-element-keys kmap) (set-erc-element-keys erc-button-keymap) (keymap-set kmap "C-x k" #'erc-kill-buffer-stay) (keymap-set kmap "M-;" #'ignore) (keymap-set kmap "M-n" #'goto-dataswamp) (keymap-set kmap "M-s s" #'w3m-kill-url-dwim) (keymap-set kmap "RET" #'erc-spell-then-send) ;; scroll top/bottom (keymap-set kmap "C-o i" #'erc-scroll-to-top-no-blanks) (keymap-set kmap "C-o k" #'erc-scroll-to-bottom-no-blanks) ;; command history (keymap-set kmap "M-P" #'erc-previous-command) (keymap-set kmap "M-N" #'erc-next-command) ;; iterate ERC buffers (keymap-set kmap "C-M-p" (lambda () (interactive) (erc-prev-buffer t))) (keymap-set kmap "C-M-n" (lambda () (interactive) (erc-next-buffer t))) )) (defun erc-mode-hook-f () (visual-line-mode) (abbrev-mode) (set-erc-keys) (lines) ) (add-hook 'erc-mode-hook #'erc-mode-hook-f) (provide 'erc-incal)