emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dired-insert-directory bug?


From: Katsumi Yamaoka
Subject: Re: dired-insert-directory bug?
Date: Thu, 19 Feb 2004 09:56:05 +0900
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

>>>>> In <address@hidden>
>>>>>   Richard Stallman <address@hidden> wrote:

>       When accessing a remote directory, it adds the --dired
>     option to dired-listing-switches (i.e., the ls command options).
>     However, it won't be accepted by all remotehosts.

> This code was certainly intended to do what it does now.

> 2002-09-22  Kai Grossjohann  <address@hidden>

>       * dired.el (dired-insert-directory): Always add "--dired" to to
>       SWITCHES for remote files.

I see.  Thanks.  That is not for the ls command in ftp sessions,
but is a trick for Tramp.  Although the --dired option is
currently ignored in the tramp-handle-insert-directory function.

As I wrote before, I found it while using the old ange-ftp.el
which is copied from Emacs 19.34b.  It is because the present
ange-ftp (or possibly tramp-ftp) is buggy for me.  I am now
using the old ange-ftp for ftp connections and the latest Tramp
for ssh connectins for a trial with the following settings.
There is no significant problem so far.

;;--8<---------------cut here---------------start------------->8---
(defun i-dare-to-use-old-ange-ftp ()
  (let (elem)
    (dolist (sym '(ange-ftp-completion-hook-function
                   ange-ftp-hook-function
                   tramp-completion-file-name-handler
                   tramp-file-name-handler))
      (while (setq elem (rassq sym file-name-handler-alist))
        (setq file-name-handler-alist
              (delq elem file-name-handler-alist)))))
  (setq file-name-handler-alist
        `(,@file-name-handler-alist
          ("^/ssh:[^/]*$" . tramp-completion-file-name-handler)
          ("\\`/ssh:" . tramp-file-name-handler)
          ("^/[^/:]*\\'" . ange-ftp-completion-hook-function)
          ("^/[^/:]*[^/:.]:" . ange-ftp-hook-function))))

(require 'ange-ftp) ;; old ange-ftp.

(condition-case nil
    (ange-ftp-file-attributes "~" nil)
  (wrong-number-of-arguments
   (defadvice ange-ftp-file-attributes (before allow-optional-arg
                                               (file &optional arg)
                                               activate)
     "Allow the optional argument.")))

(require 'tramp)

(delete '(tramp-disable-ange-ftp) (assoc "ange-ftp" after-load-alist))

(eval-after-load "ange-ftp" '(i-dare-to-use-old-ange-ftp))
(eval-after-load "tramp" '(i-dare-to-use-old-ange-ftp))

(defadvice dired-insert-directory (around bug-fix activate)
  "Fix a mis-designed logic.
Even when accessing remote directories, it adds the `--dired' option
to `dired-listing-switches' wrongly."
  (let ((frp (symbol-function 'file-remote-p))
        dired-use-ls-dired)
    (defalias 'file-remote-p 'ignore)
    (unwind-protect
        (progn ad-do-it)
      (defalias 'file-remote-p frp))))
;;--8<---------------cut here---------------end--------------->8---

The old ange-ftp.el is here:

/address@hidden:/pub/tmp/ange-ftp.el-19.32.gz
-- 
Katsumi Yamaoka <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]