[OS X Emacs] How to efficiently work with shells/term? drag & drop, history, several instances
Hofert Jan Marius
marius.hofert at math.ethz.ch
Thu Sep 22 07:33:37 EDT 2011
One of the reasons why I started to work with emacs [two weeks ago] is that one does not have to open ten different programs which open at least ten different windows.
If somehow possible, I now would like to work with shells/terminals started from within emacs [using the Mac's terminal would open another window... and has some other drawbacks].
There are some things I (as a newbie) don't understand and I am wondering if these
can be customized.
In the Mac terminal, I can...
(1) ... open several tabs, each running another shell
(2) ... use the up-arrow key and the down-arrow key for accessing
the history (does not require to type the command again)
(3) ... drag & drop to change the directory quite fast: Write "cd " in the
terminal, then select the folder you want to go to, click it and drag it to the terminal.
Let it drop there. Then you get "cd /Users/..." and can easily change the
Now to my (short) experience with Aquamacs:
(1) M-x shell opens a shell. However, doing M-x shell again doesn't
open a second shell... it jumps back to the first one. I find this
quite unintuitive but one gets used to that. I know I can get another
shell with C-u M-x shell. Still, I don't know why there is a second command required to do the very same thing. I put in "(setq shell-multiple-shells t)" in Preferences.el since I found it somewhere (I guess the emacswiki), but that did not change anything: M-x shell does not open a second shell.
(2) using the up-arrow in a (bash-)shell does not activate the
history, but puts the cursor before "_bash-3.2$" (at the "_"
position). I found out that C-<up> gives the history. Still, I find it
quite annoying that the cursor can move to the left of the prompt
"bash-3.2$" (in which situation might this be useful?). Going back to "bash-3.2$_" does not lead to a properly
working shell, one has to go to "bash-3.2$ _" in order for the
commands/completion etc. to work.
(3) One of my best friends, the "drag & drop" feature is not working
:-( I have no idea how I can efficiently change directories without
this feature. I do neither want to remember the directory path nor to
use <tab>-completion (since many directories start with the same
prefix [e.g., when they are automatically generated and
lexicographically sorted]). What's the fastest way to cd into a deeply nested folder?
I finally figured out that M-x solves problem (2). However, C-u M-x
term did not open a second term. How can I open a second term?
Still, (3) remains. And another problem appears with using term (instead of shell). I wanted to start R
from the terminal. I put in "R" (as I normally do in a shell) and obtained:
"Wrong type argument: characterp, return". Similar things happend for
other commands, like ls or ssh. Why?
More information about the MacOSX-Emacs