4 ms·
This is a killer feature of emacs and M-x shell for me. Now my command history is searchable, just like any other file or buffer I have open. I use the same i
by babs474 13y ago
This is a killer feature of emacs and M-x shell for me.
Now my command history is searchable, just like any other file or buffer I have open.
I use the same idea for any repl, R,python,ruby,node,clojure. Bash is just another repl.
The major advantage of the emacs buffer method is that a lot of tasks I do on the computer span many commands. I can search for one command I remember executing 3 months ago, and then review the series of steps I took before and after, along with the output.
Typically finding a single command I've executed before doesn't help a whole lot. I need context.
- jaredandrews 13y agoM-x shell is one of the first things I just show people when I introduce them to Emacs. I had a databases class a few years ago where the CLI program we used to interact with the database was a basically an input loop where you entered commands. It had absolutely no concept of history though so if you messed up a query you had to retype it or use the clunky copy and paste feature of whatever terminal emulator you were using. Emacs changed everything though be cause I could just kill my last command and paste it into the new prompt. I have since done this with many other commands and I love it.
- callmecosmas 13y agoI'm an emacs lover myself, but for that use-case it seems like all you need is rlwrap: http://utopia.knoware.nl/~hlub/rlwrap/#rlwrap http://utopia.knoware.nl/~hlub/rlwrap/#rlwrap
- spacemanaki 13y agoI've recently been using shells inside Emacs exclusively and not even starting Terminal.app any more. I've got a couple of tips for anyone doing this, based on my (limited) experience: 1) Try eshell which allows you to use Emacs Lisp for shell scripting, as well as override some common programs to use Emacs instead (grep, man, etc). I'm someone who has never really bothered to learn shell scripting and am much more comfortable using Lisp, even Emacs Lisp which is sort of the crummiest of the popular Lisps (don't get me wrong I love Emacs) Obviously YMMV and if you know shell scripting this is a non-issue, but for me it comes down to being constantly surprised by the little bit of shell scripting I've had to do, and having Emacs Lisp work basically the way I expect (dynamic scoping, Lisp-2 and all) 2) Both eshell and M-x shell are not actually terminal emulators, so anything that requires a terminal emulator, like pagers, git log (ok this is a bad example since you should just be using magit, but anyway...) or some programs that update the terminal with their status act totally goofy and sometimes just break altogether. In this case, you want term-mode, which is a proper terminal emulator. Be sure to read up on the different modes as otherwise you'll get stuck inside that buffer ;) http://www.gnu.org/software/emacs/manual/html_node/emacs/Term-Mode.html#Term-Mode http://www.gnu.org/software/emacs/manual/html_node/emacs/Ter... Hope this helps another Emacs novice... most of this I learned from here: http://www.masteringemacs.org/articles/2010/11/01/running-shells-in-emacs-overview/ http://www.masteringemacs.org/articles/2010/11/01/running-sh...