This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+chat/slack/packages.el

94 lines
2.8 KiB
EmacsLisp
Raw Normal View History

2016-02-07 20:01:25 +00:00
;;; packages.el --- slack layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2020 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.
;;
;;; License: GPLv3
;; TODO: Integrate company-emoji.
2016-02-07 20:01:25 +00:00
(defconst slack-packages
'(
alert
emoji-cheat-sheet-plus
flyspell
linum
2016-02-07 20:01:25 +00:00
persp-mode
slack
window-purpose))
2016-02-07 20:01:25 +00:00
(defun slack/init-alert ()
(use-package alert
:defer t
: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))
(defun slack/post-init-linum ()
(add-hook 'slack-mode-hook 'spacemacs/no-linum))
2016-02-07 20:01:25 +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
(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
(defun slack/init-slack ()
"Initialize Slack"
(use-package slack
:commands (slack-start)
:defer t
:init
(spacemacs/declare-prefix "acs" "slack")
(spacemacs/set-leader-keys
"acss" 'slack-start
"acsj" 'slack-channel-select
"acsg" 'slack-group-select
"acsr" 'slack-select-rooms
"acsd" 'slack-im-select
"acsq" 'slack-ws-close)
(setq slack-enable-emoji t)
:config
(dolist (mode '(slack-mode slack-message-buffer-mode))
(spacemacs/set-leader-keys-for-major-mode mode
"j" 'slack-channel-select
"g" 'slack-group-select
"r" 'slack-select-rooms
"d" 'slack-im-select
"p" 'slack-room-load-prev-messages
"e" 'slack-message-edit
"t" 'slack-thread-show-or-create
"q" 'slack-ws-close
"mm" 'slack-message-embed-mention
"mc" 'slack-message-embed-channel
"k" 'slack-select-rooms
"@" 'slack-message-embed-mention
"#" 'slack-message-embed-channel
")" 'slack-message-add-reaction
"(" 'slack-message-remove-reaction))
(evil-define-key 'insert slack-mode-map
(kbd "@") 'slack-message-embed-mention
(kbd "#") 'slack-message-embed-channel)))
2016-02-07 20:01:25 +00:00
(defun slack/post-init-window-purpose ()
(purpose-set-extension-configuration
:slack-layer
(purpose-conf :mode-purposes '((slack-mode . chat)))))