From a5ee08bef3a587256bf5301788070dc1f8b4d8af Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Fri, 18 Dec 2015 01:09:53 +0100 Subject: [PATCH] Move raise-eshell to eshell library --- emacs/.emacs.d/init.el | 18 +----------------- emacs/.emacs.d/site-lisp/oni-eshell.el | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index e41bc39..402fdb7 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -141,22 +141,6 @@ MODE1 is enabled and vice-versa." "Set the `disabled' property for each item in FUNCTIONS to nil." (mapc #'(lambda (f) (put f 'disabled nil)) functions)) -(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))))) - (defun oni:raise-scratch (&optional mode) "Show the *scratch* buffer. If called with a universal argument, ask the user which mode to @@ -950,7 +934,7 @@ If no direction is given, don't split." (global-set-key (kbd "") 'git-project-show-files) (global-set-key (kbd "") #'oni:reload-buffer) (global-set-key (kbd "") 'magit-status) -(global-set-key (kbd "") #'oni:raise-eshell) +(global-set-key (kbd "") 'oni:raise-eshell) (global-set-key (kbd "") 'oni:show-org-index) (global-set-key (kbd "") 'oni:scroll-up-or-next-page) (global-set-key (kbd "") 'oni:scroll-down-or-prev-page) 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 @@ -61,6 +61,23 @@ directory in it." (kill-buffer) (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'."