Convert to ERC from Circe
The PART suppression, the colored nick support, and the ability to fill the buffer window with the messages got me to convert.
This commit is contained in:
parent
13e77080fb
commit
d216ba8149
1 changed files with 63 additions and 42 deletions
105
ha-irc.org
105
ha-irc.org
|
@ -26,33 +26,64 @@ A literate programming configuration file for IRC communiction.
|
|||
#+END_SRC
|
||||
* Introduction
|
||||
My IRC /needs/ are basic, but I'm not sure which I want to use.
|
||||
** Circe
|
||||
The [[https://github.com/emacs-circe/circe][circe project]] (see the [[http://www.nongnu.org/circe/][old site]]) looks intriguing, and is still supported. See the [[https://github.com/emacs-circe/circe/wiki][wiki documentation]], but it has good defaults.
|
||||
|
||||
** ERC
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package circe
|
||||
:init
|
||||
(setq circe-reduce-lurker-spam t
|
||||
lui-flyspell-p t
|
||||
circe-network-options
|
||||
'(("howardabrams.com"
|
||||
:tls nil
|
||||
:nick "howard-abrams"
|
||||
:port 7777
|
||||
:sasl-username "howard-abrams")))
|
||||
:config
|
||||
;; Trick to ignore the PART and QUIT messages:
|
||||
(circe-set-display-handler "PART" (lambda (&rest ignored) nil))
|
||||
(circe-set-display-handler "QUIT" (lambda (&rest ignored) nil))
|
||||
(use-package erc-hl-nicks
|
||||
:after erc)
|
||||
|
||||
(require 'circe-color-nicks)
|
||||
(enable-circe-color-nicks))
|
||||
(use-package erc-image
|
||||
:after erc)
|
||||
|
||||
(use-package erc
|
||||
:commands erc
|
||||
:config
|
||||
(setq
|
||||
erc-nick "howard-abrams"
|
||||
erc-user-full-name "Howard Abrams"
|
||||
erc-prompt ">>"
|
||||
erc-prompt-for-nickserv-password nil
|
||||
erc-auto-query 'bury
|
||||
erc-join-buffer 'bury
|
||||
erc-interpret-mirc-color t
|
||||
erc-rename-buffers t
|
||||
erc-hide-list '("JOIN" "PART" "QUIT")
|
||||
erc-track-enable-keybindings nil
|
||||
erc-track-visibility nil ; Only use the selected frame for visibility
|
||||
erc-fill-column 120
|
||||
erc-fill-function 'erc-fill-static
|
||||
erc-fill-static-center 20
|
||||
erc-autojoin-channels-alist '(("howardabrams.com" "#emacs" "#org-mode"))
|
||||
erc-quit-reason (lambda (s) (or s "Fading out..."))
|
||||
erc-modules
|
||||
'(autoaway autojoin button completion fill irccontrols keep-place
|
||||
list match menu move-to-prompt netsplit networks noncommands
|
||||
readonly ring stamp track hl-nicks)))
|
||||
|
||||
(defun ha-erc-connect-irc ()
|
||||
"Connect to my favorite IRC server with ERC."
|
||||
(interactive)
|
||||
(let* ((auth-results (auth-source-search :host "howardabrams.com" :port 7777 :max 1))
|
||||
(auth-first (first auth-results))
|
||||
(username (plist-get auth-first :user))
|
||||
(password (funcall (plist-get auth-first :secret))))
|
||||
(erc :server "howardabrams.com" :port 7777)
|
||||
(sit-for 1)
|
||||
(erc-cmd-QUOTE (format "PASS %s:%s" username password))))
|
||||
#+END_SRC
|
||||
|
||||
I like to make sure the text formats to the size of the window:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ha-erc-resize-text ()
|
||||
"Resize the ERC text to fill the current window."
|
||||
(interactive)
|
||||
(setq erc-fill-column (1- (window-width))))
|
||||
#+END_SRC
|
||||
|
||||
* ZNC Server
|
||||
I'm using my own ZNC server, and I need to log in with a password stored in my GPG auth storage:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ha-circe-reconnect-password ()
|
||||
(defun ha-erc-reconnect-password ()
|
||||
"Send the reconnection password string."
|
||||
(interactive)
|
||||
|
||||
|
@ -60,18 +91,7 @@ I'm using my own ZNC server, and I need to log in with a password stored in my G
|
|||
(auth-first (first auth-results))
|
||||
(username (plist-get auth-first :user))
|
||||
(password (funcall (plist-get auth-first :secret))))
|
||||
(circe-command-QUOTE (format "PASS %s:%s" username password))))
|
||||
#+END_SRC
|
||||
|
||||
But now we can call both the reconnect, as well as the password:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ha-circe-reconnect ()
|
||||
"Overlay interface to reconnect to my IRC server."
|
||||
(interactive)
|
||||
(circe-reconnect)
|
||||
(sit-for 3)
|
||||
(ha-circe-reconnect-password))
|
||||
(erc-cmd-QUOTE (format "PASS %s:%s" username password))))
|
||||
#+END_SRC
|
||||
|
||||
* Key Bindings
|
||||
|
@ -81,13 +101,13 @@ Quick way to start and jump to my IRC world.
|
|||
"Create an IRC workspace and start my IRC client."
|
||||
(interactive)
|
||||
(persp-switch "irc")
|
||||
(circe "howardabrams.com"))
|
||||
(ha-erc-connect-irc))
|
||||
|
||||
(defun ha-irc-persp-switch ()
|
||||
"Switch to the IRC workspace and load the next buffer."
|
||||
(interactive)
|
||||
(persp-switch "irc")
|
||||
(tracking-next-buffer))
|
||||
(call-interactively 'erc-track-switch-buffer))
|
||||
#+END_SRC
|
||||
|
||||
And some global keys to display them:
|
||||
|
@ -99,9 +119,9 @@ And some global keys to display them:
|
|||
|
||||
Let's create a leader for this mode:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(general-create-definer ha-circe-leader
|
||||
(general-create-definer ha-irc-leader
|
||||
:states '(normal visual motion)
|
||||
:keymaps '(circe-channel-mode-map circe-server-mode-map)
|
||||
:keymaps '(erc-mode-map)
|
||||
:prefix "SPC m"
|
||||
:global-prefix "<f17>"
|
||||
:non-normal-prefix "S-SPC")
|
||||
|
@ -109,16 +129,17 @@ Let's create a leader for this mode:
|
|||
|
||||
And a quick shortcut to call it:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(ha-circe-leader
|
||||
"o" '("next channel" . tracking-next-buffer)
|
||||
"r" '("reconnect" . ha-circe-reconnect)
|
||||
"p" '("send password" . ha-circe-reconnect-password))
|
||||
(ha-irc-leader
|
||||
"o" '("next channel" . erc-track-switch-buffer)
|
||||
"w" '("resize text" . ha-erc-resize-text)
|
||||
"r" '("reconnect" . ha-erc-connect-irc)
|
||||
"p" '("send password" . ha-erc-reconnect-password))
|
||||
#+END_SRC
|
||||
* Display Configuration
|
||||
Using the [[https://github.com/seagle0128/doom-modeline][Doom Modeline]] to add notifications:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq doom-modeline-irc t)
|
||||
(setq doom-modeline-irc-stylize 'identity)
|
||||
(setq doom-modeline-irc t
|
||||
doom-modeline-irc-stylize 'identity)
|
||||
#+END_SRC
|
||||
* Technical Artifacts :noexport:
|
||||
This will =provide= a code name, so that we can =require= this.
|
||||
|
|
Loading…
Reference in a new issue