Move eshell-C-d to eshell library

This commit is contained in:
Tom Willemse 2015-12-17 01:24:36 +01:00
parent 40b26e86cf
commit ea35825e1d
2 changed files with 18 additions and 15 deletions

View file

@ -148,16 +148,6 @@ MODE1 is enabled and vice-versa."
"Set the `disabled' property for each item in FUNCTIONS to nil." "Set the `disabled' property for each item in FUNCTIONS to nil."
(mapc #'(lambda (f) (put f 'disabled nil)) functions)) (mapc #'(lambda (f) (put f 'disabled nil)) functions))
(defun oni:eshell-C-d ()
"Either call `delete-char' interactively or quit."
(interactive)
(condition-case err
(call-interactively #'delete-char)
(error (if (and (eq (car err) 'end-of-buffer)
(looking-back eshell-prompt-regexp nil))
(kill-buffer)
(signal (car err) (cdr err))))))
(defun oni:level (lst) (defun oni:level (lst)
"Reduce a 2-level list LST to a flat list." "Reduce a 2-level list LST to a flat list."
(let ((lsts (mapcar (lambda (l) (if (listp l) l (list l))) lst))) (let ((lsts (mapcar (lambda (l) (if (listp l) l (list l))) lst)))
@ -459,10 +449,6 @@ insert at the end of the region and at the beginning."
"Set some keybindings for `dired'." "Set some keybindings for `dired'."
(local-set-key (kbd "E") #'wdired-change-to-wdired-mode)) (local-set-key (kbd "E") #'wdired-change-to-wdired-mode))
(defun oni:set-keys-for-eshell ()
"Set some keybindings for `eshell'."
(local-set-key (kbd "C-d") #'oni:eshell-C-d))
(defun oni:set-keys-for-hy () (defun oni:set-keys-for-hy ()
"Set some keybindings for `hy-mode'." "Set some keybindings for `hy-mode'."
(local-set-key (kbd "{") #'paredit-open-curly) (local-set-key (kbd "{") #'paredit-open-curly)
@ -1042,7 +1028,7 @@ If no direction is given, don't split."
#'paredit-mode #'eldoc-mode #'oni:set-emacs-lisp-keys) #'paredit-mode #'eldoc-mode #'oni:set-emacs-lisp-keys)
(oni:add-hooks 'eshell-mode-hook (oni:add-hooks 'eshell-mode-hook
#'buffer-disable-undo #'oni:set-keys-for-eshell #'buffer-disable-undo 'oni:set-keys-for-eshell
#'eshell-fringe-status-mode) #'eshell-fringe-status-mode)
(oni:add-hooks 'gnus-summary-mode-hook (oni:add-hooks 'gnus-summary-mode-hook

View file

@ -25,6 +25,7 @@
;;; Code: ;;; Code:
(require 'em-dirs) (require 'em-dirs)
(require 'em-prompt)
;;;###autoload ;;;###autoload
(defun eshell/cdp () (defun eshell/cdp ()
@ -49,5 +50,21 @@ directory in it."
'action (lambda (button) 'action (lambda (button)
(browse-url (button-label button))))))) (browse-url (button-label button)))))))
;;;###autoload
(defun oni:eshell-C-d ()
"Either call `delete-char' interactively or quit."
(interactive)
(condition-case err
(call-interactively #'delete-char)
(error (if (and (eq (car err) 'end-of-buffer)
(looking-back eshell-prompt-regexp nil))
(kill-buffer)
(signal (car err) (cdr err))))))
;;;###autoload
(defun oni:set-keys-for-eshell ()
"Set some keybindings for `eshell'."
(define-key eshell-mode-map (kbd "C-d") #'oni:eshell-C-d))
(provide 'oni-eshell) (provide 'oni-eshell)
;;; oni-eshell.el ends here ;;; oni-eshell.el ends here