emacs-devel
[Top][All Lists]
Advanced

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

Re: ange-ftp-file-size


From: Stefan Monnier
Subject: Re: ange-ftp-file-size
Date: Thu, 15 Oct 2009 08:55:46 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

> Now, ange-ftp-file-attributes doesn't return the file size. It returns
> -1.
> I wish it returns the size exactly, so I make ange-ftp-file-size.
> If no problem, would you like to apply to ange-ftp.el, and modify code
> at the size of ange-ftp-file-attributes ?

That sounds like a useful improvement, yes.  Could you send a patch to
do that?

[...]
>        (line (cdr res))
>        (size -1))
>     (save-match-data
>       (when (string-match "^213 \\([0-9]+\\)$" line)
>       (setq size (string-to-number (match-string 1 line)))))
>     size))

And here comes the version, in functional programming style:

         (line (cdr res)))
    (save-match-data
      (if (string-match "^213 \\([0-9]+\\)$" line)
          (string-to-number (match-string 1 line))
        -1))))

BTW: the save-match-data seems completely unnecessary.  Please remove
it, or add a clear comment explaining why it's needed.


        Stefan




reply via email to

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