hamacs/ha-irc.org
Howard Abrams b5a82133ca Clarify the creative commons on tangled files
Do I really need the copyright symbol? I love how the proselint
insists that I use the unicode character (which unicoding all the
files sounds great to me).

What could go wrong there? :-D
2022-03-09 10:48:26 -08:00

4.6 KiB

IRC and Bitlbee Interface

A literate programming configuration file for IRC communiction.

Introduction

My IRC needs are basic, but I'm not sure which I want to use.

Circe

The circe project (see the old site) looks intriguing, and is still supported. See the wiki documentation, but it has good defaults.

  (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))

    (require 'circe-color-nicks)
    (enable-circe-color-nicks))

ZNC Server

I'm using my own ZNC server, and I need to log in with a password stored in my GPG auth storage:

  (defun ha-circe-reconnect-password ()
    "Send the reconnection password string."
    (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))))
      (circe-command-QUOTE (format "PASS %s:%s" username password))))

But now we can call both the reconnect, as well as the password:

  (defun ha-circe-reconnect ()
    "Overlay interface to reconnect to my IRC server."
    (interactive)
    (circe-reconnect)
    (sit-for 3)
    (ha-circe-reconnect-password))

Key Bindings

Quick way to start and jump to my IRC world.

  (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))

And some global keys to display them:

(ha-leader
  "a i" '("irc switch" . ha-irc-persp-switch)
  "a I" '("irc start"  . ha-irc-persp-start))

Let's create a leader for this mode:

  (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 "S-SPC")

And a quick shortcut to call it:

  (ha-circe-leader
   "o" '("next channel" . tracking-next-buffer)
   "r" '("reconnect" . ha-circe-reconnect)
   "p" '("send password" . ha-circe-reconnect-password))

Display Configuration

Using the Doom Modeline to add notifications:

(setq doom-modeline-irc t)
(setq doom-modeline-irc-stylize 'identity)