2016-02-07 20:01:25 +00:00
#+TITLE : Slack layer
2019-05-02 21:49:30 +00:00
#+TAGS : chat|layer
2016-06-04 02:15:29 +00:00
[[file:img/slack.png ]]
2016-02-07 20:01:25 +00:00
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-05-22 14:16:12 +00:00
- [[#description ][Description ]]
2017-08-03 21:24:54 +00:00
- [[#features ][Features: ]]
2017-05-22 14:16:12 +00:00
- [[#install ][Install ]]
- [[#configuration ][Configuration ]]
- [[#spacemacs-layout-integration ][Spacemacs layout integration ]]
- [[#key-bindings ][Key bindings ]]
2016-02-07 20:01:25 +00:00
* Description
2016-06-04 02:15:29 +00:00
This layer provides an interface to the Slack chat service via the emacs-slack
2018-10-23 14:18:21 +00:00
package. Where possible, this layer aims to reuse key bindings from the IRC
2016-06-04 02:15:29 +00:00
packages in Spacemacs.
2016-02-07 20:01:25 +00:00
2017-08-03 21:24:54 +00:00
** Features:
2018-09-19 03:54:47 +00:00
- Real time messaging with [[https://github.com/ahyatt/emacs-websocket ][emacs-websocket ]]
- Connect to multiple slack instances
- Notifications with [[https://github.com/jwiegley/alert ][alert.el ]]
2017-08-03 21:24:54 +00:00
2016-02-07 20:01:25 +00:00
* Install
2016-06-04 02:15:29 +00:00
To use this configuration layer, add it to your =~/.spacemacs= . You will need to
add =slack= to the existing =dotspacemacs-configuration-layers= list in this
file.
2016-02-07 20:01:25 +00:00
2016-06-04 02:15:29 +00:00
* Configuration
Follow the instructions in the [[https://github.com/yuya373/emacs-slack/blob/master/README.md ][emacs-slack ]] package for obtaining your client ID,
client secret, and token.
2016-02-07 20:01:25 +00:00
2016-11-14 11:31:25 +00:00
To test that everything is alright put the following snippet in your
2016-06-04 02:15:29 +00:00
=dotspacemacs/user-config()= replacing =client-id= , =client-secret= and =token=
with your info.
2016-02-07 20:01:25 +00:00
2016-06-04 02:15:29 +00:00
*Important* Do not keep private data in your dotfile. You can put your private
stuff elsewhere (like Dropbox for instance) and load the file in your dotfile.
2016-02-07 20:01:25 +00:00
2018-09-19 03:54:47 +00:00
#+BEGIN_SRC emacs-lisp
(slack-register-team
:name "emacs-slack"
:default t
:client-id "my@email.address"
:client-secret "mypassword"
:token "token"
:subscribed-channels '(general slackbot))
#+END_SRC
2016-02-07 20:01:25 +00:00
2017-05-08 02:22:27 +00:00
** Spacemacs layout integration
2017-08-03 21:24:54 +00:00
A [[https://github.com/syl20bnr/spacemacs/blob/develop/doc/DOCUMENTATION.org#layouts-and-workspaces ][Spacemacs custom layout ]] is defined by the layer. The name and the key binding
2017-05-08 02:22:27 +00:00
for it can be customized with the following layer variables:
- =slack-spacemacs-layout-name= for the layout name,
- =slack-spacemacs-layout-binding= for the key binding.
By default the values are:
#+BEGIN_SRC emacs-lisp
2018-09-19 03:54:47 +00:00
(setq-default dotspacemacs-configuration-layers '(
(slack :variables slack-spacemacs-layout-name "@Slack"
slack-spacemacs-layout-binding "s")))
2017-05-08 02:22:27 +00:00
#+END_SRC
2016-02-07 20:01:25 +00:00
* Key bindings
2020-08-09 08:51:12 +00:00
| Key binding | Description |
|---------------+------------------------------------------|
| ~SPC a c s T~ | Show all threads followed in a workspace |
| ~SPC a c s d~ | Direct message someone |
| ~SPC a c s g~ | Join a group (private channel) |
| ~SPC a c s j~ | Join a channel |
| ~SPC a c s q~ | Close connection |
| ~SPC a c s r~ | Join a channel, group, or direct messge |
| ~SPC a c s s~ | (Re)connects to Slack |
| ~SPC a c s u~ | Show all unread in a workspace |
| ~SPC m (~ | Remove reaction (emoji) to a message |
| ~SPC m )~ | Add reaction (emoji) to a message |
| ~SPC m c~ | Embed mention of channel |
| ~SPC m d~ | Direct message someone |
| ~SPC m e~ | Edit message at point |
| ~SPC m j~ | Join a channel |
| ~SPC m m~ | Embed mention of user |
| ~SPC m p~ | Load previous messages |
| ~SPC m q~ | Quit Slack |
| ~SPC m t~ | Show or create thread |
2016-02-07 20:01:25 +00:00
2016-06-04 02:15:29 +00:00
The following bindings are provided to mimic bindings in the official Slack
client.
2016-02-07 20:01:25 +00:00
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-04-25 15:42:58 +00:00
|-------------+--------------------------|
| ~SPC m #~ | Embed mention of channel |
2017-05-28 13:03:08 +00:00
| ~SPC m )~ | Add a rection |
2020-08-09 08:51:12 +00:00
| ~SPC m :~ | Embed emoji |
| ~SPC m @~ | Embed mention of user |
2017-04-25 15:42:58 +00:00
| ~SPC m k~ | Join a channel |
2016-02-07 20:01:25 +00:00
2020-08-09 08:51:12 +00:00
In insert state, one can also use ~:~ , ~@~ , and ~#~ directly without the leader
key prefix.