2016-02-07 20:01:25 +00:00
|
|
|
;;; packages.el --- slack layer packages file for Spacemacs.
|
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2016-02-07 20:01:25 +00:00
|
|
|
;;
|
|
|
|
;; Author: Kosta Harlan <kosta@kostaharlan.net>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2016-02-07 20:01:25 +00:00
|
|
|
|
2016-06-04 02:15:29 +00:00
|
|
|
;; TODO: Integrate company-emoji.
|
|
|
|
|
2016-02-07 20:01:25 +00:00
|
|
|
(defconst slack-packages
|
|
|
|
'(
|
|
|
|
alert
|
|
|
|
emoji-cheat-sheet-plus
|
2016-06-04 02:15:29 +00:00
|
|
|
flyspell
|
|
|
|
linum
|
2016-02-07 20:01:25 +00:00
|
|
|
persp-mode
|
2016-06-04 02:15:29 +00:00
|
|
|
slack
|
2020-06-27 20:55:36 +00:00
|
|
|
window-purpose))
|
2016-02-07 20:01:25 +00:00
|
|
|
|
2016-06-04 02:15:29 +00:00
|
|
|
(defun slack/init-alert ()
|
|
|
|
(use-package alert
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-06-04 02:15:29 +00:00
|
|
|
:init (setq alert-default-style 'notifier)))
|
2016-02-07 20:01:25 +00:00
|
|
|
|
|
|
|
(defun slack/post-init-emoji-cheat-sheet-plus ()
|
|
|
|
(add-hook 'slack-mode-hook 'emoji-cheat-sheet-plus-display-mode))
|
|
|
|
|
|
|
|
(defun slack/post-init-flyspell ()
|
|
|
|
(add-hook 'lui-mode-hook 'flyspell-mode))
|
|
|
|
|
2016-06-04 02:15:29 +00:00
|
|
|
(defun slack/post-init-linum ()
|
2016-10-09 16:57:46 +00:00
|
|
|
(add-hook 'slack-mode-hook 'spacemacs/no-linum))
|
2016-02-07 20:01:25 +00:00
|
|
|
|
2018-01-10 04:01:34 +00:00
|
|
|
(defun slack/pre-init-persp-mode ()
|
2016-02-07 20:01:25 +00:00
|
|
|
(spacemacs|use-package-add-hook persp-mode
|
|
|
|
:post-config
|
2018-01-10 04:01:34 +00:00
|
|
|
(progn
|
|
|
|
(add-to-list 'persp-filter-save-buffers-functions
|
|
|
|
'spacemacs//slack-persp-filter-save-buffers-function)
|
|
|
|
(spacemacs|define-custom-layout slack-spacemacs-layout-name
|
|
|
|
:binding slack-spacemacs-layout-binding
|
|
|
|
:body
|
|
|
|
(progn
|
|
|
|
(add-hook 'slack-mode #'spacemacs//slack-buffer-to-persp)
|
|
|
|
;; TODO: We don't want to slack-start every time someone types `SPC l o s`
|
|
|
|
(call-interactively 'slack-start)
|
|
|
|
(call-interactively 'slack-channel-select))))))
|
2016-02-07 20:01:25 +00:00
|
|
|
|
2016-06-04 02:15:29 +00:00
|
|
|
(defun slack/init-slack ()
|
|
|
|
"Initialize Slack"
|
|
|
|
(use-package slack
|
|
|
|
:commands (slack-start)
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-06-04 02:15:29 +00:00
|
|
|
:init
|
2020-06-28 21:25:04 +00:00
|
|
|
(spacemacs/declare-prefix "acs" "slack")
|
2020-02-25 22:30:47 +00:00
|
|
|
(spacemacs/set-leader-keys
|
2020-08-09 08:51:12 +00:00
|
|
|
"acsT" 'slack-all-threads
|
|
|
|
"acsd" 'slack-im-select
|
2020-06-28 21:25:04 +00:00
|
|
|
"acsg" 'slack-group-select
|
2020-08-09 08:51:12 +00:00
|
|
|
"acsj" 'slack-channel-select
|
|
|
|
"acsq" 'slack-ws-close
|
2020-06-28 21:25:04 +00:00
|
|
|
"acsr" 'slack-select-rooms
|
2020-08-09 08:51:12 +00:00
|
|
|
"acss" 'slack-start
|
|
|
|
"acsu" 'slack-all-unreads)
|
2020-02-25 22:30:47 +00:00
|
|
|
(setq slack-enable-emoji t)
|
2016-06-04 02:15:29 +00:00
|
|
|
:config
|
2020-07-19 16:23:32 +00:00
|
|
|
(dolist (mode '(slack-mode slack-message-buffer-mode slack-thread-message-buffer-mode))
|
2020-02-25 22:30:47 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
2020-08-09 08:51:12 +00:00
|
|
|
"#" 'slack-message-embed-channel
|
|
|
|
"(" 'slack-message-remove-reaction
|
|
|
|
")" 'slack-message-add-reaction
|
|
|
|
"@" 'slack-message-embed-mention
|
|
|
|
"T" 'slack-all-threads
|
2016-06-04 02:15:29 +00:00
|
|
|
"d" 'slack-im-select
|
|
|
|
"e" 'slack-message-edit
|
2020-08-09 08:51:12 +00:00
|
|
|
"g" 'slack-group-select
|
|
|
|
"j" 'slack-channel-select
|
2017-04-21 20:51:14 +00:00
|
|
|
"k" 'slack-select-rooms
|
2020-08-09 08:51:12 +00:00
|
|
|
"mc" 'slack-message-embed-channel
|
|
|
|
"mm" 'slack-message-embed-mention
|
|
|
|
"p" 'slack-room-load-prev-messages
|
|
|
|
"q" 'slack-ws-close
|
|
|
|
"r" 'slack-select-rooms
|
|
|
|
"t" 'slack-thread-show-or-create
|
|
|
|
"u" 'slack-all-unreads)
|
2020-07-19 16:23:32 +00:00
|
|
|
(let ((keymap (symbol-value (intern (concat (symbol-name mode) "-map")))))
|
|
|
|
(evil-define-key 'insert keymap
|
|
|
|
(kbd "#") 'slack-message-embed-channel
|
2020-08-09 08:51:12 +00:00
|
|
|
(kbd ":") 'slack-insert-emoji
|
|
|
|
(kbd "@") 'slack-message-embed-mention)))))
|
2016-02-07 20:01:25 +00:00
|
|
|
|
2020-06-27 20:55:36 +00:00
|
|
|
(defun slack/post-init-window-purpose ()
|
|
|
|
(purpose-set-extension-configuration
|
|
|
|
:slack-layer
|
|
|
|
(purpose-conf :mode-purposes '((slack-mode . chat)))))
|