I no longer use IRC at all really
This commit is contained in:
parent
d2100c3b3f
commit
ae995ad221
295
config.org
295
config.org
|
@ -5809,301 +5809,6 @@ panel.
|
|||
(select-window main-window))))
|
||||
#+end_src
|
||||
|
||||
** IRC
|
||||
|
||||
#+call: confpkg()
|
||||
|
||||
=circe= is a client for IRC in Emacs (hey, isn't that a nice project
|
||||
name+acronym), and a greek enchantress who turned humans into animals.
|
||||
|
||||
Let's use the former to chat to +recluses+ discerning individuals online.
|
||||
|
||||
[[xkcd:1782]]
|
||||
|
||||
Before we start seeing and sending messages, we need to authenticate with our
|
||||
IRC servers. The circe manual provided a snippet for putting some of the auth
|
||||
details in =.authinfo.gpg= --- but I think we should go further than that: have
|
||||
the entire server info in our authinfo.
|
||||
|
||||
First, a reasonable format by which we can specify:
|
||||
+ server
|
||||
+ port
|
||||
+ SASL username
|
||||
+ SASL password
|
||||
+ channels to join
|
||||
|
||||
We can have these stored like so
|
||||
#+begin_src authinfo
|
||||
machine chat.freenode.net login USERNAME password PASSWORD port PORT for irc channels emacs,org-mode
|
||||
#+end_src
|
||||
|
||||
The ~for irc~ bit is used so we can uniquely identify all IRC auth info. By
|
||||
omitting the =#= in channel names we can have a list of channels comma-separated
|
||||
(no space!) which the secrets API will return as a single string.
|
||||
|
||||
#+name: irc-authinfo-reader
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(defun auth-server-pass (server)
|
||||
(if-let ((secret (plist-get (car (auth-source-search :host server)) :secret)))
|
||||
(if (functionp secret)
|
||||
(funcall secret) secret)
|
||||
(error "Could not fetch password for host %s" server)))
|
||||
|
||||
(defun register-irc-auths ()
|
||||
(require 'circe)
|
||||
(require 'dash)
|
||||
(let ((accounts (-filter (lambda (a) (string= "irc" (plist-get a :for)))
|
||||
(auth-source-search :require '(:for) :max 10))))
|
||||
(appendq! circe-network-options
|
||||
(mapcar (lambda (entry)
|
||||
(let* ((host (plist-get entry :host))
|
||||
(label (or (plist-get entry :label) host))
|
||||
(ports (mapcar #'string-to-number
|
||||
(s-split "," (plist-get entry :port))))
|
||||
(port (if (= 1 (length ports)) (car ports) ports))
|
||||
(user (plist-get entry :user))
|
||||
(nick (or (plist-get entry :nick) user))
|
||||
(channels (mapcar (lambda (c) (concat "#" c))
|
||||
(s-split "," (plist-get entry :channels)))))
|
||||
`(,label
|
||||
:host ,host :port ,port :nick ,nick
|
||||
:sasl-username ,user :sasl-password auth-server-pass
|
||||
:channels ,channels)))
|
||||
accounts))))
|
||||
#+end_src
|
||||
|
||||
We'll just call src_elisp{(register-irc-auths)} on a hook when we start Circe
|
||||
up.
|
||||
|
||||
Now we're ready to go, let's actually wire-up Circe, with one or two
|
||||
configuration tweaks.
|
||||
#+begin_src emacs-lisp :noweb no-export
|
||||
(after! circe
|
||||
(setq-default circe-use-tls t)
|
||||
(setq circe-notifications-alert-icon "/usr/share/icons/breeze/actions/24/network-connect.svg"
|
||||
lui-logging-directory (expand-file-name "irc" doom-etc-dir)
|
||||
lui-logging-file-format "{buffer}/%Y/%m-%d.txt"
|
||||
circe-format-self-say "{nick:+13s} ┃ {body}")
|
||||
|
||||
(custom-set-faces!
|
||||
'(circe-my-message-face :weight unspecified))
|
||||
|
||||
(enable-lui-logging-globally)
|
||||
(enable-circe-display-images)
|
||||
|
||||
<<org-emph-to-irc>>
|
||||
|
||||
<<circe-emojis>>
|
||||
<<circe-emoji-alists>>
|
||||
|
||||
(defun named-circe-prompt ()
|
||||
(lui-set-prompt
|
||||
(concat (propertize (format "%13s > " (circe-nick))
|
||||
'face 'circe-prompt-face)
|
||||
"")))
|
||||
(add-hook 'circe-chat-mode-hook #'named-circe-prompt)
|
||||
|
||||
(appendq! nerd-icons-mode-icon-alist
|
||||
'((circe-channel-mode nerd-icons-mdicon "nf-md-message" :face nerd-icons-lblue)
|
||||
(circe-server-mode nerd-icons-mdicon "nf-md-chat_outline" :face nerd-icons-purple))))
|
||||
|
||||
<<irc-authinfo-reader>>
|
||||
|
||||
(add-transient-hook! #'=irc (register-irc-auths))
|
||||
#+end_src
|
||||
|
||||
*** Org-style emphasis
|
||||
|
||||
Let's do our *bold*, /italic/, and _underline_ in org-syntax, using IRC control characters.
|
||||
#+name: org-emph-to-irc
|
||||
#+begin_src emacs-lisp
|
||||
(defun lui-org-to-irc ()
|
||||
"Examine a buffer with simple org-mode formatting, and converts the empasis:
|
||||
,*bold*, /italic/, and _underline_ to IRC semi-standard escape codes.
|
||||
=code= is converted to inverse (highlighted) text."
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "\\_<\\(?1:[*/_=]\\)\\(?2:[^[:space:]]\\(?:.*?[^[:space:]]\\)?\\)\\1\\_>" nil t)
|
||||
(replace-match
|
||||
(concat (pcase (match-string 1)
|
||||
("*" "")
|
||||
("/" "")
|
||||
("_" "")
|
||||
("=" ""))
|
||||
(match-string 2)
|
||||
"") nil nil)))
|
||||
|
||||
(add-hook 'lui-pre-input-hook #'lui-org-to-irc)
|
||||
#+end_src
|
||||
|
||||
*** Emojis
|
||||
|
||||
Let's setup Circe to use some emojis
|
||||
#+name: circe-emojis
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(defun lui-ascii-to-emoji ()
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "\\( \\)?::?\\([^[:space:]:]+\\):\\( \\)?" nil t)
|
||||
(replace-match
|
||||
(concat
|
||||
(match-string 1)
|
||||
(or (cdr (assoc (match-string 2) lui-emojis-alist))
|
||||
(concat ":" (match-string 2) ":"))
|
||||
(match-string 3))
|
||||
nil nil)))
|
||||
|
||||
(defun lui-emoticon-to-emoji ()
|
||||
(dolist (emoticon lui-emoticons-alist)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward (concat " " (car emoticon) "\\( \\)?") nil t)
|
||||
(replace-match (concat " "
|
||||
(cdr (assoc (cdr emoticon) lui-emojis-alist))
|
||||
(match-string 1))))))
|
||||
|
||||
(define-minor-mode lui-emojify
|
||||
"Replace :emojis: and ;) emoticons with unicode emoji chars."
|
||||
:global t
|
||||
:init-value t
|
||||
(if lui-emojify
|
||||
(add-hook! lui-pre-input #'lui-ascii-to-emoji #'lui-emoticon-to-emoji)
|
||||
(remove-hook! lui-pre-input #'lui-ascii-to-emoji #'lui-emoticon-to-emoji)))
|
||||
#+end_src
|
||||
|
||||
Now, some actual emojis to use.
|
||||
#+name: circe-emoji-alists
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(defvar lui-emojis-alist
|
||||
'(("grinning" . "😀")
|
||||
("smiley" . "😃")
|
||||
("smile" . "😄")
|
||||
("grin" . "😁")
|
||||
("laughing" . "😆")
|
||||
("sweat_smile" . "😅")
|
||||
("joy" . "😂")
|
||||
("rofl" . "🤣")
|
||||
("relaxed" . "☺️")
|
||||
("blush" . "😊")
|
||||
("innocent" . "😇")
|
||||
("slight_smile" . "🙂")
|
||||
("upside_down" . "🙃")
|
||||
("wink" . "😉")
|
||||
("relieved" . "😌")
|
||||
("heart_eyes" . "😍")
|
||||
("yum" . "😋")
|
||||
("stuck_out_tongue" . "😛")
|
||||
("stuck_out_tongue_closed_eyes" . "😝")
|
||||
("stuck_out_tongue_wink" . "😜")
|
||||
("zanzy" . "🤪")
|
||||
("raised_eyebrow" . "🤨")
|
||||
("monocle" . "🧐")
|
||||
("nerd" . "🤓")
|
||||
("cool" . "😎")
|
||||
("star_struck" . "🤩")
|
||||
("party" . "🥳")
|
||||
("smirk" . "😏")
|
||||
("unamused" . "😒")
|
||||
("disapointed" . "😞")
|
||||
("pensive" . "😔")
|
||||
("worried" . "😟")
|
||||
("confused" . "😕")
|
||||
("slight_frown" . "🙁")
|
||||
("frown" . "☹️")
|
||||
("persevere" . "😣")
|
||||
("confounded" . "😖")
|
||||
("tired" . "😫")
|
||||
("weary" . "😩")
|
||||
("pleading" . "🥺")
|
||||
("tear" . "😢")
|
||||
("cry" . "😢")
|
||||
("sob" . "😭")
|
||||
("triumph" . "😤")
|
||||
("angry" . "😠")
|
||||
("rage" . "😡")
|
||||
("exploding_head" . "🤯")
|
||||
("flushed" . "😳")
|
||||
("hot" . "🥵")
|
||||
("cold" . "🥶")
|
||||
("scream" . "😱")
|
||||
("fearful" . "😨")
|
||||
("disapointed" . "😰")
|
||||
("relieved" . "😥")
|
||||
("sweat" . "😓")
|
||||
("thinking" . "🤔")
|
||||
("shush" . "🤫")
|
||||
("liar" . "🤥")
|
||||
("blank_face" . "😶")
|
||||
("neutral" . "😐")
|
||||
("expressionless" . "😑")
|
||||
("grimace" . "😬")
|
||||
("rolling_eyes" . "🙄")
|
||||
("hushed" . "😯")
|
||||
("frowning" . "😦")
|
||||
("anguished" . "😧")
|
||||
("wow" . "😮")
|
||||
("astonished" . "😲")
|
||||
("sleeping" . "😴")
|
||||
("drooling" . "🤤")
|
||||
("sleepy" . "😪")
|
||||
("dizzy" . "😵")
|
||||
("zipper_mouth" . "🤐")
|
||||
("woozy" . "🥴")
|
||||
("sick" . "🤢")
|
||||
("vomiting" . "🤮")
|
||||
("sneeze" . "🤧")
|
||||
("mask" . "😷")
|
||||
("bandaged_head" . "🤕")
|
||||
("money_face" . "🤑")
|
||||
("cowboy" . "🤠")
|
||||
("imp" . "😈")
|
||||
("ghost" . "👻")
|
||||
("alien" . "👽")
|
||||
("robot" . "🤖")
|
||||
("clap" . "👏")
|
||||
("thumpup" . "👍")
|
||||
("+1" . "👍")
|
||||
("thumbdown" . "👎")
|
||||
("-1" . "👎")
|
||||
("ok" . "👌")
|
||||
("pinch" . "🤏")
|
||||
("left" . "👈")
|
||||
("right" . "👉")
|
||||
("down" . "👇")
|
||||
("wave" . "👋")
|
||||
("pray" . "🙏")
|
||||
("eyes" . "👀")
|
||||
("brain" . "🧠")
|
||||
("facepalm" . "🤦")
|
||||
("tada" . "🎉")
|
||||
("fire" . "🔥")
|
||||
("flying_money" . "💸")
|
||||
("lighbulb" . "💡")
|
||||
("heart" . "❤️")
|
||||
("sparkling_heart" . "💖")
|
||||
("heartbreak" . "💔")
|
||||
("100" . "💯")))
|
||||
|
||||
(defvar lui-emoticons-alist
|
||||
'((":)" . "slight_smile")
|
||||
(";)" . "wink")
|
||||
(":D" . "smile")
|
||||
("=D" . "grin")
|
||||
("xD" . "laughing")
|
||||
(";(" . "joy")
|
||||
(":P" . "stuck_out_tongue")
|
||||
(";D" . "stuck_out_tongue_wink")
|
||||
("xP" . "stuck_out_tongue_closed_eyes")
|
||||
(":(" . "slight_frown")
|
||||
(";(" . "cry")
|
||||
(";'(" . "sob")
|
||||
(">:(" . "angry")
|
||||
(">>:(" . "rage")
|
||||
(":o" . "wow")
|
||||
(":O" . "astonished")
|
||||
(":/" . "confused")
|
||||
(":-/" . "thinking")
|
||||
(":|" . "neutral")
|
||||
(":-|" . "expressionless")))
|
||||
#+end_src
|
||||
|
||||
** Newsfeed
|
||||
|
||||
#+call: confpkg()
|
||||
|
|
Loading…
Reference in New Issue