Switch to Circe from rcirc

Seems like a more rich experience, and this also includes a quick way
for me to reconnect and get right back where I left off.
This commit is contained in:
Howard Abrams 2021-12-14 11:35:54 -08:00
parent a79a8651b0
commit 59d6f644c1

View file

@ -23,47 +23,92 @@ A literate programming configuration file for IRC communiction.
;;; Code: ;;; Code:
#+END_SRC #+END_SRC
* Introduction * Introduction
My IRC /needs/ are basic, so until I really start using Bitlbee heavily (see below), I connect to IRC servers using [[https://www.gnu.org/software/emacs/manual/html_node/rcirc/][rcirc]], see the [[info:rcirc][Info for rcirc]]. My IRC /needs/ are basic, but I'm not sure which I want to use.
** Circe
Basic configuration settings, include: 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.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package rcirc (use-package circe
:init :init
(setq rcirc-default-nick "howard-abrams" (setq circe-reduce-lurker-spam t
rcirc-enable-authinfo-support t lui-flyspell-p t
rcirc-enable-styles t circe-network-options
rcirc-enable-late-fix t '(("howardabrams.com"
rcirc-enable-emojify t :tls nil
rcirc-enable-erc-tweet t
rcirc-omit-responses '("JOIN" "PART" "QUIT" "NICK" "AWAY")
rcirc-server-alist '(("howardabrams.com"
:port 7777
:nick "howard-abrams" :nick "howard-abrams"
:full-name "Howard Abrams"))) :port 7777
:sasl-username "howard-abrams")))
:config :config
(rcirc-track-minor-mode 1)) ;; 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)))
#+END_SRC #+END_SRC
Note the following key-bindings: * ZNC Server
I'm using my own ZNC server, and I need to log in with a password stored in my GPG auth storage:
+ ~C-c C-o~ :: To ignore the unimportant JOIN/PART messages, do this for every channel #+BEGIN_SRC emacs-lisp
+ ~C-c C-l~ :: Lower the priority. Chatty, technical channels get this treatment. (defun ha-circe-reconnect-password ()
+ ~C-c TAB~ :: Ignore a channel's notification, do this for =#emacs= because it is always displayed. "Send the reconnection password string."
* IRC Servers (interactive)
Gotta jump into the new Libera. This shows how you can contact me, and what channels I like to visit.
#+BEGIN_SRC emacs-lisp :tangle no (let* ((auth-results (auth-source-search :host "howardabrams.com" :port 7777 :max 1))
(with-eval-after-load "rcirc" (auth-first (first auth-results))
(setq rcirc-server-alist '(("irc.libera.chat" (username (plist-get auth-first :user))
:nick "howard-abrams" (password (funcall (plist-get auth-first :secret))))
:full-name "Howard Abrams" (circe-command-QUOTE (format "PASS %s:%s" username password))))
:channels ("#emacs" #+END_SRC
"#evil-mode"
"#org-mode" But now we can call both the reconnect, as well as the password:
"#openstack-operators"
"#openstack-kolla" #+BEGIN_SRC emacs-lisp
"#openstack-ansible"))))) (defun ha-circe-reconnect ()
"Overlay interface to reconnect to my IRC server."
(interactive)
(circe-reconnect)
(sit-for 3)
(ha-circe-reconnect-password))
#+END_SRC
* Key Bindings
Quick way to start and jump to my IRC world.
#+BEGIN_SRC emacs-lisp
(defun ha-irc-persp-start ()
"Create an IRC workspace and start my IRC client."
(interactive)
(persp-switch "irc")
(circe "howardabrams.com"))
(defun ha-irc-persp-switch ()
"Switch to the IRC workspace and load the next buffer."
(interactive)
(persp-switch "irc")
(tracking-next-buffer))
#+END_SRC
And some global keys to display them:
#+BEGIN_SRC emacs-lisp
(ha-leader
"a i" '("irc switch" . ha-irc-persp-switch)
"a I" '("irc start" . ha-irc-persp-start))
#+END_SRC
Let's create a leader for this mode:
#+BEGIN_SRC emacs-lisp
(general-create-definer ha-circe-leader
:states '(normal visual motion)
:keymaps '(circe-channel-mode-map circe-server-mode-map)
:prefix "SPC m"
:global-prefix "<f17>"
:non-normal-prefix "M-SPC")
#+END_SRC
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))
#+END_SRC #+END_SRC
* Display Configuration * Display Configuration
Using the [[https://github.com/seagle0128/doom-modeline][Doom Modeline]] to add notifications: Using the [[https://github.com/seagle0128/doom-modeline][Doom Modeline]] to add notifications: