diff options
author | Raul Benencia <rul@kalgan.cc> | 2021-04-22 19:14:04 -0700 |
---|---|---|
committer | Raul Benencia <rul@kalgan.cc> | 2021-04-22 19:14:04 -0700 |
commit | f3ea34cd68db234286862360969f40b0b981e72d (patch) | |
tree | 76b32ae7e0382c0314f849db6a54c4282bcb21ff | |
parent | 860ec4b07729023479e9734bbbcaf6a907266313 (diff) |
emacs: clean eshell
-rw-r--r-- | .emacs | 8 | ||||
-rw-r--r-- | .emacs.local.d/modes/eshell.el | 85 |
2 files changed, 0 insertions, 93 deletions
@@ -1,9 +1,5 @@ ;; Load up the general config -;; Added by Package.el. This must come before configurations of -;; installed packages. Don't delete this line. If you don't want it, -;; just comment it out by adding a semicolon to the start of the line. -;; You may delete these explanatory comments. (package-initialize) (load-file "~/.emacs.local.d/general.el") @@ -14,7 +10,6 @@ (load-file "~/.emacs.local.d/modes/company.el") (load-file "~/.emacs.local.d/modes/dashboard.el") (load-file "~/.emacs.local.d/modes/doom-modeline.el") -(load-file "~/.emacs.local.d/modes/eshell.el") (load-file "~/.emacs.local.d/modes/flyspell.el") (load-file "~/.emacs.local.d/modes/go-lang.el") (load-file "~/.emacs.local.d/modes/ibuffer.el") @@ -42,7 +37,4 @@ (load-file "~/.emacs.local.d/modes/themes.el") -;; Extra Debian packages: elpa-yaml-mode -;; Extra packages to install from Elpa: puppet-mode - (provide '.emacs) diff --git a/.emacs.local.d/modes/eshell.el b/.emacs.local.d/modes/eshell.el deleted file mode 100644 index c9be093..0000000 --- a/.emacs.local.d/modes/eshell.el +++ /dev/null @@ -1,85 +0,0 @@ -(setq eshell-history-size 512) -(setq eshell-prompt-regexp "^.*> ") - -(require 'em-hist) ; So the history vars are defined -(if (boundp 'eshell-save-history-on-exit) - (setq eshell-save-history-on-exit t)) ; Don't ask, just save -(if (boundp 'eshell-ask-to-save-history) - (setq eshell-ask-to-save-history 'always)) ; For older(?) version - -(defun eshell/ef (fname-regexp &optional dir) - (ef fname-regexp (or dir default-directory))) - - -;;; ---- path manipulation - -(defun pwd-repl-home (pwd) - (interactive) - (let* ((home (expand-file-name (getenv "HOME"))) - (home-len (length home))) - (if (and - (>= (length pwd) home-len) - (equal home (substring pwd 0 home-len))) - (concat "~" (substring pwd home-len)) - pwd))) - -(defun curr-dir-git-branch-string (pwd) - "Returns current git branch as a string, or the empty string if -PWD is not in a git repo (or the git command is not found)." - (interactive) - (when (and (eshell-search-path "git") - (locate-dominating-file pwd ".git")) - (let ((git-output (shell-command-to-string (concat "git branch | grep '\\*' | sed -e 's/^\\* //'")))) - (concat "[g:" - (if (> (length git-output) 0) - (substring git-output 0 -1) - "(no branch)") - "] ")))) - -(defun curr-dir-svn-string (pwd) - (interactive) - (when (and (eshell-search-path "svn") - (locate-dominating-file pwd ".svn")) - (concat "[s:" - (cond ((string-match-p "/trunk\\(/.*\\)?" pwd) - "trunk") - ((string-match "/branches/\\([^/]+\\)\\(/.*\\)?" pwd) - (match-string 1 pwd)) - (t - "(no branch)")) - "] "))) - -(setq eshell-prompt-function - (lambda () - (concat - (or (curr-dir-git-branch-string (eshell/pwd)) - (curr-dir-svn-string (eshell/pwd))) - ((lambda (p-lst) - (if (> (length p-lst) 3) - (concat - (mapconcat (lambda (elm) (if (zerop (length elm)) "" - (substring elm 0 1))) - (butlast p-lst 3) - "/") - "/" - (mapconcat (lambda (elm) elm) - (last p-lst 3) - "/")) - (mapconcat (lambda (elm) elm) - p-lst - "/"))) - (split-string (pwd-repl-home (eshell/pwd)) "/")) - "> "))) - -;; ; From http://www.emacswiki.org/cgi-bin/wiki.pl/EshellWThirtyTwo -;; ; Return nil, otherwise you'll see the return from w32-shell-execute -;; (defun eshell/open (file) -;; "Invoke (w32-shell-execute \"Open\" FILE) and substitute slashes for -;; backslashes" -;; (w32-shell-execute "Open" (substitute ?\\ ?/ (expand-file-name file))) -;; nil) - -(add-hook 'eshell-mode-hook - (lambda () - (local-set-key "\C-c\C-q" 'eshell-kill-process) - (local-set-key "\C-c\C-k" 'compile))) |