From 6ff1921d7a75909e78faeaeb32de3c3742fd051f Mon Sep 17 00:00:00 2001 From: noa Date: Tue, 17 Sep 2024 09:57:58 +0800 Subject: Remove jabber.el xmpp configuration --- emacs/init.el | 74 ----------------------------------------------------------- 1 file changed, 74 deletions(-) (limited to 'emacs/init.el') diff --git a/emacs/init.el b/emacs/init.el index fd66e79..7f5b899 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -262,80 +262,6 @@ (global-unset-key (kbd "S-")) (global-set-key (kbd "S-") 'mouse-save-then-kill) -;;; Xmpp -;; Jabber.el is an xmpp client in emacs. 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. - -;; (package-ensure 'jabber) -(require 'jabber) -(setopt jabber-account-list '(("noa@noa.pub"))) - -;; 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. - -(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)))))))(setopt jabber-activity-show-p #'noa/jabber-activity-show-p) - -;; Because i have a lot of irc channels shown, a lot of the jids are quite long and ugly. Mostly i know what irc server a channel belongs to, so i want to cut off the parts after the percentage symbol. - -;; I might want to look at the jabber-jid-username function which seems to do this. - -(defun noa/jabber-activity-make-string (jid) - "Return the nick of the JID. - If no nick is available, return the user name part of the JID. In - private MUC conversations, return the user's nickname." - (if (jabber-muc-sender-p jid) - (jabber-jid-resource jid) - (let ((nick (jabber-jid-displayname jid)) - (user (jabber-jid-user jid)) - (username (jabber-jid-username jid))) - (if (and username (string= nick user)) - username - nick)))) -(setopt jabber-activity-make-string #'noa/jabber-activity-make-string) - -;; 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 annoying fast, 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) - -;; Also stop jabber from clobbering the dired-jump binding and instead use something on C-c like a good child. - -(with-eval-after-load 'jabber - (keymap-global-set "C-x C-j" #'dired-jump)) - -;; Finally, have a binding to jump to a buffer in which there's been some new activity. Better than always using switch-to-buffer to get there. - -(keymap-global-set "C-c C-j" #'jabber-activity-switch-to) - ;;; Writing prose ;; The majority of the work i do in emacs is writing documents, so it's nice to know that the words coming out of my fingers are the ones i expect them to be. -- cgit 1.4.1-2-gfad0