emacs, writing custom commands which use term-mode
- by valya
Hello,
I'm using Emacs and M-x term for a terminal. Since my typical workflow looks like this:
edit some code
C-x C-o to the terminal buffer (or C-x b term[Enter] or something)
press Up key to use the last command
press Enter to run it
C-x C-o to go back
I want to bind all of these (except the first step... maybe) to one command, I believe Emacs is awesome enough to do that :-)
So, a command must:
go to the buffer with terminal (maybe it shouldn't change any windows at all, maybe it should split the window vertially (if it weren't split already) and use the right sid)
run a last command what've been run there
go back to the last buffer/part of the screen
Thank you! I'm not really used to the Emacs scripting system, and I hope someone will help me and someone else will be able to use the answer to improve his workflow, since I believe this is a pretty common one
Examples of commands:
python manage.py test
python manage.py test stats
python solve.py # for project-euler puzzles :-)
the first and the second runs over a ssh (in a terminal) sometimes (I like developing with vagrant)
I understand that it's easy to bind the first and the third ones, but the second changes too often - I'd just like to "run last command"