summaryrefslogtreecommitdiff
path: root/public/emacs-shells.md
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-10-12 13:47:42 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-10-12 13:47:42 -0400
commit6a42c8de66e3b2dc7293ddeadaa3ee396db2624d (patch)
tree67a027b892d3122662526504dd6d11e8dea02ca1 /public/emacs-shells.md
initial commit
Diffstat (limited to 'public/emacs-shells.md')
-rw-r--r--public/emacs-shells.md63
1 files changed, 63 insertions, 0 deletions
diff --git a/public/emacs-shells.md b/public/emacs-shells.md
new file mode 100644
index 0000000..fdd5bcb
--- /dev/null
+++ b/public/emacs-shells.md
@@ -0,0 +1,63 @@
+A summary of Emacs' bundled shell and terminal modes
+====================================================
+:copyright 2013 Luke Shumaker
+
+This is based on a post on [reddit][1], published on 2013-04-09.
+
+[1]: http://www.reddit.com/r/emacs/comments/1bzl8b/how_can_i_get_a_dumbersimpler_shell_in_emacs/c9blzyb
+
+Emacs comes bundled with a few different shell and terminal modes. It
+can be hard to keep them straight. What's the difference between
+`M-x term` and `M-x ansi-term`?
+
+Here's a good breakdown of the different bundled shells and terminals
+for Emacs, from dumbest to most Emacs-y
+
+**term-mode**: Your VT100-esque terminal emulator; it does what most
+terminal programs do. Ncurses-things work OK, but dumping large
+amounts of text can be slow. By default it asks you which shell to
+run, defaulting to the environmental variable `$SHELL` (`/bin/bash` for
+me). There are two modes of operation:
+
+* char mode: Keys are sent immediately to the shell (including keys
+ that are normally Emacs keystrokes), with the following exceptions:
+ * `(term-escape-char) (term-escape-char)` sends `(term-escape-char)`
+ to the shell (see above for what the default value is).
+ * `(term-escape-char) <anything-else>` is like doing equates to `C-x
+ <anything-else>` in normal Emacs.
+ * `(term-escape-char) C-j` switches to line mode.
+* line mode: Editing is done like in a normal Emacs buffer, `<enter>`
+ sends the current line to the shell. This is useful for working with
+ a program's output.
+ * `C-c C-k` switches to char mode.
+
+This mode is activated with
+
+ ; Creates or switches to an existing "*terminal*" buffer.
+ ; The default 'term-escape-char' is "C-c"
+ M-x term
+
+or
+
+ ; Creates a new "*ansi-term*" or "*ansi-term*<n>" buffer.
+ ; The default 'term-escape-char' is "C-c" and "C-f"
+ M-x ansi-term
+
+**shell-mode**: The name is a misnomer; shell-mode is a terminal
+emulator, not a shell; it's called that because it is used for running
+a shell (bash/zsh...). The idea of this mode is to use an external
+shell, but make it Emacs-y. History is not handled by the shell, but
+by Emacs; `M-p` and `M-n` access the history, while arrows/`C-p`/`C-n`
+move the point (which is is consistent with other Emacs REPL-type
+interfaces). It ignores VT100-type terminal colors, and colorizes
+things itself (it inspects words to see if they are directories, in
+the case of `ls`). This has the benefit that it does syntax
+highlighting on the currently being typed command. Ncurses programs
+will of course not work. This mode is activated with:
+
+ M-x shell
+
+**eshell-mode**: This is a shell+terminal, entirely written in Emacs
+lisp. (Interestingly, it doesn't set `$SHELL`, so that will be whatever
+it was when you launched Emacs). This won't even be running zsh or
+bash, it will be running "esh", part of Emacs.