[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [h-e-w] Re: Autocomplete in tramp is no longer working in version Em
From: |
Michael Albinus |
Subject: |
Re: [h-e-w] Re: Autocomplete in tramp is no longer working in version Emacs-22-CvsP060625-EmacsW32-1.06 |
Date: |
Tue, 22 Aug 2006 21:32:01 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) |
Lennart Borgman <address@hidden> writes:
>> The appended patch shows how autocompletion could work for remote file
>> names. It removes the drive letter from file names to be completed,
>> because this prevents activation of Tramp file name handlers for
>> file-name-all-completions in read-file-name-internal.
>>
> Exactly why must the drive letter be removed? (Where in the code is it
> essential?)
It is in read-file-name-internal (respectively
Fread_file_name_internal) in fileio.c. You can see it when you enable
traces:
(trace-function-background 'read-file-name-internal)
(mapcar 'trace-function-background
(mapcar 'intern
(all-completions "tramp-" obarray 'functionp)))
With unpatched tramp.el, you get:
======================================================================
1 -> read-file-name-internal: string="/pl" dir="~/" action=t
| 2 -> tramp-completion-file-name-handler: operation=substitute-in-file-name
args=("/pl")
| | 3 -> tramp-completion-run-real-handler: operation=substitute-in-file-name
args=("/pl")
| | 3 <- tramp-completion-run-real-handler: "/pl"
| 2 <- tramp-completion-file-name-handler: "/pl"
| 2 -> tramp-completion-file-name-handler: operation=file-name-nondirectory
args=("/pl")
| | 3 -> tramp-completion-run-real-handler: operation=file-name-nondirectory
args=("/pl")
| | 3 <- tramp-completion-run-real-handler: "pl"
| 2 <- tramp-completion-file-name-handler: "pl"
| 2 -> tramp-completion-file-name-handler: operation=file-name-directory
args=("/pl")
| | 3 -> tramp-completion-run-real-handler: operation=file-name-directory
args=("/pl")
| | 3 <- tramp-completion-run-real-handler: "/"
| 2 <- tramp-completion-file-name-handler: "/"
| 2 -> tramp-completion-file-name-handler: operation=expand-file-name args=("/"
"~/")
| | 3 -> tramp-completion-run-real-handler: operation=expand-file-name
args=("/" "~/")
| | 3 <- tramp-completion-run-real-handler: "h:/"
| 2 <- tramp-completion-file-name-handler: "h:/"
1 <- read-file-name-internal: nil
======================================================================
Interesting are the Tramp functions called at trace level 2:
(substitute-in-file-name "/pl") -> "/pl"
(file-name-nondirectory "/pl") -> "pl"
(file-name-directory "/pl") -> "/"
(expand-file-name "/" "~/") -> "h:/"
In read-file-name-internal, these calls are related to the following
code sequence:
orig_string = string;
string = Fsubstitute_in_file_name (string);
changed = NILP (Fstring_equal (string, orig_string));
name = Ffile_name_nondirectory (string);
val = Ffile_name_directory (string);
if (! NILP (val))
realdir = Fexpand_file_name (val, realdir);
Finally, there is the call:
Lisp_Object all = Ffile_name_all_completions (name, realdir);
Because realdir is "h:/", the Tramp completion file name handler is not
called.
In the case of the patched tramp.el, we have the following situation:
======================================================================
1 -> read-file-name-internal: string="/pl" dir="~/" action=t
| 2 -> tramp-completion-file-name-handler: operation=substitute-in-file-name
args=("/pl")
| | 3 -> tramp-completion-run-real-handler: operation=substitute-in-file-name
args=("/pl")
| | 3 <- tramp-completion-run-real-handler: "/pl"
| 2 <- tramp-completion-file-name-handler: "/pl"
| 2 -> tramp-completion-file-name-handler: operation=file-name-nondirectory
args=("/pl")
| | 3 -> tramp-completion-run-real-handler: operation=file-name-nondirectory
args=("/pl")
| | 3 <- tramp-completion-run-real-handler: "pl"
| 2 <- tramp-completion-file-name-handler: "pl"
| 2 -> tramp-completion-file-name-handler: operation=file-name-directory
args=("/pl")
| | 3 -> tramp-completion-run-real-handler: operation=file-name-directory
args=("/pl")
| | 3 <- tramp-completion-run-real-handler: "/"
| 2 <- tramp-completion-file-name-handler: "/"
| 2 -> tramp-completion-file-name-handler: operation=expand-file-name args=("/"
"~/")
| | 3 -> tramp-completion-handle-expand-file-name: name="/" dir="~/"
| | | 4 -> tramp-completion-mode: file="~//"
| | | 4 <- tramp-completion-mode: t
| | | 4 -> tramp-completion-run-real-handler: operation=expand-file-name
args=("/" "~/")
| | | 4 <- tramp-completion-run-real-handler: "h:/"
| | | 4 -> tramp-drop-volume-letter: name="h:/"
| | | 4 <- tramp-drop-volume-letter: "/"
| | 3 <- tramp-completion-handle-expand-file-name: "/"
| 2 <- tramp-completion-file-name-handler: "/"
| 2 -> tramp-completion-file-name-handler: operation=file-name-all-completions
args=("pl" "/")
| | 3 -> tramp-completion-handle-file-name-all-completions: filename="pl"
directory="/"
| | | 4 -> tramp-completion-dissect-file-name: name="/pl"
| | | | 5 -> tramp-completion-dissect-file-name1:
structure=("^/\\([a-zA-Z_0-9-]+\\|\\(\\)\\)$" 1 nil nil nil) name="/pl"
| | | | 5 <- tramp-completion-dissect-file-name1: [cl-struct-tramp-file-name
nil "pl" nil nil nil]
| | | | 5 -> tramp-completion-dissect-file-name1: structure=("^/\\([^:/
]*\\|\\(\\)\\)$" nil 1 nil nil) name="/pl"
| | | | 5 <- tramp-completion-dissect-file-name1: [cl-struct-tramp-file-name
nil nil "pl" nil nil]
| | | | 5 -> tramp-completion-dissect-file-name1:
structure=("^/\\([a-zA-Z0-9_.-]*\\|\\(\\)\\)$" nil nil 1 nil) name="/pl"
| | | | 5 <- tramp-completion-dissect-file-name1: [cl-struct-tramp-file-name
nil nil nil "pl" nil]
| | | | 5 -> tramp-completion-dissect-file-name1: structure=("^/\\([^:/
]*\\)@\\([a-zA-Z0-9_.-]*\\|\\(\\)\\)$" nil 1 2 nil) name="/pl"
| | | | 5 <- tramp-completion-dissect-file-name1: nil
| | | | 5 -> tramp-completion-dissect-file-name1:
structure=("^/\\([a-zA-Z_0-9-]+\\):\\([^:/ ]*\\|\\(\\)\\)$" 1 2 nil nil)
name="/pl"
| | | | 5 <- tramp-completion-dissect-file-name1: nil
| | | | 5 -> tramp-completion-dissect-file-name1:
structure=("^/\\([a-zA-Z_0-9-]+\\):\\([a-zA-Z0-9_.-]*\\|\\(\\)\\)$" 1 nil 2
nil) name="/pl"
| | | | 5 <- tramp-completion-dissect-file-name1: nil
| | | | 5 -> tramp-completion-dissect-file-name1:
structure=("^/\\([a-zA-Z_0-9-]+\\):\\([^:/
]*\\)@\\([a-zA-Z0-9_.-]*\\|\\(\\)\\)$" 1 2 3 nil) name="/pl"
| | | | 5 <- tramp-completion-dissect-file-name1: nil
| | | | 5 -> tramp-completion-dissect-file-name1:
structure=("^/\\(\\([a-zA-Z_0-9-]+\\):\\)?\\(\\([^:/
]*\\)@\\)?\\([a-zA-Z0-9_.#-]*\\):\\(.*$\\)" 2 4 5 6) name="/pl"
| | | | 5 <- tramp-completion-dissect-file-name1: nil
| | | 4 <- tramp-completion-dissect-file-name: ([cl-struct-tramp-file-name nil
nil nil "pl" nil] [cl-struct-tramp-file-name nil nil "pl" nil nil]
[cl-struct-tramp-file-name nil "pl" nil nil nil])
| | | 4 -> tramp-file-name-multi-method: cl-x=[cl-struct-tramp-file-name nil
nil nil "pl" nil]
| | | 4 <- tramp-file-name-multi-method: nil
| | | 4 -> tramp-file-name-method: cl-x=[cl-struct-tramp-file-name nil nil nil
"pl" nil]
| | | 4 <- tramp-file-name-method: nil
| | | 4 -> tramp-file-name-user: cl-x=[cl-struct-tramp-file-name nil nil nil
"pl" nil]
| | | 4 <- tramp-file-name-user: nil
| | | 4 -> tramp-file-name-host: cl-x=[cl-struct-tramp-file-name nil nil nil
"pl" nil]
| | | 4 <- tramp-file-name-host: "pl"
| | | 4 -> tramp-file-name-localname: cl-x=[cl-struct-tramp-file-name nil nil
nil "pl" nil]
| | | 4 <- tramp-file-name-localname: nil
| | | 4 -> tramp-find-method: multi-method=nil method=nil user=nil host="pl"
| | | | 5 -> tramp-find-default-method: user=nil host="pl"
| | | | 5 <- tramp-find-default-method: "ftp"
| | | 4 <- tramp-find-method: "ftp"
| | | 4 -> tramp-get-completion-function: method="ftp"
| | | 4 <- tramp-get-completion-function: nil
| | | 4 -> tramp-file-name-multi-method: cl-x=[cl-struct-tramp-file-name nil
nil "pl" nil nil]
| | | 4 <- tramp-file-name-multi-method: nil
| | | 4 -> tramp-file-name-method: cl-x=[cl-struct-tramp-file-name nil nil "pl"
nil nil]
| | | 4 <- tramp-file-name-method: nil
| | | 4 -> tramp-file-name-user: cl-x=[cl-struct-tramp-file-name nil nil "pl"
nil nil]
| | | 4 <- tramp-file-name-user: "pl"
| | | 4 -> tramp-file-name-host: cl-x=[cl-struct-tramp-file-name nil nil "pl"
nil nil]
| | | 4 <- tramp-file-name-host: nil
| | | 4 -> tramp-file-name-localname: cl-x=[cl-struct-tramp-file-name nil nil
"pl" nil nil]
| | | 4 <- tramp-file-name-localname: nil
| | | 4 -> tramp-find-method: multi-method=nil method=nil user="pl" host=nil
| | | | 5 -> tramp-find-default-method: user="pl" host=nil
| | | | 5 <- tramp-find-default-method: "ftp"
| | | 4 <- tramp-find-method: "ftp"
| | | 4 -> tramp-get-completion-function: method="ftp"
| | | 4 <- tramp-get-completion-function: nil
| | | 4 -> tramp-file-name-multi-method: cl-x=[cl-struct-tramp-file-name nil
"pl" nil nil nil]
| | | 4 <- tramp-file-name-multi-method: nil
| | | 4 -> tramp-file-name-method: cl-x=[cl-struct-tramp-file-name nil "pl" nil
nil nil]
| | | 4 <- tramp-file-name-method: "pl"
| | | 4 -> tramp-file-name-user: cl-x=[cl-struct-tramp-file-name nil "pl" nil
nil nil]
| | | 4 <- tramp-file-name-user: nil
| | | 4 -> tramp-file-name-host: cl-x=[cl-struct-tramp-file-name nil "pl" nil
nil nil]
| | | 4 <- tramp-file-name-host: nil
| | | 4 -> tramp-file-name-localname: cl-x=[cl-struct-tramp-file-name nil "pl"
nil nil nil]
| | | 4 <- tramp-file-name-localname: nil
| | | 4 -> tramp-find-method: multi-method=nil method="pl" user=nil host=nil
| | | 4 <- tramp-find-method: "pl"
| | | 4 -> tramp-get-completion-methods: partial-method="pl"
| | | | 5 -> tramp-make-tramp-file-name: multi-method=nil method="plink"
user=nil host=nil localname=nil
| | | | 5 <- tramp-make-tramp-file-name: "/plink:"
| | | | 5 -> tramp-make-tramp-file-name: multi-method=nil method="plink1"
user=nil host=nil localname=nil
| | | | 5 <- tramp-make-tramp-file-name: "/plink1:"
| | | 4 <- tramp-get-completion-methods: (nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil "/plink:" "/plink1:" nil
nil)
| | | 4 -> tramp-run-real-handler: operation=file-name-all-completions
args=("pl" "/")
| | | | 5 -> tramp-completion-file-name-handler: operation=expand-file-name
args=("/" nil)
| | | | | 6 -> tramp-completion-handle-expand-file-name: name="/" dir=nil
| | | | | | 7 -> tramp-completion-mode: file="h:/albinus//"
| | | | | | 7 <- tramp-completion-mode: t
| | | | | | 7 -> tramp-completion-run-real-handler: operation=expand-file-name
args=("/" nil)
| | | | | | 7 <- tramp-completion-run-real-handler: "h:/"
| | | | | | 7 -> tramp-drop-volume-letter: name="h:/"
| | | | | | 7 <- tramp-drop-volume-letter: "/"
| | | | | 6 <- tramp-completion-handle-expand-file-name: "/"
| | | | 5 <- tramp-completion-file-name-handler: "/"
| | | | 5 -> tramp-completion-file-name-handler: operation=directory-file-name
args=("/")
| | | | | 6 -> tramp-completion-run-real-handler: operation=directory-file-name
args=("/")
| | | | | 6 <- tramp-completion-run-real-handler: "/"
| | | | 5 <- tramp-completion-file-name-handler: "/"
| | | 4 <- tramp-run-real-handler: nil
| | 3 <- tramp-completion-handle-file-name-all-completions: ("plink1:" "plink:")
| 2 <- tramp-completion-file-name-handler: ("plink1:" "plink:")
1 <- read-file-name-internal: ("plink1:" "plink:")
======================================================================
Tramp functions, called at trace level 2, are:
(substitute-in-file-name "/pl") -> "/pl"
(file-name-nondirectory "/pl") -> "pl"
(file-name-directory "/pl") -> "/"
(expand-file-name "/" "~/") -> "/"
(file-name-all-completions "pl" "/") -> ("plink1:" "plink:")
Because expand-file-name returns "/", realdir is set to this value,
and file-name-all-completions enters the Tramp completion file name
handler.
Best regards, Michael.
- [h-e-w] Re: Autocomplete in tramp is no longer working in version Emacs-22-CvsP060625-EmacsW32-1.06, Michael Albinus, 2006/08/20
- [h-e-w] Re: Autocomplete in tramp is no longer working in version Emacs-22-CvsP060625-EmacsW32-1.06, Eli Zaretskii, 2006/08/21
- [h-e-w] Re: Autocomplete in tramp is no longer working in version Emacs-22-CvsP060625-EmacsW32-1.06, Michael Albinus, 2006/08/22
- Re: [h-e-w] Re: Autocomplete in tramp is no longer working in version Emacs-22-CvsP060625-EmacsW32-1.06, Lennart Borgman, 2006/08/22
- Re: [h-e-w] Re: Autocomplete in tramp is no longer working in version Emacs-22-CvsP060625-EmacsW32-1.06,
Michael Albinus <=
- Re: [h-e-w] Re: Autocomplete in tramp is no longer working in version Emacs-22-CvsP060625-EmacsW32-1.06, Lennart Borgman, 2006/08/22
- Re: [h-e-w] Re: Autocomplete in tramp is no longer working in version Emacs-22-CvsP060625-EmacsW32-1.06, Eli Zaretskii, 2006/08/23
- Re: [h-e-w] Re: Autocomplete in tramp is no longer working in version Emacs-22-CvsP060625-EmacsW32-1.06, Michael Albinus, 2006/08/23
- Re: [h-e-w] Re: Autocomplete in tramp is no longer working in version Emacs-22-CvsP060625-EmacsW32-1.06, Michael Albinus, 2006/08/27