slack: various changes

Format the README and change the image
Fix alert config
use linum post config
other changes
This commit is contained in:
syl20bnr 2016-06-03 22:15:29 -04:00
parent 35f93610ed
commit 2262bbc568
4 changed files with 86 additions and 87 deletions

View File

@ -990,3 +990,8 @@ is nonempty."
(interactive)
(when compilation-last-buffer
(delete-windows-on compilation-last-buffer)))
(defun no-linum (&rest ignore)
"Disable linum if current buffer."
(when (or 'linum-mode global-linum-mode)
(linum-mode 0)))

View File

@ -1,58 +1,63 @@
#+TITLE: Slack layer
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../css/readtheorg.css" />
#+CAPTION: logo
# The maximum height of the logo should be 200 pixels.
[[img/slack.png]]
[[file:img/slack.png]]
* Table of Contents :TOC_4_org:noexport:
- [[Description][Description]]
- [[Install][Install]]
- [[Configuration][Configuration]]
- [[Key bindings][Key bindings]]
* Description
This layer provides an interface to the Slack chat service via the emacs-slack package. Where possible, this layer aims to reuse keybindings from the IRC packages in Spacemacs.
This layer provides an interface to the Slack chat service via the emacs-slack
package. Where possible, this layer aims to reuse keybindings from the IRC
packages in Spacemacs.
* Install
To use this contribution add it to your =~/.spacemacs=
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.
* 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.
To test that eveyrthing is alright put the following snippet in your
=dotspacemacs/user-config()= replacing =client-id=, =client-secret= and =token=
with your info.
*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.
#+begin_src emacs-lisp
(setq-default dotspacemacs-configuration-layers '(slack))
#+end_src
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.
Then, in your ~dotspacemacs/user-init()~ set the following:
#+begin_src emacs-lisp
(setq slack-enable-emoji t)
(slack-register-team
:name "emacs-slack"
:default t
:client-id "something"
:client-secret "secret!"
:client-id "my@email.address"
:client-secret "mypassword"
:token "token"
:subscribed-channels '(general slackbot)
)
:subscribed-channels '(general slackbot))
#+end_src
* Key bindings
| Key Binding | Description |
|---------------+--------------------------|
| ~<SPC> a C s~ | (Re)connects to Slack |
| ~<SPC> a C j~ | Join a channel |
| ~<SPC> a C d~ | Direct message someone |
| ~<SPC> m j~ | Join a channel |
| ~<SPC> m d~ | Direct message someone |
| ~<SPC> m p~ | Load previous messages |
| ~<SPC> m e~ | Edit message at point |
| ~<SPC> m q~ | Quit Slack |
| ~<SPC> m m~ | Embed mention of user |
| ~<SPC> m c~ | Embed mention of channel |
| Key Binding | Description |
|-------------+--------------------------|
| ~SPC a C s~ | (Re)connects to Slack |
| ~SPC a C j~ | Join a channel |
| ~SPC a C d~ | Direct message someone |
| ~SPC a C q~ | Close connection |
| ~SPC m j~ | Join a channel |
| ~SPC m d~ | Direct message someone |
| ~SPC m p~ | Load previous messages |
| ~SPC m e~ | Edit message at point |
| ~SPC m q~ | Quit Slack |
| ~SPC m m~ | Embed mention of user |
| ~SPC m c~ | Embed mention of channel |
The following bindings are provided to mimic bindings in the official Slack client.
The following bindings are provided to mimic bindings in the official Slack
client.
| Key Binding | Description |
|-------------+--------------------------|
@ -60,5 +65,5 @@ The following bindings are provided to mimic bindings in the official Slack clie
| ~<SPC> m @~ | Embed mention of user |
| ~<SPC> m #~ | Embed mention of channel |
In insert state, one can also use ~@~ and ~#~ directly without the leader key prefix.
In insert state, one can also use ~@~ and ~#~ directly without the leader key
prefix.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -13,19 +13,24 @@
;;; Code:
;; TODO: Integrate company-emoji.
(defconst slack-packages
'(
slack
alert
company
company-emoji
flyspell
emoji-cheat-sheet-plus
flyspell
linum
persp-mode
smooth-scrolling
slack
))
;; TODO: Integrate company-emoji.
(defun slack/init-alert ()
(use-package alert
:defer t
:init (setq alert-default-style 'notifier)))
(defun slack/post-init-emoji-cheat-sheet-plus ()
(add-hook 'slack-mode-hook 'emoji-cheat-sheet-plus-display-mode))
@ -33,54 +38,11 @@
(defun slack/post-init-flyspell ()
(add-hook 'lui-mode-hook 'flyspell-mode))
(defun alert/init-alert ()
(use-package alert
:commands (alert)
:init
(setq alert-default-style 'notifier)
))
(defun slack/init-slack ()
"Initialize Slack"
(use-package slack
:commands (slack-start)
:defer t
:init
(spacemacs/set-leader-keys
"aCs" 'slack-start
"aCj" 'slack-channel-select
"aCd" 'slack-im-select
"aCq" 'slack-ws-close
)
(defun no-linum (&rest ignore)
(when (or 'linum-mode global-linum-mode)
(linum-mode 0)))
(spacemacs/add-to-hooks 'no-linum '(
slack-hook
slack-mode-hook
))
(setq slack-enable-emoji t)
:config
(spacemacs/set-leader-keys-for-major-mode 'slack-mode
"j" 'slack-channel-select
"d" 'slack-im-select
"p" 'slack-room-load-prev-messages
"e" 'slack-message-edit
"q" 'slack-ws-close
"mm" 'slack-message-embed-mention
"mc" 'slack-message-embed-channel
"k" 'slack-channel-select
"@" 'slack-message-embed-mention
"#" 'slack-message-embed-channel
)
(evil-define-key 'insert slack-mode-map
(kbd "@") 'slack-message-embed-mention
(kbd "#") 'slack-message-embed-channel)
)
)
(defun slack/post-init-linum ()
(add-hook 'slack-mode-hook 'no-linum))
(defun slack/post-init-persp-mode ()
(spacemacs|define-custom-layout "@SLACK"
(spacemacs|define-custom-layout "@Slack"
:binding "s"
:body
(progn
@ -95,7 +57,34 @@
(push (lambda (b) (with-current-buffer b (eq major-mode 'slack-mode)))
persp-filter-save-buffers-functions)))
(defun slack/post-init-smooth-scrolling ()
(add-hook 'slack-mode-hook 'spacemacs//unset-scroll-margin))
(defun slack/init-slack ()
"Initialize Slack"
(use-package slack
:commands (slack-start)
:defer t
:init
(progn
(spacemacs/set-leader-keys
"aCs" 'slack-start
"aCj" 'slack-channel-select
"aCd" 'slack-im-select
"aCq" 'slack-ws-close)
(setq slack-enable-emoji t))
:config
(progn
(spacemacs/set-leader-keys-for-major-mode 'slack-mode
"j" 'slack-channel-select
"d" 'slack-im-select
"p" 'slack-room-load-prev-messages
"e" 'slack-message-edit
"q" 'slack-ws-close
"mm" 'slack-message-embed-mention
"mc" 'slack-message-embed-channel
"k" 'slack-channel-select
"@" 'slack-message-embed-mention
"#" 'slack-message-embed-channel)
(evil-define-key 'insert slack-mode-map
(kbd "@") 'slack-message-embed-mention
(kbd "#") 'slack-message-embed-channel))))
;;; packages.el ends here