summaryrefslogtreecommitdiffhomepage
path: root/attic
diff options
context:
space:
mode:
Diffstat (limited to 'attic')
-rw-r--r--attic/misc.org60
1 files changed, 16 insertions, 44 deletions
diff --git a/attic/misc.org b/attic/misc.org
index c3df4b7..9ca8e01 100644
--- a/attic/misc.org
+++ b/attic/misc.org
@@ -572,50 +572,22 @@
(jao-define-attached-buffer "^\\* vrepl - .+ \\*.*")
#+end_src
* eshell here
- #+begin_src emacs-lisp
- (defun jao-shell-here--find-window (b)
- (when-let (w (seq-find (lambda (w) (eq (window-buffer w) b))
- (window-list)))
- (select-window w)))
-
- (defun jao-shell-frame-buffer (&optional b)
- (let ((p 'jao-eshell-buffer))
- (if b (set-frame-parameter nil p b) (frame-parameter nil p))))
-
- (defun jao-shell--cd-here (dir)
- (eshell-kill-input)
- (eshell/cd dir)
- (insert "\n")
- (eshell-send-input))
-
- (defun jao-shell-here (&optional stay)
- (interactive)
- (let* ((dir default-directory)
- (b (jao-shell-frame-buffer)))
- (jao-with-attached-buffer "^\\*eshell" 35
- (if (buffer-live-p b)
- (pop-to-buffer b nil t)
- (eshell)
- (jao-shell-frame-buffer (current-buffer))))
- (eshell-save-some-history)
- (unless stay (jao-shell--cd-here dir))))
-
- (defun eshell/x ()
- (when (derived-mode-p 'eshell-mode)
- (when (fboundp 'eshell-autojump-save)
- (eshell-autojump-save))
- (eshell-save-some-history))
- (if (> (frame-height) (window-height)) (delete-window) (bury-buffer)))
-
- (defun jao-shell-here-toggle ()
- (interactive)
- (if (eq (current-buffer) (jao-shell-frame-buffer))
- (eshell/x)
- (jao-shell-here t)))
-
- (global-set-key (kbd "C-!") #'jao-shell-here)
- (global-set-key [(f1)] #'jao-shell-here-toggle)
- #+end_src
+ #+begin_src emacs-lisp
+ (use-package eshell-toggle
+ :ensure t
+ :demand t
+ :custom ((eshell-toggle-use-git-root t)))
+
+ (defun jao-eshell-toggle (current)
+ (interactive "P")
+ (when (eq eshell-toggle--toggle-buffer-p t)
+ (eshell-save-some-history)
+ (eshell-autojump-save))
+ (let ((eshell-toggle-use-git-root (not current)))
+ (eshell-toggle)))
+
+ (global-set-key (kbd "<f1>") #'jao-eshell-toggle)
+ #+end_src
* scrolling
#+begin_src emacs-lisp
(use-package iscroll