emacs-devel
[Top][All Lists]
Advanced

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

Re: tiny patch to ange-ftp


From: Katsumi Yamaoka
Subject: Re: tiny patch to ange-ftp
Date: Thu, 08 Sep 2005 12:57:36 +0900
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Sorry for the late reply.  I seem to have fixed all the problems
that I grasp.

>>>>> In <address@hidden> Stefan Monnier wrote:

> Your patch looks like a good first step.  I would check `full'
> rather than (file-name-directory file) in order to determine whether to do
> a full dir listing or to extract a single line.

I did so.

> Also I hoped that we would be able to use the cache so as to avoid doing the
> full-listing+extract-line thingy repeatedly.  Using ange-ftp-get-files
> should do the trick here.  But that can be changed later on.

Well, using the cache seems useless for the remote file which is
newly uploaded. Am I wrong?  I tried some ways but I didn't get
the right way to use those functions so far.

> Given that this fixes the problem mentioned in ange-ftp-send-cmd and should
> be orthogonal to the problem of hash marks, I suggest we install your patch.

> Any objections?

I noticed `ange-ftp-process-filter' does not extract all hash
marks because of the too strict regexp and it breaks the
synchronous operation while at least uploading files.

Here's a new patch:

2005-09-08  Katsumi Yamaoka  <address@hidden>  (tiny change)

        * net/ange-ftp.el (ange-ftp-process-filter): Fix regexp to extract
        hash marks.
        (ange-ftp-insert-directory): Work with a single file listing.

--8<---------------cut here---------------start------------->8---
*** ange-ftp.el~        Thu Aug 11 21:55:21 2005
--- ange-ftp.el Thu Sep  8 03:57:18 2005
***************
*** 1656,1662 ****
  
              ;; handle hash mark printing
              (and ange-ftp-process-busy
!                  (string-match "\\`#+\\'" str)
                   (setq str (ange-ftp-process-handle-hash str)))
              (comint-output-filter proc str)
              ;; Replace STR by the result of the comint processing.
--- 1656,1662 ----
  
              ;; handle hash mark printing
              (and ange-ftp-process-busy
!                  (string-match "#+" str)
                   (setq str (ange-ftp-process-handle-hash str)))
              (comint-output-filter proc str)
              ;; Replace STR by the result of the comint processing.
***************
*** 2332,2347 ****
        ;; This works around a misfeature of some versions of netbsd ftpd
        ;; where `ls' can only take one argument: either one set of flags
        ;; or a file/directory name.
-       ;; FIXME: if we're trying to `ls' a single file, this fails since we
-       ;; can't cd to a file.  We can't fix this problem here, tho, because
-       ;; at this point we don't know whether the argument is a file or
-       ;; a directory.  Such an `ls' is only every used (apparently) from
-       ;; `insert-directory' when the `full-directory-p' argument is nil
-       ;; (which seems to only be used by dired when updating its display
-       ;; after operating on a set of files).  We should change
-       ;; ange-ftp-insert-directory so that this case is handled by getting
-       ;; a full listing of the directory and extracting the line
-       ;; corresponding to the requested file.
        (unless (equal cmd1 ".")
          (setq result (ange-ftp-cd host user (nth 1 cmd) 'noerror)))
        (setq cmd1 cmd3)))
--- 2332,2337 ----
***************
*** 4498,4504 ****
           (if wildcard
               (let ((default-directory (file-name-directory file)))
                 (ange-ftp-ls (file-name-nondirectory file) switches nil nil t))
!            (ange-ftp-ls file switches full))))
        (ange-ftp-real-insert-directory file switches wildcard full))))
  
  (defun ange-ftp-dired-uncache (dir)
--- 4488,4510 ----
           (if wildcard
               (let ((default-directory (file-name-directory file)))
                 (ange-ftp-ls (file-name-nondirectory file) switches nil nil t))
!            ;; That `full' is nil means we're going to do `ls' for
!            ;; a single file in the current directory.
!            (if full
!                (ange-ftp-ls file switches full)
!              ;; Get a full listing of the current directory and
!              ;; extract the line corresponding to `file'.
!              (when (string-match "d\\'" switches)
!                ;; Remove "d" which dired added to `switches'.
!                (setq switches (substring switches 0 (match-beginning 0))))
!              (setq tem (ange-ftp-ls "." switches nil))
!              (let ((case-fold-search nil))
!                ;; Assume the file name which a single space precedes
!                ;; appears at the end of a line.
!                (if (string-match (concat "^.+[^ ] " (regexp-quote file) "$")
!                                  tem)
!                    (concat (match-string 0 tem) "\n")
!                  ""))))))
        (ange-ftp-real-insert-directory file switches wildcard full))))
  
  (defun ange-ftp-dired-uncache (dir)
--8<---------------cut here---------------end--------------->8---




reply via email to

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