Skip to content

Unable to run visual command on tramp path #693

Closed

Description

@mobid

Steps to reproduce:

(ghostel-eshell-visual-command-mode +1)
(eshell)
; $ cd /ssh:remote: # or /sudo::
; /ssh:remote: $ tmux
; Selecting deleted buffer
; /ssh:remote: $

I have in mind something like that: (it works for me)

(defun ghostel-eshell--exec-visual (&rest args)
  "Replacement for `eshell-exec-visual' that dispatches to ghostel.
ARGS are the program name followed by its arguments, as passed by
eshell."
  (require 'esh-ext)
  (require 'esh-util)
  (save-current-buffer
    (let* ((eshell-interpreter-alist nil)
           (interp (eshell-find-interpreter (car args) (cdr args)))
           (program (car interp))
           (prog-args (flatten-tree
                       (eshell-stringify-list
                        (append (cdr interp) (cdr args)))))
           (buf (generate-new-buffer
                 (concat "*" (file-name-nondirectory program) "*"))))
      (switch-to-buffer buf)

      ;; here:
      (let ((default-directory (file-name-directory program))
            (program (if (file-remote-p program)
                         (tramp-file-name-localname
                          (tramp-dissect-file-name program))
                       program)))
        ;; end
        
        (ghostel-exec buf program prog-args
                      `((kind . eshell) (command . (,program . ,prog-args)))))
      (with-current-buffer buf
        (setq-local ghostel-kill-buffer-on-exit
                    (bound-and-true-p eshell-destroy-buffer-when-process-dies))
        (setq-local ghostel-buffer-name-function
                    (and ghostel-eshell-track-title
                         #'ghostel-buffer-name-by-title))
        (add-hook 'ghostel-exit-functions
                  #'ghostel-eshell--visual-exit nil t))
      nil)))

Activity

  1. dakra commented on Sep 16, 2026

    @dakra
    Owner

    Thanks for reporting. Fixed on main.

  2. mobid commented on Sep 16, 2026

    @mobid
    Author

    Thanks. Works fine now.

  3. added a commit that references this issue on Sep 17, 2026
    4925190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions