1
0
Fork 0

Initial ERC configuration for Emacs (IRC)

org
Mike Gerwitz 2015-11-11 00:04:07 -05:00
parent 4d91f35c9f
commit 4d2f1af5aa
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
1 changed files with 124 additions and 0 deletions

124
emacs.d/irc.org 100644
View File

@ -0,0 +1,124 @@
#+TITLE: Mike Gerwitz's Emacs Mail Configuration
#+AUTHOR: Mike Gerwitz
#+EMAIL: mtg@gnu.org
I used to be a user of [[http://irssi.org/][irssi]], which is a damn good IRC client. But now that
I'm using Emacs for many other things---including [[file:mail.org][e-mail]]---I am comfortable
exploring it for other uses.
Emacs is an ideal platform for many things because of the flexibility that
Elisp provides---being able to hook and modify anything at runtime. For
IRC, I'm giving [[https://www.gnu.org/software/emacs/manual/html_node/erc/index.html][ERC]] a try, which is distributed with Emacs.
Unfortunately, I began this transition after I had already been away from
IRC (and therefore irssi) for a few years, so I won't be drawing many
parallels. Feel free to submit patches to this documentation.
You can find me on Freenode, user =mikegerwitz=.
As always with my code, I use lexical variable binding:
#+BEGIN_SRC emacs-lisp :padline no
;; -*- lexical-binding: t -*-
#+END_SRC
* User Information
I am =mikegerwitz= on any service I use.[fn:: (unless I forgot my password
and can't recover the account...e.g. Reddit, on which I'm =mgerwitz=)]
#+BEGIN_SRC emacs-lisp
(setq erc-nick "mikegerwitz"
erc-email-userid "mtg@gnu.org"
erc-user-full-name "Mike Gerwitz")
#+END_SRC
* Auto-Join
The =join= module distributed (and enabled by default) with Emacs can
auto-join channels on start.o
#+BEGIN_SRC emacs-lisp
(erc-autojoin-mode t)
(setq erc-autojoin-channels-alist
'(("freenode.net" "#fsf" "#fsf-members" "#gnu" "#libreplanet")))
#+END_SRC
Interestingly, this works even though I proxy to Freenode through a
=fencepost= SSH tunnel[fn:fencepost-tunnel], connecting to =localhost=; it
properly detects the server name.[fn:server-name]
* Tracking
ERC can use the modeline to notify the user [[http://www.emacswiki.org/emacs/ErcChannelTracking][when channels/queries have
activity]]. This is absolutely necessary---channel and query buffers can
easily be hidden, either intentionally or accidentally.
#+BEGIN_SRC emacs-lisp
(erc-track-mode t)
#+END_SRC
The default positioning in the modeline is before the list of modes:
#+BEGIN_SRC emacs-lisp
(setq erc-track-position-in-mode-line 'before-modes)
#+END_SRC
I have a wide terminal, so I can also benefit from knowing how many
messages I've missed, mixed into a delicious [[www.catb.org/jargon/html/A/angry-fruit-salad.html][angry fruit salad]]:
#+BEGIN_SRC emacs-lisp
(setq erc-track-showcount t
erc-track-use-faces t)
#+END_SRC
The rooms I participate in are generally large, so it is not useful for me
to be notified of =JOIN=, =PART=, etc. Below, =333= and =353= (present in
the default) represent, respectively, notice of who set the channel topic
and the user listing.
#+BEGIN_SRC emacs-lisp
(setq erc-track-exclude-types
'("NICK" "JOIN" "PART" "QUIT" "333" "353"))
#+END_SRC
It is easy to ignore messages from the server by setting
=erc-track-exclude-server-buffer=, but I would like to be notified.
[fn:fencepost-tunnel] The =fencepost= proxy (a GNU server) is for privacy
and GNU recognition---Freenode states that it spoofs the IP Address, and it
provides a cloak in the form of =gateway/shell/gnu/x-*=. Other GNU hackers
on =fencepost= would be able to see my real IP (unless I =torify= it), but
that's okay. I used to have an FSF cloak until my Freenode account expired,
but I find this to be more appropriate.
[fn:server-name] =erc-autojoin-after-ident= in =er-join.el= considers
both =erc-server-announced-name= and =erc-session-server=, with the former
taking precedence. In my case, the former is ="foo.freenode.net"= (varies),
and the latter is ="localhost"=.
* Flood Protection
/Flooding/ occurs when too much text is send to a channel. Some channels
protect against this, some don't. The issue I am more concerned with is
whether flooding from myself is actually intentional.
For example, I have a lot going on in my terminal (everything except
graphical web browsing), and I will occasionally paste text into the wrong
buffer/window, or I will simply paste when that was not the intent (fat
fingers; mouse middle-click). I have also had situations in the past where
my children get to the mouse or keyboard.[fn:kids-paste]
ERC offers an "accidental paste threshold" that will signal an error if
lines are entered within N seconds of one-another. I set this to a
threshold that I think will be reasonable, and one that will definitely be
reached on paste.
#+BEGIN_SRC emacs-lisp
(setq erc-accidental-paste-threshold-seconds 1)
#+END_SRC
[fn:kids-paste] One incident was my son---one year old at the time---playing
with the mouse that had fallen under my desk. He caused a bunch of text in
the terminal to be selected, and then subsequently pasted into an IRC
channel.