From adce533dc244f3e4fd5c146172eb48981c73b5b2 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Fri, 26 Jun 2020 16:13:18 +0200 Subject: [PATCH] Shell/Helm: Replace custom helm-ff-switch-to-shell with upstream. --- .emacs.d/lisp/init-shell.el | 42 +------------------------------------ 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/.emacs.d/lisp/init-shell.el b/.emacs.d/lisp/init-shell.el index 48835e8f..15393104 100644 --- a/.emacs.d/lisp/init-shell.el +++ b/.emacs.d/lisp/init-shell.el @@ -1,44 +1,4 @@ -(defun ambrevar/helm-ff--shell-interactive-buffer-p (buffer) - (with-current-buffer buffer - (and (eq major-mode 'shell-mode) - (save-excursion - (goto-char (point-min)) - (comint-next-prompt 1) - (null (eql (point) (point-min))))))) - -(defun ambrevar/helm-ff-switch-to-shell (_candidate) - "Like `helm-ff-switch-to-eshell' but for `M-x shell'. - -With a numeric prefix arg switch to numbered shell buffer, if no -prefix arg provided and more than one shell buffer exists, provide -completions on those buffers. If only one shell buffer exists, -switch to this one, if no shell buffer exists or if the numeric -prefix arg shell buffer doesn't exists, create it and switch to it." - (let ((cd-shell - (lambda () - (goto-char (point-max)) - (comint-delete-input) - (insert (format "cd %s" - (shell-quote-argument - (if (tramp-tramp-file-p helm-ff-default-directory) - (tramp-file-name-localname - (tramp-dissect-file-name helm-ff-default-directory)) - helm-ff-default-directory)))) - (comint-send-input))) - (bufs (cl-loop for b in (mapcar 'buffer-name (buffer-list)) - when (ambrevar/helm-ff--shell-interactive-buffer-p b) - collect b))) - (helm-aif (and (null helm-current-prefix-arg) - (if (cdr bufs) - (helm-comp-read "Switch to shell buffer: " bufs - :must-match t) - (car bufs))) - (switch-to-buffer it) - (shell)) - (funcall cd-shell))) - -(advice-add 'helm-ff-switch-to-eshell :override 'ambrevar/helm-ff-switch-to-shell) -;; TODO: Above code can be removed with Helm 3.6.3. +(setq helm-ff-preferred-shell-mode 'shell-mode) (defun ambrevar/shell-setup () (set (make-variable-buffer-local 'comint-input-history-ignore)