blob: 85b46700f92c2b43d3b439b758bdab848ffd2a18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
(require 'erc)
(require 'erc-log)
(require 'erc-notify)
(require 'erc-spelling)
(require 'erc-autoaway)
(require 'erc-services)
(require 'notifications)
(require 'tls)
;; Notify the user of private messages
(defun erc-private-message-notify (proc parsed)
(let ((nick (car (erc-parse-user (erc-response.sender parsed))))
(target (car (erc-response.command-args parsed)))
(msg (erc-response.contents parsed)))
(notifications-notify :title nick :body msg)))
;; (add-hook 'erc-server-PRIVMSG-functions 'erc-private-message-notify)
;; Notify the user when their nick is mentioned
(defun erc-nick-mentioned-notify (match-type nick message)
"Shows a notification when user's nick is mentioned."
(when (and (not (posix-string-match "^\\** *Users on #" message))
(eq math-type 'current-nick))
(notifications-notify
:title nick
:body message
:app-icon "/usr/share/notify-osd/icons/gnome/scalable/status/notification-message-im.svg"
:urgency 'low)))
;; (add-hook 'erc-text-matched-hook 'erc-nick-mentioned-notify)
;; Nickname
(setq erc-nick "davexunit")
;; Interpret mIRC-style color commands in IRC chats
(setq erc-interpret-mirc-color t)
;; The following are commented out by default, but users of other
;; non-Emacs IRC clients might find them useful.
;; Kill buffers for channels after /part
(setq erc-kill-buffer-on-part t)
;; Kill buffers for private queries after quitting the server
(setq erc-kill-queries-on-quit t)
;; Kill buffers for server messages after quitting the server
(setq erc-kill-server-buffer-on-quit t)
;; open query buffers in the current window
(setq erc-query-display 'buffer)
;; exclude boring stuff from tracking
(erc-track-mode t)
(setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
"324" "329" "332" "333" "353" "477"))
;; logging
(setq erc-log-channels-directory "~/.erc/logs/")
(if (not (file-exists-p erc-log-channels-directory))
(mkdir erc-log-channels-directory t))
(setq erc-save-buffer-on-part t)
;; truncate long irc buffers
(erc-truncate-mode 1)
;; enable spell checking
(erc-spelling-mode 0)
;; utf-8 always and forever
(setq erc-server-coding-system '(utf-8 . utf-8))
;; Auto-join channels
(erc-autojoin-mode t)
(setq erc-autojoin-channels-alist
'(("freenode.net" "#guile" "#guix" "#emacs" "#scheme"
"#lispgames" "#fsf" "#gnu" "#sly")
("slack.com" "#general" "#random" "#ops" "#techeng"
"#church-of-emacs")))
;; Don't open channel buffers in place of the current buffer because
;; that drives me fucking crazy.
(setq erc-join-buffer 'bury)
;; Secret password file
(defvar freenode-password nil)
(let ((password-file "~/.emacs.d/.ercpasswords"))
(when (file-exists-p password-file)
(load password-file)))
;; Stuff to make authenticating with Rizon work
(erc-services-mode t)
(setq erc-prompt-for-nickserv-password nil)
(setq erc-nickserv-identify-mode 'autodetect)
;; Start and stop erc
(defun start-irc ()
"Connect to IRC."
(interactive)
(erc-tls :server "dthompson.us"
:port 1025
:nick erc-nick
:password freenode-password))
(defun start-oftc ()
"Connect to OFTC IRC."
(interactive)
(erc-tls :server "irc.oftc.net"
:port 6697
:nick erc-nick
:password oftc-password))
(defun start-slack ()
"Connect to Slack."
(interactive)
(erc-tls :server "vhl.irc.slack.com"
:port 6697
:nick erc-nick
:password slack-password))
(defun filter-erc-server-buffers ()
(delq nil
(mapcar
(lambda (x) (and (erc-server-buffer-p x) x))
(buffer-list))))
(defun stop-irc ()
"Disconnects from all irc servers"
(interactive)
(dolist (buffer (filter-erc-server-buffers))
(message "Server buffer: %s" (buffer-name buffer))
(with-current-buffer buffer
(erc-quit-server "Later"))))
|