| 1 | ;;; bandali-erc.el --- bandali's ERC setup -*- lexical-binding: t; -*- |
| 2 | |
| 3 | ;; Copyright (C) 2018-2020 Amin Bandali |
| 4 | |
| 5 | ;; Author: Amin Bandali <bandali@gnu.org> |
| 6 | ;; Keywords: tools |
| 7 | |
| 8 | ;; This program is free software; you can redistribute it and/or modify |
| 9 | ;; it under the terms of the GNU General Public License as published by |
| 10 | ;; the Free Software Foundation, either version 3 of the License, or |
| 11 | ;; (at your option) any later version. |
| 12 | |
| 13 | ;; This program is distributed in the hope that it will be useful, |
| 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | ;; GNU General Public License for more details. |
| 17 | |
| 18 | ;; You should have received a copy of the GNU General Public License |
| 19 | ;; along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 20 | |
| 21 | ;;; Commentary: |
| 22 | |
| 23 | ;; My ERC setup for IRC. It uses my fork of ZNC.el. |
| 24 | |
| 25 | ;;; Code: |
| 26 | |
| 27 | (with-eval-after-load 'erc |
| 28 | (make-directory (b/var "erc/dcc/") t) |
| 29 | (csetq |
| 30 | erc-auto-query 'bury |
| 31 | erc-autojoin-domain-only nil |
| 32 | erc-dcc-get-default-directory (b/var "erc/dcc/") |
| 33 | erc-format-nick-function 'erc-format-@nick |
| 34 | erc-join-buffer 'bury |
| 35 | erc-log-channels-directory (b/var "erc/log-channels/") |
| 36 | erc-lurker-hide-list '("JOIN" "PART" "QUIT") |
| 37 | erc-nick "bandali" |
| 38 | erc-prompt "erc>" |
| 39 | erc-rename-buffers t |
| 40 | erc-server-reconnect-attempts 5 |
| 41 | erc-server-reconnect-timeout 3) |
| 42 | |
| 43 | (declare-function erc-message "erc-backend" |
| 44 | (message-command line &optional force)) |
| 45 | (declare-function erc-default-target "erc") |
| 46 | (declare-function erc-current-nick "erc") |
| 47 | (defun erc-cmd-OPME () |
| 48 | "Request chanserv to op me." |
| 49 | (erc-message "PRIVMSG" |
| 50 | (format "chanserv op %s %s" |
| 51 | (erc-default-target) |
| 52 | (erc-current-nick)) nil)) |
| 53 | (declare-function erc-cmd-DEOP "erc" (&rest people)) |
| 54 | (defun erc-cmd-DEOPME () |
| 55 | "Deop myself from current channel." |
| 56 | (erc-cmd-DEOP (format "%s" (erc-current-nick)))) |
| 57 | (add-to-list 'erc-modules 'keep-place) |
| 58 | (add-to-list 'erc-modules 'notifications) |
| 59 | (add-to-list 'erc-modules 'smiley) |
| 60 | (add-to-list 'erc-modules 'spelling) |
| 61 | (declare-function erc-update-modules "erc") |
| 62 | (erc-update-modules) |
| 63 | |
| 64 | ;; erc-fill |
| 65 | (csetq |
| 66 | erc-fill-column 77 |
| 67 | erc-fill-function 'erc-fill-static |
| 68 | erc-fill-static-center 18) |
| 69 | |
| 70 | ;; erc-match |
| 71 | ;; (csetq |
| 72 | ;; erc-pal-highlight-type 'message |
| 73 | ;; erc-pals |
| 74 | ;; '("aindilis" "blackbeard" "bremner" "brettgilio" "civodul" "dto" |
| 75 | ;; "ggoes" "jrasata" "jxself" "mplsCorwin" "quiliro" "rindolf" "rwp" |
| 76 | ;; "sachac" "technomancy")) |
| 77 | ;; (with-eval-after-load 'erc-match |
| 78 | ;; (set-face-attribute |
| 79 | ;; 'erc-pal-face nil |
| 80 | ;; :foreground 'unspecified |
| 81 | ;; :weight 'unspecified |
| 82 | ;; ;; :inherit 'font-lock-string-face |
| 83 | ;; ;; :background (face-attribute 'font-lock-string-face :background) |
| 84 | ;; :background "#ffffed")) |
| 85 | |
| 86 | ;; erc-pcomplete |
| 87 | (csetq erc-pcomplete-nick-postfix ", ") |
| 88 | |
| 89 | ;; erc-track |
| 90 | (csetq |
| 91 | erc-track-enable-keybindings nil |
| 92 | erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT" |
| 93 | "324" "329" "332" "333" "353" "477") |
| 94 | erc-track-position-in-mode-line t |
| 95 | erc-track-priority-faces-only 'all |
| 96 | erc-track-shorten-function nil |
| 97 | erc-track-showcount t) |
| 98 | |
| 99 | ;; key bindings |
| 100 | (global-set-key (kbd "C-c w e") #'erc-switch-to-buffer-other-window) |
| 101 | (define-key erc-mode-map (kbd "M-a") #'erc-track-switch-buffer)) |
| 102 | |
| 103 | (with-eval-after-load 'znc |
| 104 | (let ((pwd (let ((auth (auth-source-search :host "znca"))) |
| 105 | (cond |
| 106 | ((null auth) (error "Couldn't find znca's authinfo")) |
| 107 | (t (funcall (plist-get (car auth) :secret))))))) |
| 108 | (csetq znc-servers |
| 109 | `(("znc.emacsconf.org" 6697 t |
| 110 | ((freenode "bandali/freenode" ,pwd))) |
| 111 | ("znc.emacsconf.org" 6697 t |
| 112 | ((oftc "bandali/oftc" ,pwd))) |
| 113 | ("znc.emacsconf.org" 6697 t |
| 114 | ((tildechat "bandali/tildechat" ,pwd))))))) |
| 115 | ;; global key bindings |
| 116 | (global-set-key (kbd "C-c a e e") #'znc-erc) |
| 117 | (global-set-key (kbd "C-c a e a") #'znc-all) |
| 118 | |
| 119 | (provide 'bandali-erc) |
| 120 | ;;; bandali-erc.el ends here |