Move raise-eshell to eshell library

This commit is contained in:
Tom Willemse 2015-12-18 01:09:53 +01:00
parent 61d65e27c8
commit a5ee08bef3
2 changed files with 18 additions and 17 deletions

View file

@ -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 "<f10>") 'git-project-show-files)
(global-set-key (kbd "<f5>") #'oni:reload-buffer)
(global-set-key (kbd "<f7>") 'magit-status)
(global-set-key (kbd "<f8>") #'oni:raise-eshell)
(global-set-key (kbd "<f8>") 'oni:raise-eshell)
(global-set-key (kbd "<hiragana>") 'oni:show-org-index)
(global-set-key (kbd "<next>") 'oni:scroll-up-or-next-page)
(global-set-key (kbd "<prior>") 'oni:scroll-down-or-prev-page)

View file

@ -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'."