Slack Emacs



I would love to be able to use Slack from within Emacs! In my search for a Slack client for Emacs, I came across an incomplete script by Kyle W T Sherman. To encourage collaboration on this project and help create a Slack client for Emacs, I've created this GitHub repo.

The Wiki has moved to new hardware, and the old server died.
Book Creator
Remove this page from your book

Table of Contents

What is Emacs?

  1. Slack client for Emacs Repository Emacs Emacs Lisp. Keywords tools, emacs, slack. Dependent repositories 0 Total tags 0 Latest tag about 13 hours ago.
  2. Slack is an IRC-style cloud-based messaging app for teams. Emacs-slack is a Slack client for emacs copy-as-format Copy buffer locations as GitHub / Slack /JIRA/ HipChat formatted code ox-slack Slack export backend for Emacs org-mode.

vi and its clones are very functionaland powerful editors. However, they are often considered notparticularly extensible. vim is asuccessful and powerfulvi variant that shrugs this trend,being both extremely extensible and lightweight. However, manyusers prefer a more “heavy” and extensible editor. This is whymany people (including the author of this chapter) preferEmacs.

Emacs takes extensibility up to eleven. Outside of a core of C,the rest of Emacs is written in aLisp variant, nearly all of which is exposed to you, so that youmay configure it or even extend it at will (many good Emacs Lisptutorials can be found on the Internet). People have writtenall sorts of extensions in Emacs Lisp, from syntax highlightingfor an obscure language, to a built-in terminal. In fact,there's even a vi emulation modewithin Emacs (called viper), so youcan still get the modal editing that comes with vi, while havingaccess to the power of the Emacscore.

Emacs Slack 使い方

Like vi, there are many variants ofEmacs (termed “emacsen”). However,the one most commonly used (and the only one in Slackware) isGNU Emacs. When people reference “Emacs” directly, they almostalways mean GNU Emacs.

Unlike vi,Emacs operates more like atraditional editor by default. This means that most keyboardshortcuts can be performed without repeatedly changing modes.You can open up a file and start typing away without having tolearn what the modes do, or forgetting which one you arecurrently using.

Starting Out

Emacs can be started simply byrunning the emacs command in yourterminal. Whenyou first start it in a console without arguments, you will seesomething that resembles this:

If you are in X windows, Emacs maystart a GUI instead of running in your console. If this is thecase and you don't want a GUI, you can invoke it with the flag'-nw'.

While here, you can browse around using thekeyboard arrow keys.Underlined elements are links, and you can activate them bymoving over them and pressing Enter. The documentationmentioned is very good, and can help you get your bearingsshould you have any problems. Also note how they describe keysequences such as Ctrl+H, meaning press thehkey while holding down the CTRL key. Same dealwith M-`, meaning to hold the theMeta key (usually Alt) andpress the backtick ` key. When they say (e.g.) Ctrl+XCtrl+C, this means to press the x key while holding downthe CTRL key, then press the x key while alsoholding down the CTRL key. Conveniently, thisis also one of the more important commands inEmacs: to close it.

Slack

Alternatively, if you call emacs with afile name as an argument, it will open that file, just likevi. Upon doing this, you will bepresented with the contents of the file in question. Here, you cannavigate the document using traditional arrow keys and type ininformation at will without any issues.

Say you make some edits, and you now want to save your file.The following key sequence will do that: Ctrl+XCtrl+S.If you made a new file, you will be prompted for this in what iscalled the “minibuffer”, the blank line below the gray line atthe bottom of the screen. Type in the file name of your choice,then hit Enter. If you don't want tosave the file, you can press Ctrl+G, which abortsoperations that ask for input. Do note that tab-completion isusually available for operations that use the minibuffer.

Should you want to open a new file within your sameEmacs session, type in Ctrl+XCtrl+F. You will be prompted for a file name in theminibuffer. Emacs doesn't carewhether it exists or not. If it doesn't exist, a new bufferwill be created for it (the file will be created upon savingwith Ctrl+XCtrl+S), or it will be opened asexpected. However, the old file will still be open! You canswitch back to it using Ctrl+XCtrl+B, entering inthe file's name (or more technically, the buffer's name), thenhitting Enter.

How to Move Around

Like vi,Emacs is also older than the arrowkeys on your keyboard. Also, like invi, using the arrow keys to navigatefiles is also supported. While thevi movement keys are more ergonomic,emacs's are more “mnemonic”.However, it is still very possible to operate using the mainEmacs keybindings quickly andefficiently. Here is a table of the basic movement keybindings:

Emacs Cursor Movement

CommandResult
Ctrl+FMove the cursor one character to the right (forward)
Ctrl+BMove the cursor one character to the left (backward)
Ctrl+NMove the cursor one line down (next)
Ctrl+PMove the cursor one line up (previous)

Of course, like with vi it is alsopossible to repeat these commands with a numeric argument. If youtype in M-1M-0Ctrl+P, or Ctrl+U 10Ctrl+P, the cursor will move ten lines up. If you type inM-5Ctrl+F or Ctrl+U 5 Ctrl+F, the cursorwill move five characters to the right.

Getting Help

Emacs contains a great deal ofdocumentation, to the point that it is often called a“self-documenting” editor. This is because it providesmechanisms for providing users with documentation while you areusing it.

Here are some useful functions that display documentation (theyall start with Ctrl+H):

Accessing Emacs Documentation

CommandResult
Ctrl+H f FUNCTION-NAME EnterShow documentation for function FUNCTION-NAME
Ctrl+H k Ctrl+XCtrl+CShow documentation for the function bound to the keysCtrl+XCtrl+C
Ctrl+H tShow the Emacs tutorial
Ctrl+H ?Show all help-related functions

Slack Osx App

Ctrl+Ht is especially useful if you want or need practice using Emacs.

Calling Functions

As noted earlier, Emacs exports alarge number of functions to for interactive use. Some ofthese, like those opening and saving files, are mapped to keys.Others (like the ones for moving to the beginning and end oflines) are not. To call them, you have to invoke them. Say wewant to call the function “end-of-line”. We would dothis:

M-x end-of-line Enter

And the cursor would move to the end of the line, as the function namesuggests.

Emacs Cheat Sheet

While Emacs can be simple to use, its scope can easily beoverwhelming. Below are some useful Emacs commands. Someaspects have been simplified, most notably regarding textselection. These concepts, and more, are described theEmacs manual, and various on-linetutorials. Decent summaries can also be gleaned from websearches.

Emacs Cheat Sheet

CommandResult
Ctrl+FMove the cursor one character to the right (forward)
Ctrl+BMove the cursor one character to the left (backward)
Ctrl+NMove the cursor one line down (next)
Ctrl+PMove the cursor one line up (previous)
Ctrl+Hf FUNCTION-NAME EnterShow documentation for function FUNCTION-NAME
Ctrl+HkCtrl+XCtrl+CShow documentation for the function bound to the keys Ctrl+XCtrl+C
Ctrl+HTShow the Emacs tutorial
Ctrl+H?Show all help-related functions
M-`Access the Menu Bar
Ctrl+GCancel the current operation. This is most useful when in the minibuffer.
M-X FUNCTION-NAME EnterCall the interactive function FUNCTION-NAME
M-1 M-0Ctrl+NMove the cursor ten lines down
Ctrl+U10Ctrl+NMove the cursor ten lines down (same as above)
M-x beginning-of-line Move the cursor to the beginning of the current line
M-x end-of-line Move the cursor to the end of the current line
M->Move the cursor to the end of the buffer
M-<Move the cursor to the beginning of the buffer
Ctrl+KRemove text from the cursor to the end of the line and place it into the kill ring
Ctrl+SpaceEnter selection mode (use normal motion keys to move around). Press C-space again to leave it.
Ctrl+WWhile in selection mode, delete the selected region, and store the result into the kill ring
M-WWhile in selection mode, store the selected region into the kill ring.
C-Y“Yanks” the contents of the kill ring and places them at the cursor's location
Ctrl+/Undo the previous action. Unlike most other editors, this includes previous undo actions.
InsertEnable or disable overwriting characters
Ctrl+S asdf EnterForward incremental search for the string “asdf”. Repeat Ctrl+S as needed to search for future items, or Ctrl+R (below) to search backwards.
Ctrl+R asdf EnterBackward incremental search for the string “asdf”. Repeat Ctrl+R as needed to search for future items, or Ctrl+S (above) to search forwards.
M-% old Enter new EnterSearch for each instance of “old” and prompt you to replace it with “new”. You can force replacement of all items by typing ! at the replacement prompt.
Ctrl+XCtrl+CExit Emacs, prompting you to save each unsaved buffer before doing so
Ctrl+XCtrl+SSave the currrent buffer to its file
Ctrl+XCtrl+W new-file.txt EnterSave the current buffer to a file “new-file.txt”
  • Originally written by Alan Hicks, Chris Lumens, David Cantrell, Logan Johnson