Skip to content

Commit

Permalink
[shell] Fix shell-pop renaming the wrong buffer for eat
Browse files Browse the repository at this point in the history
Fix #16794.
  • Loading branch information
bcc32 authored and fnussbaum committed Jan 14, 2025
1 parent a67d27d commit e0c05e0
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 @@ -120,6 +120,17 @@ SHELL is the SHELL function to use (i.e. when FUNC represents a terminal)."
(shell-pop index)
(spacemacs/resize-shell-to-desired-width))))

(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 @@ -345,7 +345,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 e0c05e0

Please sign in to comment.