Skip to content

Commit

Permalink
[cherry-pick] [shell] Fix shell-pop renaming the wrong buffer for eat
Browse files Browse the repository at this point in the history
  • Loading branch information
bcc32 committed Jan 21, 2025
1 parent 8713a87 commit 2882e33
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions layers/+tools/shell/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ SHELL is the SHELL function to use (i.e. when FUNC represents a terminal)."
(interactive)
(projectile-with-default-dir (projectile-project-root) (multi-term)))

(defun spacemacs//eat-for-shell-pop (&rest args)
"Like `eat', but make the new shell buffer current.
Used to satisfy `shell-pop's assumptions."
;; `eat' unexpectedly selects the window displaying the returned buffer, but
;; doesn't actually leave the buffer current when it returns. The fix is
;; suggested upstream at https://codeberg.org/akib/emacs-eat/pulls/193, but
;; meanwhile we work around it in Spacemacs. We can replace this function at
;; its callsite with just `eat' if/when the above is merged.
(set-buffer (apply #'eat args)))

(defun spacemacs//toggle-shell-auto-completion-based-on-path ()
"Deactivates automatic completion on remote paths.
Retrieving completions for Eshell blocks Emacs. Over remote
Expand Down
2 changes: 1 addition & 1 deletion layers/+tools/shell/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@
:defer t
:commands (eat eat-other-window eat-project eat-project-other-window)
:init
(make-shell-pop-command "eat" eat)
(make-shell-pop-command "eat" spacemacs//eat-for-shell-pop)
(spacemacs/set-leader-keys "atsa" 'spacemacs/shell-pop-eat)
(spacemacs/register-repl 'eat 'eat)
:config
Expand Down

0 comments on commit 2882e33

Please sign in to comment.