2016-11-02 11:47:56 +01:00
|
|
|
#+TITLE: Eshell configuration
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(require 'eshell)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Truncate the eshell buffer when it gets larger than
|
2016-11-04 12:36:41 +01:00
|
|
|
=eshell-buffer-maximum-lines= number of lines. For some reason I have
|
|
|
|
to use the =eshell-load-hook= instead of just relying on ~eshell.el~
|
|
|
|
and ~esh-mode.el~ being loaded because it seems that
|
|
|
|
=with-eval-after-load= loads this file before ~eshell.el~ is actually
|
|
|
|
loaded.
|
2016-11-02 11:47:56 +01:00
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2016-11-04 12:36:41 +01:00
|
|
|
(defun oni:enable-truncating-eshell-buffers ()
|
|
|
|
(add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer))
|
|
|
|
|
|
|
|
(add-hook 'eshell-load-hook #'oni:enable-truncating-eshell-buffers)
|
2016-11-02 11:47:56 +01:00
|
|
|
#+END_SRC
|
2016-11-04 12:52:49 +01:00
|
|
|
|
|
|
|
Show the status of each command in the fringe of the eshell buffer.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(add-hook 'eshell-mode-hook 'eshell-fringe-status-mode)
|
|
|
|
#+END_SRC
|
2016-11-04 13:08:16 +01:00
|
|
|
|
|
|
|
Close the buffer when C-d is pressed and we're at the end of the
|
|
|
|
buffer.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(defun oni:eshell-C-d ()
|
|
|
|
"Call `delete-char' or close the buffer if it fails."
|
|
|
|
(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:set-eshell-C-d ()
|
|
|
|
(define-key eshell-mode-map (kbd "C-d") #'oni:eshell-C-d))
|
|
|
|
|
|
|
|
(add-hook 'eshell-load-hook #'oni:set-eshell-C-d)
|
|
|
|
#+END_SRC
|