summaryrefslogtreecommitdiff
path: root/public/emacs-shells.html
diff options
context:
space:
mode:
Diffstat (limited to 'public/emacs-shells.html')
-rw-r--r--public/emacs-shells.html46
1 files changed, 46 insertions, 0 deletions
diff --git a/public/emacs-shells.html b/public/emacs-shells.html
new file mode 100644
index 0000000..a168d0a
--- /dev/null
+++ b/public/emacs-shells.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>A summary of Emacs' bundled shell and terminal modes — Luke Shumaker</title>
+ <link rel="stylesheet" href="assets/style.css">
+ <link rel="alternate" type="application/atom+xml" href="./index.atom" name="web log entries"/>
+</head>
+<body>
+<header><a href="/">Luke Shumaker</a> » <a href=/blog>blog</a> » emacs-shells</header>
+<article>
+<h1 id="a-summary-of-emacs-bundled-shell-and-terminal-modes">A summary of Emacs' bundled shell and terminal modes</h1>
+<p>This is based on a post on <a href="http://www.reddit.com/r/emacs/comments/1bzl8b/how_can_i_get_a_dumbersimpler_shell_in_emacs/c9blzyb">reddit</a>, published on 2013-04-09.</p>
+<p>Emacs comes bundled with a few different shell and terminal modes. It can be hard to keep them straight. What's the difference between <code>M-x term</code> and <code>M-x ansi-term</code>?</p>
+<p>Here's a good breakdown of the different bundled shells and terminals for Emacs, from dumbest to most Emacs-y.</p>
+<h2 id="term-mode">term-mode</h2>
+<p>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 <code>$SHELL</code> (<code>/bin/bash</code> for me). There are two modes of operation:</p>
+<ul>
+<li>char mode: Keys are sent immediately to the shell (including keys that are normally Emacs keystrokes), with the following exceptions:</li>
+<li><code>(term-escape-char) (term-escape-char)</code> sends <code>(term-escape-char)</code> to the shell (see above for what the default value is).</li>
+<li><code>(term-escape-char) &lt;anything-else&gt;</code> is like doing equates to <code>C-x &lt;anything-else&gt;</code> in normal Emacs.</li>
+<li><code>(term-escape-char) C-j</code> switches to line mode.</li>
+<li>line mode: Editing is done like in a normal Emacs buffer, <code>&lt;enter&gt;</code> sends the current line to the shell. This is useful for working with a program's output.</li>
+<li><code>C-c C-k</code> switches to char mode.</li>
+</ul>
+<p>This mode is activated with</p>
+<pre><code>; Creates or switches to an existing &quot;*terminal*&quot; buffer.
+; The default &#39;term-escape-char&#39; is &quot;C-c&quot;
+M-x term</code></pre>
+<p>or</p>
+<pre><code>; Creates a new &quot;*ansi-term*&quot; or &quot;*ansi-term*&lt;n&gt;&quot; buffer.
+; The default &#39;term-escape-char&#39; is &quot;C-c&quot; and &quot;C-x&quot;
+M-x ansi-term</code></pre>
+<h2 id="shell-mode">shell-mode</h2>
+<p>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; <code>M-p</code> and <code>M-n</code> access the history, while arrows/<code>C-p</code>/<code>C-n</code> 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 <code>ls</code>). 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:</p>
+<pre><code>M-x shell</code></pre>
+<h2 id="eshell-mode">eshell-mode</h2>
+<p>This is a shell+terminal, entirely written in Emacs lisp. (Interestingly, it doesn't set <code>$SHELL</code>, so that will be whatever it was when you launched Emacs). This won't even be running zsh or bash, it will be running &quot;esh&quot;, part of Emacs.</p>
+
+</article>
+<footer>
+<p>The content of this page is Copyright © 2013 <a href="mailto:lukeshu@sbcglobal.net">Luke Shumaker</a>.</p>
+<p>This page is licensed under the <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA-3.0</a> license.</p>
+</footer>
+</body>
+</html>