summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2024-04-10 02:52:07 +0100
committerjao <jao@gnu.org>2024-04-10 02:52:07 +0100
commit9983927336798f141e18a9cba52c157f2de09a96 (patch)
treee94991f665c7f312d76aa932ae852e0719f7ad9d
parent2885a591bcedaef0d4ba89ce23910ec4ec9376d4 (diff)
downloadelibs-9983927336798f141e18a9cba52c157f2de09a96.tar.gz
elibs-9983927336798f141e18a9cba52c157f2de09a96.tar.bz2
using localslackirc
-rw-r--r--attic/elisp/misc.el51
-rw-r--r--init.el74
2 files changed, 67 insertions, 58 deletions
diff --git a/attic/elisp/misc.el b/attic/elisp/misc.el
index 4c398fe..6484310 100644
--- a/attic/elisp/misc.el
+++ b/attic/elisp/misc.el
@@ -841,6 +841,57 @@
("J" . pdf-view-scroll-up-or-next-page)
("k" . pdf-view-previous-line-or-previous-page)
("K" . pdf-view-scroll-down-or-previous-page))))
+;;; slack
+(eval-and-compile
+ (defvar jao-slack-dir (expand-file-name "emacs-slack" jao-local-lisp-dir)))
+
+(use-package slack
+ :commands (slack-start)
+ :vc t
+ :load-path jao-slack-dir
+ :init
+ (setq slack-alert-icon (jao-data-file "slack.svg")
+ slack-buffer-emojify nil
+ slack-buffer-create-on-notify t
+ slack-display-team-name t
+ slack-typing-visibility 'buffer ;; 'never, 'buffer, 'frame
+ slack-thread-also-send-to-room t
+ slack-profile-image-file-directory "/tmp/slack-imgs/"
+ slack-image-file-directory "/tmp/slack-imgs/"
+ slack-file-dir "~/var/download/slack/"
+ slack-prefer-current-team t
+ slack-message-tracking-faces '(warning)
+ slack-log-level 'warn
+ slack-message-custom-notifier (lambda (_msg room _team) room))
+ :bind (:map slack-mode-map (("@" . slack-message-embed-mention)
+ ("#" . slack-message-embed-channel))
+ :map slack-message-buffer-mode-map
+ (("C-c C-e" . slack-message-edit)
+ ("C-c C-a" . slack-file-upload)))
+ :hook ((slack-file-info-buffer-mode . view-mode))
+ :config
+
+ (defun my-slack-nobreak-mrkdwn ()
+ "Return non-nil (don't break line) if point is in markdown code face."
+ (seq-find (lambda (ov)
+ (eq 'slack-mrkdwn-code-block-face (overlay-get ov 'face)))
+ (overlays-at (point))))
+ (add-hook 'slack-message-buffer-mode-hook
+ (lambda ()
+ (add-hook 'fill-nobreak-predicate #'my-slack-nobreak-mrkdwn
+ nil 'local)))
+
+ (dolist (f (list slack-file-dir slack-image-file-directory))
+ (when (not (file-exists-p f)) (make-directory f)))
+
+ (jao-shorten-modes 'slack-message-buffer-mode
+ 'slack-thread-message-buffer-mode)
+ (jao-tracking-faces 'warning)
+ (jao-tracking-cleaner "logstash-\\([^-]+\\)-\\(.+\\)" "\\2-\\1")
+ (jao-tracking-cleaner
+ "^\\*Slack - .*? : \\(MPIM: \\)?\\([^ ]+\\)\\( \\(T\\)\\)?.*" "\\2\\4")
+ (jao-define-attached-buffer "\\*Slack .+ Edit Message [0-9].+" 20))
+
;;; snippets
(defun jao-org-notes-open-tags ()
"Search for a note file, matching all tags with completion."
diff --git a/init.el b/init.el
index cb29f7a..6b8c772 100644
--- a/init.el
+++ b/init.el
@@ -2449,9 +2449,10 @@
;;; Chats
;;;; circe
-(defvar jao-libera-channels '())
-(defvar jao-oftc-channels '())
-(defvar jao-bitlbee-channels '())
+(defvar jao-libera-channels ())
+(defvar jao-oftc-channels ())
+(defvar jao-bitlbee-channels ())
+(defvar jao-slack-channels ())
(use-package circe
:ensure t
@@ -2516,6 +2517,10 @@
(circe-display-server-message
(format "%d nicks in this channel" (jao-circe-nick-no))))
+ (defun circe-command-SENDFILE (line)
+ "/sendfile for localslackirc"
+ (circe-command-QUOTE (format "sendfile %s" line)))
+
(advice-add 'circe-command-NAMES :after #'circe-command-NNICKS)
(setq circe-network-options
@@ -2529,7 +2534,10 @@
(jao-with-auth "bitlbee" u p
(list "Bitlbee" :host "127.0.0.1" :nick u
:channels jao-bitlbee-channels :lagmon-disabled t
- :nickserv-password u :user p))))
+ :nickserv-password u :user p))
+ (list "localslack" :host "127.0.0.1" :nick "jao"
+ :channels jao-slack-channels :port 9007
+ :lagmon-disabled t)))
(jao-shorten-modes 'circe-channel-mode
'circe-server-mode
@@ -2539,57 +2547,6 @@
(enable-lui-track)
(circe-lagmon-mode))
-;;;; slack
-(eval-and-compile
- (defvar jao-slack-dir (expand-file-name "emacs-slack" jao-local-lisp-dir)))
-
-(use-package slack
- :commands (slack-start)
- :vc t
- :load-path jao-slack-dir
- :init
- (setq slack-alert-icon (jao-data-file "slack.svg")
- slack-buffer-emojify nil
- slack-buffer-create-on-notify t
- slack-display-team-name t
- slack-typing-visibility 'buffer ;; 'never, 'buffer, 'frame
- slack-thread-also-send-to-room t
- slack-profile-image-file-directory "/tmp/slack-imgs/"
- slack-image-file-directory "/tmp/slack-imgs/"
- slack-file-dir "~/var/download/slack/"
- slack-prefer-current-team t
- slack-message-tracking-faces '(warning)
- slack-log-level 'warn
- slack-message-custom-notifier (lambda (_msg room _team) room))
- :bind (:map slack-mode-map (("@" . slack-message-embed-mention)
- ("#" . slack-message-embed-channel))
- :map slack-message-buffer-mode-map
- (("C-c C-e" . slack-message-edit)
- ("C-c C-a" . slack-file-upload)))
- :hook ((slack-file-info-buffer-mode . view-mode))
- :config
-
- (defun my-slack-nobreak-mrkdwn ()
- "Return non-nil (don't break line) if point is in markdown code face."
- (seq-find (lambda (ov)
- (eq 'slack-mrkdwn-code-block-face (overlay-get ov 'face)))
- (overlays-at (point))))
- (add-hook 'slack-message-buffer-mode-hook
- (lambda ()
- (add-hook 'fill-nobreak-predicate #'my-slack-nobreak-mrkdwn
- nil 'local)))
-
- (dolist (f (list slack-file-dir slack-image-file-directory))
- (when (not (file-exists-p f)) (make-directory f)))
-
- (jao-shorten-modes 'slack-message-buffer-mode
- 'slack-thread-message-buffer-mode)
- (jao-tracking-faces 'warning)
- (jao-tracking-cleaner "logstash-\\([^-]+\\)-\\(.+\\)" "\\2-\\1")
- (jao-tracking-cleaner
- "^\\*Slack - .*? : \\(MPIM: \\)?\\([^ ]+\\)\\( \\(T\\)\\)?.*" "\\2\\4")
- (jao-define-attached-buffer "\\*Slack .+ Edit Message [0-9].+" 20))
-
;;;; telegram
(use-package telega
:ensure t
@@ -2687,8 +2644,6 @@
;;;; startup
(defun jao-chats (&optional p)
(interactive "P")
- (when (or p (y-or-n-p "Connect to slack? "))
- (slack-start))
(when (or p (y-or-n-p "Connect to telegram? "))
(telega))
(when (and (fboundp 'ement-connect) (or p (y-or-n-p "Connect to matrix? ")))
@@ -2698,7 +2653,10 @@
(mastodon))
(when (or p (y-or-n-p "Connect to libera? "))
(unless (get-buffer "irc.libera.chat:6697")
- (circe "Libera Chat"))))
+ (circe "Libera Chat")))
+ (when (or p (y-or-n-p "Connect to localslack? "))
+ (unless (get-buffer "127.0.0.1:9007")
+ (circe "localslack"))))
(defun jao-all-chats ()
(interactive)