From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: convert-standard-filename on w32 does not preserve match-data? Date: Wed, 27 Dec 2006 18:46:07 +0100 Message-ID: <4592B15F.4040302@gmail.com> References: <4589B680.3080606@student.lu.se> <45928AEE.8030707@gmail.com> NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1167241631 29235 80.91.229.10 (27 Dec 2006 17:47:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 27 Dec 2006 17:47:11 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 27 18:47:09 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1Gzcrs-0000td-Tm for ged-emacs-devel@m.gmane.org; Wed, 27 Dec 2006 18:47:09 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gzcrs-0004cC-GF for ged-emacs-devel@m.gmane.org; Wed, 27 Dec 2006 12:47:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gzcqt-0003Ys-GR for emacs-devel@gnu.org; Wed, 27 Dec 2006 12:46:07 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gzcqr-0003WO-QM for emacs-devel@gnu.org; Wed, 27 Dec 2006 12:46:07 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gzcqr-0003W5-GD for emacs-devel@gnu.org; Wed, 27 Dec 2006 12:46:05 -0500 Original-Received: from [80.76.149.212] (helo=ch-smtp01.sth.basefarm.net) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1Gzcqp-0000Gw-Pr; Wed, 27 Dec 2006 12:46:04 -0500 Original-Received: from c83-254-145-24.bredband.comhem.se ([83.254.145.24]:60025 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.63) (envelope-from ) id 1Gzcqn-0002lQ-5g; Wed, 27 Dec 2006 18:46:02 +0100 User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) Original-To: Stefan Monnier In-Reply-To: X-Antivirus: avast! (VPS 0663-0, 2006-12-27), Outbound message X-Antivirus-Status: Clean X-Scan-Result: No virus found in message 1Gzcqn-0002lQ-5g. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1Gzcqn-0002lQ-5g aa13d4f06e9061aacca0582ebed92cac 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:64363 Archived-At: Stefan Monnier wrote: >>> In thre particular case of convert-standard-filename, I think it would be >>> wrong to add save-match-data (unless there's a particular reason to do it, >>> of course), but I agree that it's not worth removing it either. >>> > > >> The code using convert-standard-filename probably already feels a bit >> overloaded. >> > > Which code are you talking about? > I did not mean a specific case, but I did look around to find missing quoting before. Let me see if I remember... When you use call-process you just need to do something like (at least in some cases): (call-process ... (convert-standard-filename (expand-file-name file)) but when using shell-command you should do (shell-command ... (shell-quote-argument (convert-standard-filename (expand-file-name file)) However this may depend on the exact circumstances. Of course, the only place were this is noticed is on w32. And as I said before the test for quoting is not correct at the moment since it should be buffer specific (or rather specific to the circumstances). The difference above comes from the face that call-process (actually, on w32, in the behind the scenes) quotes the argument whereas shell-command does not if I remember correctly. (But please correct me if I am wrong now!) In many cases the code just had expand-file-name. I am not at all satisfied with this little mess. I think we should have some functions that does the above things and that SHOULD be used in our code. I e somthing like (defun file-arg-for-call-process(file, expand) ....) (defun file-arg-for-shell-command(file, expand) ....) And I believe there currently are still bugs in this area.