mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-09 05:30:50 +00:00
Implement another fix for bug#49229
* lisp/minibuffer.el (read-file-name-default): Respect remote files. (Bug#49229) * lisp/net/tramp-sh.el (tramp-sh-handle-expand-file-name): Handle special file names on MS Windows. * lisp/net/tramp.el (tramp-file-name-handler): Revert patch. (Bug#49229)
This commit is contained in:
parent
38aa2074f8
commit
225ca617b7
3 changed files with 59 additions and 58 deletions
|
@ -3161,6 +3161,7 @@ See `read-file-name' for the meaning of the arguments."
|
||||||
(unless val (error "No file name specified"))
|
(unless val (error "No file name specified"))
|
||||||
|
|
||||||
(if (and default-filename
|
(if (and default-filename
|
||||||
|
(not (file-remote-p dir))
|
||||||
(string-equal val (if (consp insdef) (car insdef) insdef)))
|
(string-equal val (if (consp insdef) (car insdef) insdef)))
|
||||||
(setq val default-filename))
|
(setq val default-filename))
|
||||||
(setq val (substitute-in-file-name val))
|
(setq val (substitute-in-file-name val))
|
||||||
|
|
|
@ -2667,6 +2667,12 @@ the result will be a local, non-Tramp, file name."
|
||||||
(setq dir (or dir default-directory "/"))
|
(setq dir (or dir default-directory "/"))
|
||||||
;; Handle empty NAME.
|
;; Handle empty NAME.
|
||||||
(when (zerop (length name)) (setq name "."))
|
(when (zerop (length name)) (setq name "."))
|
||||||
|
;; On MS Windows, some special file names are not returned properly
|
||||||
|
;; by `file-name-absolute-p'.
|
||||||
|
(if (and (eq system-type 'windows-nt)
|
||||||
|
(string-match-p
|
||||||
|
(concat "^\\([[:alpha:]]:\\|" null-device "$\\)") name))
|
||||||
|
(tramp-run-real-handler #'expand-file-name (list name dir))
|
||||||
;; Unless NAME is absolute, concat DIR and NAME.
|
;; Unless NAME is absolute, concat DIR and NAME.
|
||||||
(unless (file-name-absolute-p name)
|
(unless (file-name-absolute-p name)
|
||||||
(setq name (concat (file-name-as-directory dir) name)))
|
(setq name (concat (file-name-as-directory dir) name)))
|
||||||
|
@ -2696,7 +2702,8 @@ the result will be a local, non-Tramp, file name."
|
||||||
(setq uname
|
(setq uname
|
||||||
(with-tramp-connection-property v uname
|
(with-tramp-connection-property v uname
|
||||||
(tramp-send-command
|
(tramp-send-command
|
||||||
v (format "cd %s && pwd" (tramp-shell-quote-argument uname)))
|
v
|
||||||
|
(format "cd %s && pwd" (tramp-shell-quote-argument uname)))
|
||||||
(with-current-buffer (tramp-get-buffer v)
|
(with-current-buffer (tramp-get-buffer v)
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(buffer-substring (point) (point-at-eol)))))
|
(buffer-substring (point) (point-at-eol)))))
|
||||||
|
@ -2710,13 +2717,13 @@ the result will be a local, non-Tramp, file name."
|
||||||
(setq localname "/"))
|
(setq localname "/"))
|
||||||
;; No tilde characters in file name, do normal
|
;; No tilde characters in file name, do normal
|
||||||
;; `expand-file-name' (this does "/./" and "/../").
|
;; `expand-file-name' (this does "/./" and "/../").
|
||||||
;; `default-directory' is bound, because on Windows there would
|
;; `default-directory' is bound, because on Windows there
|
||||||
;; be problems with UNC shares or Cygwin mounts.
|
;; would be problems with UNC shares or Cygwin mounts.
|
||||||
(let ((default-directory (tramp-compat-temporary-file-directory)))
|
(let ((default-directory (tramp-compat-temporary-file-directory)))
|
||||||
(tramp-make-tramp-file-name
|
(tramp-make-tramp-file-name
|
||||||
v (tramp-drop-volume-letter
|
v (tramp-drop-volume-letter
|
||||||
(tramp-run-real-handler
|
(tramp-run-real-handler
|
||||||
#'expand-file-name (list localname))))))))
|
#'expand-file-name (list localname)))))))))
|
||||||
|
|
||||||
;;; Remote commands:
|
;;; Remote commands:
|
||||||
|
|
||||||
|
|
|
@ -2610,14 +2610,7 @@ Fall back to normal file name handler if no Tramp file name handler exists."
|
||||||
|
|
||||||
;; When `tramp-mode' is not enabled, or the file name is quoted,
|
;; When `tramp-mode' is not enabled, or the file name is quoted,
|
||||||
;; we don't do anything.
|
;; we don't do anything.
|
||||||
;; When operation is `expand-file-name', and the first argument
|
(tramp-run-real-handler operation args))))
|
||||||
;; is a local absolute file name, we end also here. Handle the
|
|
||||||
;; MS Windows case.
|
|
||||||
(funcall
|
|
||||||
(if (and (eq operation 'expand-file-name)
|
|
||||||
(not (string-match-p "\\`[[:alpha:]]:/" (car args))))
|
|
||||||
#'tramp-drop-volume-letter #'identity)
|
|
||||||
(tramp-run-real-handler operation args)))))
|
|
||||||
|
|
||||||
(defun tramp-completion-file-name-handler (operation &rest args)
|
(defun tramp-completion-file-name-handler (operation &rest args)
|
||||||
"Invoke Tramp file name completion handler for OPERATION and ARGS.
|
"Invoke Tramp file name completion handler for OPERATION and ARGS.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue