Small cleanup
[~bandali/configs] / lisp / bandali-erc.el
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 (use-package erc
28 :bind ("C-c w e" . erc-switch-to-buffer-other-window)
29 :custom
30 (erc-join-buffer 'bury)
31 (erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
32 (erc-nick "bandali")
33 (erc-prompt "erc>")
34 (erc-rename-buffers t)
35 (erc-server-reconnect-attempts 5)
36 (erc-server-reconnect-timeout 3)
37 :config
38 (declare-function erc-message "erc-backend"
39 (message-command line &optional force))
40 (declare-function erc-default-target "erc")
41 (declare-function erc-current-nick "erc")
42 (defun erc-cmd-OPME ()
43 "Request chanserv to op me."
44 (erc-message "PRIVMSG"
45 (format "chanserv op %s %s"
46 (erc-default-target)
47 (erc-current-nick)) nil))
48 (declare-function erc-cmd-DEOP "erc" (&rest people))
49 (defun erc-cmd-DEOPME ()
50 "Deop myself from current channel."
51 (erc-cmd-DEOP (format "%s" (erc-current-nick))))
52 (add-to-list 'erc-modules 'keep-place)
53 (add-to-list 'erc-modules 'notifications)
54 (add-to-list 'erc-modules 'smiley)
55 (add-to-list 'erc-modules 'spelling)
56 (add-to-list 'erc-modules 'scrolltoplace)
57 (declare-function erc-update-modules "erc")
58 (erc-update-modules))
59
60 (use-package erc-fill
61 :after erc
62 :custom
63 (erc-fill-column 77)
64 (erc-fill-function 'erc-fill-static)
65 (erc-fill-static-center 18))
66
67 (use-package erc-pcomplete
68 :after erc
69 :custom
70 (erc-pcomplete-nick-postfix ", "))
71
72 (use-package erc-track
73 :after erc
74 :bind (("C-c a e t d" . erc-track-disable)
75 ("C-c a e t e" . erc-track-enable)
76 ("C-c a e M-a" . erc-track-switch-buffer-other-window)
77 :map erc-mode-map
78 ("M-a" . erc-track-switch-buffer))
79 :custom
80 (erc-track-enable-keybindings nil)
81 (erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT"
82 "324" "329" "332" "333" "353" "477"))
83 (erc-track-position-in-mode-line t)
84 (erc-track-priority-faces-only 'all)
85 (erc-track-shorten-function nil))
86
87 (use-package erc-hl-nicks
88 :after erc)
89
90 (use-package erc-scrolltoplace
91 :after erc)
92
93 (use-package znc
94 :bind (("C-c a e e" . znc-erc)
95 ("C-c a e a" . znc-all))
96 :config
97 (let ((pwd (let ((auth (auth-source-search :host "znca")))
98 (cond
99 ((null auth) (error "Couldn't find znca's authinfo"))
100 (t (funcall (plist-get (car auth) :secret)))))))
101 (setq znc-servers
102 `(("znc.shemshak.org" 1337 t
103 ((freenode "amin/freenode" ,pwd)))
104 ("znc.shemshak.org" 1337 t
105 ((oftc "amin/oftc" ,pwd)))))))
106
107 (provide 'bandali-erc)
108 ;;; bandali-erc.el ends here