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: Fri, 16 Oct 2009 11:22:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

> BTW, about save-match-data, I used it because of inhibiting changing old
> match data. Using it is wrong (as the style)?

save-match-data should only be used where it is really needed, not
defensively: 99% of the code may destroy the match-date (and could thus
use save-match-data defensively), whereas less than 1% of the code needs
the match-data to be saved.

> -          (and (eq cmd0 'quote) (string= cmd1 "mdtm")))
> +          (and (eq cmd0 'quote) (string-match-p "^\\(mdtm\\|size\\)$" cmd1)))

I used (member cmd1 '("mdtm" "size")) instead.  The regexp equivalent
would be "\\`\\(mdtm\\|size\\)\\'".

> +      (res (prog2
> +               (unless ascii-mode
> +                 (ange-ftp-set-binary-mode host user))
> +               (ange-ftp-send-cmd host user (list 'quote "size" name))
> +             (unless ascii-mode
> +               (ange-ftp-set-ascii-mode host user))))

Now that I look at it: isn't it problematic to set the mode to `ascii'
here?  If the mode was binary before and we call it with ascii-mode=nil,
we end up switching to ascii mode unwittingly, don't we?


        Stefan




reply via email to

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