[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#5478: 23.1.91; Cannot use dired with cons DIRNAME arg if include rem
bug#5478: 23.1.91; Cannot use dired with cons DIRNAME arg if include remote files
Mon, 25 Jan 2010 21:14:20 -0800
Here is some info about the cause of this bug. It has to do with the very
different way that local and remote file and directory names are handled by
`insert-directory'. Remote names are not handled correctly.
Local file and dir names are inserted into Dired verbatim: if they are absolute
names, then they remain such.
Remote names are instead relativized (they should not be). And in the case of a
remote directory name, instead of the directory name itself being inserted, its
constituent file names are inserted. (So there are in fact two bugs, or two
aspects to this bug.)
Here are some details:
`dired-internal-noselect' calls `dired-readin', which calls `insert-directory'
for each of the absolute file names in `dired-directory', which is the cons from
the DIR-OR-LIST arg to `dired-internal-noselect'.
The problem for a remote file name or a remote directory name as one of the
elements of the cons comes I think from this code in the definition of
`insert-directory' in ls-lisp.el:
(let ((handler (find-file-name-handler (expand-file-name file)
(funcall handler 'insert-directory file switches
and this code in ange-ftp.el:
(put 'insert-directory 'ange-ftp 'ange-ftp-insert-directory)
When a local directory name or an (absolute) local file name is an element of
the cons DIRNAME, `insert-directory' just inserts it verbatim as a single name
in the Dired buffer. That is the correct behavior for the cons DIRNAME case:
each file or dir in the cons should just be inserted in the Dired buffer. This
is done by calling `ls-lisp-insert-directory'.
But when a remote directory name or a remote (absolute) file name is an element
of the cons DIRNAME, the handler `ange-ftp-insert-directory' is called. For a
remote directory name element, it inserts the relative file names of the files
in that remote dir, instead of just inserting the remote dir name itself. For a
remote file-name element, it inserts the relative name instead of the absolute
IOW, for local files and dirs, `insert-directory' just inserts the names. For
remote files and dirs, it inserts relative file names. And in the case of a
remote dir, it inserts the (relative) names of the files in the dir, instead of
the dir name itself.