Compare commits

...

2 Commits

Author SHA1 Message Date
731601d6e7 Globally ignore .aider files 2025-06-21 10:05:24 -07:00
20a9eb20e6 Update eshell popup code 2025-06-21 10:05:12 -07:00
2 changed files with 25 additions and 4 deletions

View File

@@ -512,7 +512,7 @@
"\\*Flycheck errors\\*" "\\*Flycheck errors\\*"
help-mode help-mode
compilation-mode compilation-mode
"\\*eshell.*\\*" eshell-mode)) "\\*eshell-popup\\*" eshell-mode))
(defun my/popper-window-height (window) (defun my/popper-window-height (window)
"Make eshell popups take half the frame height, otherwise defer to popper--fit-window-height" "Make eshell popups take half the frame height, otherwise defer to popper--fit-window-height"
@@ -922,6 +922,13 @@
(global-set-key (kbd "C-c a") 'aider-transient-menu)) (global-set-key (kbd "C-c a") 'aider-transient-menu))
;;; Eshell ;;; Eshell
;;;; Eshell ;;;; Eshell
(require 'cl-lib)
(defun find-window-matching (regexp)
"Find a visible window displaying a buffer whose name matches REGEXP."
(cl-loop for window in (window-list)
when (string-match regexp (buffer-name (window-buffer window)))
thereis window))
(use-package eshell (use-package eshell
:bind (("M-`" . my/eshell-toggle)) :bind (("M-`" . my/eshell-toggle))
:config :config
@@ -938,11 +945,24 @@ If in eshell, call `popper-toggle`.
If not in eshell but in a project, call `project-eshell`. If not in eshell but in a project, call `project-eshell`.
Otherwise, call `eshell`." Otherwise, call `eshell`."
(interactive) (interactive)
(if (derived-mode-p 'eshell-mode) (if (find-window-matching "\\*.*eshell-popup\\*$")
(popper-toggle) (popper-toggle)
(if (project-current) (if (project-current)
(project-eshell) (my/project-eshell-popup)
(eshell)))) (my/eshell-popup default-directory "*eshell-popup*"))))
(defun my/eshell-popup (directory name)
(defvar eshell-buffer-name)
(let* ((default-directory directory)
(eshell-buffer-name name)
(eshell-buffer (get-buffer eshell-buffer-name)))
(if eshell-buffer
(pop-to-buffer eshell-buffer (bound-and-true-p display-comint-buffer-action))
(eshell t))))
(defun my/project-eshell-popup ()
(my/eshell-popup (project-root (project-current t))
(project-prefixed-buffer-name "eshell-popup")))
(defun eshell/ec (&rest args) (defun eshell/ec (&rest args)
"Substitute for emacsclient alias from inside eshell" "Substitute for emacsclient alias from inside eshell"

View File

@@ -18,3 +18,4 @@ compile_commands.json
.ipynb_checkpoints .ipynb_checkpoints
infer-out infer-out
.cache .cache
.aider*