From a9d421dc004aa7baf0047ac95b4becb488c82d34 Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 19 May 2021 06:26:59 +0100 Subject: trying rcirc for a while --- exwm.org | 2 +- init.org | 155 ++++++++++++++++------------------------------ lib/eos/jao-minibuffer.el | 4 +- 3 files changed, 57 insertions(+), 104 deletions(-) diff --git a/exwm.org b/exwm.org index 2b57096..0373e57 100644 --- a/exwm.org +++ b/exwm.org @@ -477,7 +477,7 @@ "Chats" (("t" (jao-buffer-same-mode 'telega-chat-mode) "telgram buffers") ("s" (jao-buffer-same-mode 'slack-message-buffer-mode) "slack buffers") - ("i" (jao-buffer-same-mode 'circe-channel-mode) "irc channels")) + ("i" (jao-buffer-same-mode 'rcirc-mode) "irc channels")) "Looks" (;; ("T" jao-toggle-transparency "toggle transparency" ;; :toggle (jao-transparent-p) :color red) diff --git a/init.org b/init.org index c8b1c9a..e4424a1 100644 --- a/init.org +++ b/init.org @@ -658,8 +658,8 @@ (setq mode-line-position-column-format '(" %c") mode-line-position-line-format '(" %l,%c")) (setq mode-line-percent-position - '((circe-chat-target (:eval (format " [%d]" - (length (circe-channel-nicks))))) + '(;; (circe-chat-target (:eval (format " [%d]" + ;; (length (circe-channel-nicks))))) " %l" (:eval (format "/%d" (line-number-at-pos (point-max)))))) (line-number-mode -1) @@ -2686,102 +2686,55 @@ (jao-exec-in-vterm (format "ssh %s" h) (format "* %s *" h)))) #+end_src * Chats -*** Circe -***** General configuration - #+begin_src emacs-lisp - (defvar jao-irc-channels '()) - (use-package circe - :ensure t - :bind (:map circe-channel-mode-map - (("C-c C-a" . lui-track-jump-to-indicator))) - :init - (setq circe-default-realname "https://jao.io" - circe-default-part-message "" - circe-default-quit-message "" - circe-ignore-list nil - circe-server-coding-system '(undecided . undecided) - circe-server-killed-confirmation 'ask-and-kill-all - circe-server-auto-join-default-type :after-auth - circe-format-say "({nick}) {body}" - circe-format-self-say "(jao) {body}" - circe-new-buffer-behavior 'ignore - circe-new-buffer-behavior-ignore-auto-joins t - circe-nickserv-ghost-style 'after-auth - circe-prompt-string ": " - circe-completion-suffix ", " - circe-reduce-lurker-spam t - - circe-nick-next-function - (lambda (old) - (replace-regexp-in-string "-" "`" (circe-nick-next old))) - - circe-lagmon-mode-line-format-string "" ;; "%.0f " - circe-lagmon-mode-line-unknown-lag-string "" ;; "? " - circe-lagmon-timer-tick 120 - circe-lagmon-reconnect-interval 180 - - lui-max-buffer-size 30000 - lui-fill-column 80 - lui-time-stamp-position 'right - lui-time-stamp-format "%H:%M" - lui-flyspell-p nil - - lui-track-indicator 'fringe - lui-track-behavior 'before-tracking-next-buffer) - :config - (defvar jao-bitlbee-channels ()) - (setq circe-network-options - (let ((up (jao--get-user/password "freenode")) - (bup (jao--get-user/password "bitlbee"))) - `(("Freenode" :nick ,(car up) :channels ,jao-irc-channels - :tls t :sasl-username ,(car up) :sasl-password ,(cadr up)) - ("Bitlbee" - :host "127.0.0.1" :nick ,(car bup) - :channels ,jao-bitlbee-channels - :lagmon-disabled t - :nickserv-password ,(cadr bup) :user ,(car bup))))) - - (jao-shorten-modes 'circe-channel-mode - 'circe-server-mode - 'circe-query-mode) - - (circe-lagmon-mode) - (enable-circe-color-nicks) - (enable-circe-display-images) - (enable-lui-track)) - #+end_src -***** Commands (recover &co.) - #+begin_src emacs-lisp - (with-eval-after-load "circe" - (defun circe-command-NICKNO (&rest ignore) - (message "%s nicks" (length (circe-channel-nicks)))) - - (advice-add 'circe-command-NAMES :after #'circe-command-NICKNO) - - (defun circe-command-RECOVER (&rest ignore) - "Recover nick" - (let* ((fn (jao--get-user/password "freenode")) - (u (car fn)) - (p (cadr fn))) - (circe-command-MSG "nickserv" (format "IDENTIFY %s %s" u p)) - (circe-command-MSG "nickserv" (format "GHOST %s" u)) - (circe-command-MSG "nickserv" (format "RELEASE %s" u)) - (circe-command-NICK u)))) - #+end_src -***** Follow twitter/mastodon threads - #+begin_src emacs-lisp - (defun jao-twitter-find-ref () - (interactive) - (when-let (no (save-excursion - (move-end-of-line nil) - (when (re-search-backward - "\\[[0-9a-f]+->\\([0-9a-f]+\\)\\]" nil t) - (match-string-no-properties 1)))) - (push-mark (point)) - (re-search-backward (format "\\[%s[]-]" no)))) - (with-eval-after-load "circe" - (define-key circe-channel-mode-map "\C-c\C-p" 'jao-twitter-find-ref)) - #+end_src +*** rcirc + #+begin_src emacs-lisp + (use-package rcirc + :init + (setq rcirc-server-alist `(("irc.freenode.net" + :encryption tls + :port 6697 + :channels ,jao-irc-channels)) + rcirc-default-user-full-name "http://jao.io/" + rcirc-buffer-maximum-lines 1000 + rcirc-fill-column 82 + rcirc-fill-prefix " " + rcirc-time-format "%H:%M " + rcirc-kill-channel-buffers t + rcirc-response-formats + '(("PRIVMSG" . "(%N) %m") + ("NOTICE" . "-%N- %m") + ("ACTION" . "(... %N %m)") + ("COMMAND" . "%m") + ("ERROR" . "%fw!!! %m") + (t . "%fp*** %fs%n %r %m")) + rcirc-prompt ": " + rcirc-nick-completion-format "%s, " + rcirc-reconnect-delay 120 + rcirc-omit-responses + '("JOIN" "PART" "QUIT" "NICK" "AWAY" "MODE" "KEEPALIVE")) + :config + (let ((fn (jao--get-user/password "freenode")) + (btl (jao--get-user/password "bitlbee"))) + (setq rcirc-authinfo + `(("freenode" nickserv ,(nth 0 fn) ,(nth 1 fn)) + ("localhost" bitlbee ,(nth 0 btl) ,(nth 1 btl))))) + (jao-shorten-modes 'rcirc-mode) + + (define-minor-mode ncm-mode "" nil + (:eval (format " [%S]" + (length (rcirc-channel-nicks (rcirc-buffer-process) + rcirc-target))))) + + (defun jao-rcirc-track () + (dolist (b rcirc-activity) (tracking-add-buffer b)) + (jao-minibuffer-refresh)) + + (add-hook 'rcirc-update-activity-string-hook #'jao-rcirc-track) + (add-hook 'rcirc-mode-hook #'ncm-mode) + (add-hook 'rcirc-mode-hook #'rcirc-omit-mode) + + :diminish ((rcirc-omit-mode . ""))) + #+end_src *** Slack [[https://github.com/jackellenberger/emojme#finding-a-slack-token][How to get a token]]: It's easyish! Open and sign into the slack customization page, e.g. https://my.slack.com/customize, right @@ -2873,17 +2826,19 @@ ;; (when (and (not (signel-signal-cli-process)) ;; (or p (y-or-n-p "Start signel? "))) ;; (signel-start)) - (jao-circe p)) + ;; (jao-circe p) + (rcirc)) (pretty-hydra-define jao-hydra-chats (global-map "s-q" :color blue :quit-key "q") ("Connect" (("A" (jao-chats t) "all chats -y") ("a" jao-chats "all chats") ("S" slack-start "slack") - ("C" (jao-circe t) "circe -y") + ;; ("C" (jao-circe t) "circe -y") ("s-q" jao-hydra-chats/body nil)) "Go" (("c" (jao-buffer-same-mode 'circe-channel-mode) "circe buffer") + ("i" (jao-buffer-same-mode 'rcirc) "rcirc buffer") ("s" (jao-buffer-same-mode 'slack-message-buffer-mode) "slack buffer") ("t" (jao-buffer-same-mode 'telega-chat-mode) "telega buffer") ("T" telega "telega rooster")))) diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el index 0a9b391..52f3fcc 100644 --- a/lib/eos/jao-minibuffer.el +++ b/lib/eos/jao-minibuffer.el @@ -112,9 +112,7 @@ mode-line-buffer-identification) (w3m-current-title) (t "%b"))) - "%]" - (:propertize ,jao-minibuffer--circe face jao-themes-dimm) - " %*%+ " + "%] %*%+ " (:propertize mode-name face jao-themes-f00) (:propertize ("" minor-mode-alist (vc-mode vc-mode)) face jao-themes-f11) (:propertize (doc-view-doc-type -- cgit v1.2.3