summaryrefslogtreecommitdiffhomepage
path: root/attic/elisp
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 /attic/elisp
parent2885a591bcedaef0d4ba89ce23910ec4ec9376d4 (diff)
downloadelibs-9983927336798f141e18a9cba52c157f2de09a96.tar.gz
elibs-9983927336798f141e18a9cba52c157f2de09a96.tar.bz2
using localslackirc
Diffstat (limited to 'attic/elisp')
-rw-r--r--attic/elisp/misc.el51
1 files changed, 51 insertions, 0 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."