[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm c04b867ab5: Fix read-file-name default and init arg g
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm c04b867ab5: Fix read-file-name default and init arg given as |
Date: |
Sat, 10 Jun 2023 04:00:47 -0400 (EDT) |
branch: elpa/helm
commit c04b867ab5d0bb6d0ad52e52c7a5319e25da6358
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Fix read-file-name default and init arg given as
normal filename when default-directory is remote.
Fixes M-x shell from a remote buffer.
https://www.reddit.com/r/emacs/comments/145hzxo/how_can_i_temporarily_bypass_helm_and_put_free/
---
helm-mode.el | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/helm-mode.el b/helm-mode.el
index 3697fb4a09..96b5744776 100644
--- a/helm-mode.el
+++ b/helm-mode.el
@@ -1536,9 +1536,24 @@ Keys description:
dir)))
(if (and fname (consp fname))
(setq fname (cl-loop for f in fname
- collect (expand-file-name f dir)))
+ collect (if (file-name-absolute-p fname)
+ (expand-file-name
+ f (helm-mode-root-dir dir))
+ (expand-file-name fname dir))))
(if (file-name-absolute-p fname)
- fname (expand-file-name fname dir))))
+ (if (file-remote-p fname)
+ fname
+ (substitute-in-file-name
+ (concat (helm-mode-root-dir dir) fname)))
+ (expand-file-name fname dir))))
+
+(defun helm-mode-root-dir (dir)
+ (if (file-remote-p dir)
+ (let* ((host (file-remote-p dir 'host))
+ (method (file-remote-p dir 'method))
+ (user (file-remote-p dir 'user)))
+ (format "/%s:%s@%s:/" method user host))
+ "/"))
(cl-defun helm--generic-read-file-name
(prompt &optional dir default-filename mustmatch initial predicate)
@@ -1649,7 +1664,14 @@ Don't use it directly, use instead `helm-read-file-name'
in your programs."
;; Helm handlers should always have a non nil INITIAL
arg.
:initial-input (if (string-match helm-ff-url-regexp
init)
init
- (expand-file-name init dir))
+ (if (file-name-absolute-p init)
+ (if (file-remote-p init)
+ init
+ (substitute-in-file-name
+ (concat (helm-mode-root-dir
+ (or dir init))
+ init)))
+ (expand-file-name init dir)))
:alistp nil
:nomark (null helm-comp-read-use-marked)
:marked-candidates helm-comp-read-use-marked
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/helm c04b867ab5: Fix read-file-name default and init arg given as,
ELPA Syncer <=