File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -271,6 +271,9 @@ login shell via `getent passwd`. `FALLBACK` is used when detection fails.
271271OSC 7 directory tracking is TRAMP-aware: when the shell reports a remote
272272hostname, ` default-directory ` is set to the corresponding TRAMP path,
273273reusing the existing TRAMP prefix (method, user, multi-hop) when available.
274+ When no prefix exists, the method defaults to ` tramp-default-method ` ; set
275+ ` ghostel-tramp-default-method ` to override it for ghostel specifically
276+ (e.g. ` "scp" ` , or ` "rpc" ` with [ emacs-tramp-rpc] ( https://github.com/ArthurHeymans/emacs-tramp-rpc ) ).
274277
275278#### Remote Shell Integration
276279
@@ -389,6 +392,7 @@ individual faces with `M-x customize-face`.
389392| ` ghostel-shell ` | ` $SHELL ` | Shell program to run |
390393| ` ghostel-tramp-shells ` | ` (see below) ` | Shell to use per TRAMP method (with login-shell detection) |
391394| ` ghostel-shell-integration ` | ` t ` | Auto-inject shell integration |
395+ | ` ghostel-tramp-default-method ` | ` nil ` | TRAMP method for new remote paths from OSC 7 (nil uses ` tramp-default-method ` ) |
392396| ` ghostel-tramp-shell-integration ` | ` nil ` | Auto-inject shell integration for remote TRAMP sessions |
393397| ` ghostel-buffer-name ` | ` "*ghostel*" ` | Default buffer name |
394398| ` ghostel-max-scrollback ` | ` 20MB ` | Maximum scrollback size in bytes |
Original file line number Diff line number Diff line change @@ -239,6 +239,15 @@ Set to t for all supported shells, or a list of symbols
239239 (repeat :tag " Specific shells"
240240 (choice (const bash) (const zsh) (const fish)))))
241241
242+ (defcustom ghostel-tramp-default-method nil
243+ " TRAMP method for constructing remote paths from OSC 7 directory reports.
244+ When directory tracking (OSC 7) reports a hostname that does not match
245+ the local machine and `default-directory' has no existing remote prefix,
246+ this method is used to build the TRAMP path (e.g. \" /ssh:host:/path\" ).
247+ When nil, falls back to `tramp-default-method' ."
248+ :type '(choice (const :tag " Use tramp-default-method" nil )
249+ string))
250+
242251(defcustom ghostel-keymap-exceptions
243252 '(" C-c" " C-x" " C-u" " C-h" " C-g" " M-x" " M-o" " M-:" " C-\\ " )
244253 " Key sequences that should not be sent to the terminal.
@@ -1775,7 +1784,10 @@ file:// URL does not match the local machine, construct a TRAMP path."
17751784 (let ((prefix (file-remote-p default-directory)))
17761785 (setq path (if prefix
17771786 (concat prefix filename)
1778- (format " /ssh:%s :%s " host filename))))))
1787+ (format " /%s :%s :%s "
1788+ (or ghostel-tramp-default-method
1789+ tramp-default-method)
1790+ host filename))))))
17791791 (setq path dir))
17801792 (when (and path (not (string= path " " )))
17811793 (if (file-remote-p path)
Original file line number Diff line number Diff line change @@ -2180,11 +2180,20 @@ rendered by `ghostel--delayed-redraw'. This is the exact real-world path."
21802180
21812181(ert-deftest ghostel-test-update-directory-remote ()
21822182 " Test TRAMP path construction from remote OSC 7."
2183- ; ; Remote hostname -> TRAMP ssh path
2183+ ; ; Remote hostname -> TRAMP path using tramp-default-method fallback
21842184 (let ((ghostel--last-directory nil )
2185- (default-directory " /tmp/" ))
2185+ (default-directory " /tmp/" )
2186+ (ghostel-tramp-default-method nil )
2187+ (tramp-default-method " ssh" ))
21862188 (ghostel--update-directory " file://remote-host/home/user" )
21872189 (should (equal " /ssh:remote-host:/home/user/" default-directory)))
2190+ ; ; ghostel-tramp-default-method takes precedence over tramp-default-method
2191+ (let ((ghostel--last-directory nil )
2192+ (default-directory " /tmp/" )
2193+ (ghostel-tramp-default-method " rsync" )
2194+ (tramp-default-method " ssh" ))
2195+ (ghostel--update-directory " file://remote-host/home/user" )
2196+ (should (equal " /rsync:remote-host:/home/user/" default-directory)))
21882197 ; ; Preserves method from existing TRAMP default-directory
21892198 (let ((ghostel--last-directory nil )
21902199 (default-directory " /scp:server:/" ))
You can’t perform that action at this time.
0 commit comments