summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/custom/my-eshell.el48
1 files changed, 0 insertions, 48 deletions
diff --git a/emacs/custom/my-eshell.el b/emacs/custom/my-eshell.el
index dfbe025..3bf7585 100644
--- a/emacs/custom/my-eshell.el
+++ b/emacs/custom/my-eshell.el
@@ -45,28 +45,6 @@
(eshell/alias "cal" "calendar")
(eshell/alias "agenda" "org-agenda"))
-(defun my/eshell--open-or-cd (path)
- "Cd to PATH if path is a directory, otherwise open PATH via `find-file'."
- (interactive)
- (if (file-directory-p path)
- (progn
- (goto-char (point-max))
- (insert (concat "cd " path))
- (eshell-send-input)
- (insert (concat "ls -l"))
- (eshell-send-input))
- (find-file path)))
-
-(defun my/eshell-open-file-at-point ()
- "Open the file at point in a buffer."
- (interactive)
- (let ((filename (symbol-name (symbol-at-point))))
- (cond
- ((file-readable-p filename)
- (my/eshell--open-or-cd filename))
- ((file-readable-p (expand-file-name filename))
- (my/eshell--open-or-cd (expand-file-name filename))))))
-
(defun my/eshell-here ()
"Opens a new shell in the directory associated with the current buffer's file.
The eshell is renamed to match that directory to make multiple
@@ -113,30 +91,6 @@ append to it, while separating multiple outputs with
(insert eshell-output)
(switch-to-buffer-other-window (current-buffer)))))
-;; eshell time and notification
-(defvar-local eshell-current-command-start-time nil)
-
-;; https://www.birkey.co/2021-06-20-why-eshell-part-1.html
-(defun my/eshell-current-command-start ()
- "Capture the time for when the command is started."
- (setq eshell-current-command-start-time (current-time)))
-
-(defun my/eshell-current-command-stop ()
- "Calculate how long the command took to run."
- (when eshell-current-command-start-time
- (let ((elapsed-time (float-time
- (time-subtract (current-time)
- eshell-current-command-start-time))))
- (if (> elapsed-time 5)
- (eshell-interactive-print
- (format "Finished in: %.0fs\n" elapsed-time)))))
- (setq eshell-current-command-start-time nil))
-
-(defun my/eshell-current-command-time-track ()
- "Track how long command takes to run."
- (add-hook 'eshell-pre-command-hook #'my/eshell-current-command-start nil t)
- (add-hook 'eshell-post-command-hook #'my/eshell-current-command-stop nil t))
-
(defun my/short-pwd (path)
"Turn a PATH of the form /foo/bar/baz into /f/b/baz, like fish shell."
(let* ((home-path (replace-regexp-in-string (expand-file-name "~")
@@ -168,7 +122,6 @@ append to it, while separating multiple outputs with
(global-set-key (kbd "C-c e h") 'my/eshell-here)
(define-key eshell-mode-map (kbd "C-c e e") 'my/eshell-export)
-(define-key eshell-mode-map (kbd "C-o") 'my/eshell-open-file-at-point)
(customize-set-variable 'eshell-scroll-to-bottom-on-input 'all)
(customize-set-variable 'eshell-error-if-no-glob t)
@@ -184,7 +137,6 @@ append to it, while separating multiple outputs with
(customize-set-variable 'eshell-destroy-buffer-when-process-dies t)
(add-hook 'eshell-mode-hook 'my/eshell-mode-setup)
-(add-hook 'eshell-mode-hook 'my/eshell-current-command-time-track)
(provide 'my-eshell)