From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: ange-ftp-file-size Date: Thu, 15 Oct 2009 08:55:46 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1255611381 11045 80.91.229.12 (15 Oct 2009 12:56:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 15 Oct 2009 12:56:21 +0000 (UTC) Cc: emacs-devel@gnu.org To: Toru TSUNEYOSHI Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 15 14:56:11 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MyPsC-0005s4-V1 for ged-emacs-devel@m.gmane.org; Thu, 15 Oct 2009 14:56:05 +0200 Original-Received: from localhost ([127.0.0.1]:45579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MyPsC-0007bN-DX for ged-emacs-devel@m.gmane.org; Thu, 15 Oct 2009 08:56:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MyPs2-0007b9-KQ for emacs-devel@gnu.org; Thu, 15 Oct 2009 08:55:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MyPrw-0007aR-S9 for emacs-devel@gnu.org; Thu, 15 Oct 2009 08:55:53 -0400 Original-Received: from [199.232.76.173] (port=59083 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MyPrw-0007aO-2y for emacs-devel@gnu.org; Thu, 15 Oct 2009 08:55:48 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:61676 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MyPrv-0004kF-O6 for emacs-devel@gnu.org; Thu, 15 Oct 2009 08:55:47 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqoEAPu41kpMCqsb/2dsb2JhbACBUthNhDAEh3Y X-IronPort-AV: E=Sophos;i="4.44,566,1249272000"; d="scan'208";a="47608716" Original-Received: from 76-10-171-27.dsl.teksavvy.com (HELO pastel.home) ([76.10.171.27]) by ironport2-out.pppoe.ca with ESMTP; 15 Oct 2009 08:55:46 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 9ED837F87; Thu, 15 Oct 2009 08:55:46 -0400 (EDT) In-Reply-To: (Toru TSUNEYOSHI's message of "Thu, 15 Oct 2009 12:20:16 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:116166 Archived-At: > 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