So I'm finally grokking eshell and one feature I want is the following:
Suppose I'm looking at a buffer containing index.html which lives in ~/projects/hacking. I'd like to effortlessly switch to eshell and have it jump to this directory, so I'm ready to start entering commands.
If I had this feature in place, I could go from a file's buffer to a shell quickly and without futzing with changing directories. Using this example I was able to quickly write up a command that does exactly what the above description suggests:
;; Inspired by: http://www.emacswiki.org/emacs/EshellControlFromOtherBuffer (defun bs-eshell-switch-to-and-change-dir () "Switch to eshell and make sure we're in the directory the current buffer is in." (interactive) (let ((dir default-directory)) (let ((b (get-buffer eshell-buffer-name))) (unless b (eshell))) (display-buffer eshell-buffer-name t) (switch-to-buffer-other-window eshell-buffer-name) (end-of-buffer) (unless (equalp dir default-directory) (cd dir) (eshell-send-input) (end-of-buffer)))) (global-set-key (kbd "\C-c \C-s") 'bs-eshell-switch-to-and-change-dir)
From any buffer I can hit Control-c Control-s and bam! I'm now at a shell prompt ready type away.
Update: One of the comments below suggested shell-pop-el as a pre-existing implementation of the above concept. I'd definitely recommend using it over what I've got above.
Update: And try: shell-switcher, too!