aboutsummaryrefslogtreecommitdiffstats
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Tom Willemse2018-07-16 20:25:42 -0700
committerGravatar Tom Willemse2018-07-16 20:25:42 -0700
commit34eb203919ed05cf1cb0f4e405bcee4870872277 (patch)
treef8d99ee0beb348911a9bf55f0a1ac5ac53d699cf /emacs
parent2cc7412dfaf1369db021358d32b32c1ea345d51e (diff)
downloadnew-dotfiles-34eb203919ed05cf1cb0f4e405bcee4870872277.tar.gz
new-dotfiles-34eb203919ed05cf1cb0f4e405bcee4870872277.zip
Move eshell config to separate file
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init/oni-eshell-init.el54
-rw-r--r--emacs/.emacs.d/init/oni-eshell-init.org46
2 files changed, 54 insertions, 46 deletions
diff --git a/emacs/.emacs.d/init/oni-eshell-init.el b/emacs/.emacs.d/init/oni-eshell-init.el
new file mode 100644
index 0000000..bae1acb
--- /dev/null
+++ b/emacs/.emacs.d/init/oni-eshell-init.el
@@ -0,0 +1,54 @@
+;;; oni-eshell-init.el --- Eshell config -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Tom Willemse
+
+;; Author: Tom Willemse <tom@ryuslash.org>
+;; Keywords: local
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; My Eshell configuration.
+
+;;; Code:
+
+(require 'eshell)
+(require 'em-prompt)
+
+(defun oni-eshell-init-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-eshell-init-enable-truncating-buffers ()
+ "Add `eshell-truncate-buffer' to `eshell-output-filter-functions'."
+ (add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer))
+
+(add-hook 'eshell-load-hook #'oni-eshell-init-enable-truncating-buffers)
+(add-hook 'eshell-mode-hook 'eshell-fringe-status-mode)
+
+(defun oni:set-eshell-C-d ()
+ "Set `C-d' to quit eshell if used at end of prompt."
+ (define-key eshell-mode-map (kbd "C-d") #'oni-eshell-init-C-d))
+
+(add-hook 'eshell-first-time-mode-hook #'oni:set-eshell-C-d)
+
+(provide 'oni-eshell-init)
+;;; oni-eshell-init.el ends here
diff --git a/emacs/.emacs.d/init/oni-eshell-init.org b/emacs/.emacs.d/init/oni-eshell-init.org
deleted file mode 100644
index b3c6391..0000000
--- a/emacs/.emacs.d/init/oni-eshell-init.org
+++ /dev/null
@@ -1,46 +0,0 @@
-#+TITLE: Eshell configuration
-
-#+BEGIN_SRC emacs-lisp
- (require 'eshell)
- (require 'em-prompt)
-#+END_SRC
-
-Truncate the eshell buffer when it gets larger than
-=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.
-
-#+BEGIN_SRC emacs-lisp
- (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)
-#+END_SRC
-
-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
-
-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-first-time-mode-hook #'oni:set-eshell-C-d)
-#+END_SRC