diff options
author | noa@gaiwan.org | 2024-06-13 19:39:48 +0000 |
---|---|---|
committer | noa@gaiwan.org | 2024-06-13 19:39:48 +0000 |
commit | f0f0227e1a3e255b6d660eda0c1e025ff0698910 (patch) | |
tree | 82294305b815eb27a003ae5306db7d18269220a4 /emacs | |
parent | e9dbccb8be10c51a53d9112850868e5a10887462 (diff) |
Reconfigure jabber.el configuration and add commentary
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/init.el | 63 |
1 files changed, 40 insertions, 23 deletions
diff --git a/emacs/init.el b/emacs/init.el index 2dbbcbd..db6d1fa 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -107,33 +107,50 @@ (dolist (command '(scroll-up-command scroll-down-command recenter-top-bottom other-window)) (advice-add command :after #'pulse-line)) +;;; Jabber -(use-package jabber - :ensure t - :init - (setq noa/jabber-activity-dont-show '("#tildetown%town@irc.hmm.st" - "#meta%tilde.chat@irc.hmm.st" - "hmm@conference.hmm.st")) - (defun noa/jabber-activity-show-p (jid) - "Return non-nil if JID should be hidden. +(use-package jabber :ensure t) + +;; I don't actually use xmpp as xmpp that much. But i do use it to connect to irc, and this package lets me do that. Unfortunately, it's not a particularly well-behaved package; by default it clobbers some keybindings and floods the echo area with unhelpful messages. + +(setopt jabber-account-list '(("noa@hmm.st"))) + +;; So now what we're going to do is get it to stop showing a bunch of channels in the mode line, because there will always be new activity and i want to drop in when i feel like it, and not always have a reminder of that fact. The defun below is copied from jabber-activity-show-p-default but with an extra condition plopped in. +(setopt jabber-activity-show-p #'noa/jabber-activity-show-p) +(defcustom noa/jabber-activity-dont-show + '("#tildetown%town@irc.hmm.st" + "#meta%tilde.chat@irc.hmm.st" + "hmm@conference.hmm.st") + "List of JIDs not to show in the modeline." + :group 'jabber-activity) +(defun noa/jabber-activity-show-p (jid) + "Return non-nil if JID should be hidden. A JID should be hidden when there is an invisible buffer for JID, when JID is not in `noa/jabber-activity-dont-show', and when JID is not in `jabber-activity-banned'." - (let ((buffer (jabber-activity-find-buffer-name jid))) - (and (buffer-live-p buffer) - (not (get-buffer-window buffer 'visible)) - (not (cl-dolist (entry jabber-activity-banned) - (when (string-match entry jid) - (cl-return t)))) - (not (cl-dolist (entry noa/jabber-activity-dont-show) - (when (string-match entry jid) - (cl-return t))))))) - :custom - (jabber-history-enabled t) - (jabber-account-list '(("noa@hmm.st"))) - (jabber-alert-message-function nil) - (jabber-keepalive-interval 60) - (jabber-activity-show-p #'noa/jabber-activity-show-p)) + (let ((buffer (jabber-activity-find-buffer-name jid))) + (and (buffer-live-p buffer) + (not (get-buffer-window buffer 'visible)) + (not (cl-dolist (entry jabber-activity-banned) + (when (string-match entry jid) + (cl-return t)))) + (not (cl-dolist (entry noa/jabber-activity-dont-show) + (when (string-match entry jid) + (cl-return t))))))) + +;; I'm on a laptop, so whenever i shut it i get disconnected. Jabber can query auth-source for my password, so automatically reconnecting is useful and doesn't need me to do anything. +(setopt jabber-auto-reconnect t) + +;; Because my xmpp server supports message history, i don't need to worry about exiting without seeing all messages, as they'll be there when i get back. +(setopt jabber-activity-query-unread nil) + +;; The default buffer names are a bit ugly to look at, so i change them to a similar format as eww. Which is still pretty ugly, welcome to emacs +(setopt jabber-chat-buffer-format "*%n | jabber*" + jabber-groupchat-buffer-format "*%n | jabber*") + +;; As alluded to above, jabber.el also has a terrible terrible habit of sending a message to the echo area for every change in online state of my contacts, and every single message in any channel. Obviously this gets very annoying, especially if i'm using the minibuffer at that time. Thank you to acdw for pointing me towards these helpful hooks to remove. +(remove-hook 'jabber-alert-muc-hooks #'jabber-muc-echo) +(remove-hook 'jabber-alert-presence-hooks #'jabber-presence-echo) (use-package nov :ensure t |