diff options
author | Tom Willemse | 2015-12-18 01:09:53 +0100 |
---|---|---|
committer | Tom Willemse | 2015-12-18 01:09:53 +0100 |
commit | a5ee08bef3a587256bf5301788070dc1f8b4d8af (patch) | |
tree | b46c87a4485fb1334b8bc1344597f580893419df /emacs/.emacs.d/site-lisp/oni-eshell.el | |
parent | 61d65e27c874e214e5ec99a543ab3f9835c0dfdb (diff) | |
download | dotfiles-a5ee08bef3a587256bf5301788070dc1f8b4d8af.tar.gz dotfiles-a5ee08bef3a587256bf5301788070dc1f8b4d8af.zip |
Move raise-eshell to eshell library
Diffstat (limited to 'emacs/.emacs.d/site-lisp/oni-eshell.el')
-rw-r--r-- | emacs/.emacs.d/site-lisp/oni-eshell.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/emacs/.emacs.d/site-lisp/oni-eshell.el b/emacs/.emacs.d/site-lisp/oni-eshell.el index 988afd2..e40d893 100644 --- a/emacs/.emacs.d/site-lisp/oni-eshell.el +++ b/emacs/.emacs.d/site-lisp/oni-eshell.el @@ -62,6 +62,23 @@ directory in it." (signal (car err) (cdr err)))))) ;;;###autoload +(defun oni:raise-eshell () + "Start or switch back to `eshell'. + +Also change directories to current working directory." + (interactive) + (let ((dir (file-name-directory + (or (buffer-file-name) "~/"))) + (hasfile (not (eq (buffer-file-name) nil))) + (started (and (boundp 'eshell-buffer-name) eshell-buffer-name + (buffer-live-p (get-buffer eshell-buffer-name))))) + (eshell) + (when (and hasfile (eq eshell-process-list nil)) + (eshell/cd dir) + (when started + (eshell-reset))))) + +;;;###autoload (defun oni:set-keys-for-eshell () "Set some keybindings for `eshell'." (define-key eshell-mode-map (kbd "C-d") #'oni:eshell-C-d)) |