I recently started to use Emacs as my main editor. There is one thing that bothers me: When I start Emacs in my shell it starts Emacs in a new window. I want it to start in the shell if it's called by the shell and in a new window when it's called from the workspace.
Can this be achieved by some configuration that I miss or is it any kind of lisp?
I'm using Manjaro with Xfce and fish-shell (http://fishshell.com/)
Regards, Robin
So there's the alias solution, but a pb I encounter is that I sometimes make emacs sleep with Ctrl-z and then I forget I have an emacs session launched so I use my alias once again and I end up with two emacs in the terminal, which annoys me. So I use a function which checks if an emacs is already running:
cemacs () {
if (ps|grep emacs); then
echo "Hey, emacs is already running";
fg %emacs
else
emacs -nw $@
fi
}
Shortcut
I defined a handy shortcut to revive a sleeping emacs:
bind -x '"\C-x\C-e":fg %emacs'
Emacs-server
So that's what I used for quite long, and it isn't perfect. I can not launch a normal emacs and then my function, unless if I use emacs server: http://wikemacs.org/index.php/Emacs_server
Just create an alias to emacsclient -t.
and shell-mode
But now, I much prefer to use a terminal inside emacs (it is so handy to move around the shell's buffer, to copy-paste without the mouse, to look for a string, to go to the beginning of the output, to manipulate files with dired,…).