From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: substitute-in-file-name is not distributive Date: Wed, 24 Oct 2012 20:28:52 -0700 Message-ID: <5088B1F4.90302@dancol.org> References: <50750955.4020802@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig69B5184C058CCDBB5313252C" X-Trace: ger.gmane.org 1351135751 4510 80.91.229.3 (25 Oct 2012 03:29:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Oct 2012 03:29:11 +0000 (UTC) Cc: Emacs development discussions To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 25 05:29:19 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TRE8B-0007qV-9O for ged-emacs-devel@m.gmane.org; Thu, 25 Oct 2012 05:29:15 +0200 Original-Received: from localhost ([::1]:37089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRE83-0002O9-I8 for ged-emacs-devel@m.gmane.org; Wed, 24 Oct 2012 23:29:07 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRE81-0002O4-24 for emacs-devel@gnu.org; Wed, 24 Oct 2012 23:29:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TRE7z-0006wW-IS for emacs-devel@gnu.org; Wed, 24 Oct 2012 23:29:04 -0400 Original-Received: from dancol.org ([96.126.100.184]:53380) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRE7z-0006vO-CI for emacs-devel@gnu.org; Wed, 24 Oct 2012 23:29:03 -0400 Original-Received: from c-76-22-66-162.hsd1.wa.comcast.net ([76.22.66.162] helo=[0.0.0.0]) by dancol.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1TRE7s-00079q-Mh; Wed, 24 Oct 2012 20:28:56 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 In-Reply-To: X-Enigmail-Version: 1.4.5 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 96.126.100.184 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:154501 Archived-At: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig69B5184C058CCDBB5313252C Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 10/24/2012 8:20 PM, Stefan Monnier wrote: >> The trouble is that the core completion code makes unwarranted >> assumptions about the behavior of expand-in-file-name. Specifically, >> completion--tqw-all assumes that (equal (unquote (concat (qnew foo) >> (qnew bar)) (unquote (quote (concat foo bar))). Why should that be >> the case? >=20 > Long story. For typical escaping/quoting this does hold. > Of course, for more general rewrites, it doesn't. >=20 > Can you give me your file-name-handler code so I can play with it (I > don't have Cygwin at hand, but I should be able to make up the > difference). > I think the problem is in completion--sifn-requote, which is definitely= > not prepared for the kind of rewrites you're doing. Here's what I threw together to try to get this working. I took a look at= minibuffer.el and other pieces of code seem to make the same assumption. = Maybe the requote operation needs a a file-name-handler? (defun cygwin-handler (operation &rest args) (when (eq operation 'substitute-in-file-name) ;; ;; Convert Windows paths to Cygwin paths. Take care to preserve ;; trailing "." and ".." suffixes so that completion doesn't ;; break. Punt to the regular substitute-in-file-name once we've ;; converted the path to a Cygwin one. ;; (let* ((path (car args)) (orig-path path) (suffix "")) (when (string-match (rx bos (group (* any) (or "/" "\\")) (group "." (? ".") "/") eos) path) (setf suffix (match-string 2 path)) (setf path (match-string 1 path))) (let ((posix-path (concat (cygwin-convert-path-from-windows path) suffix))) (message "CYG: %S -> %S" orig-path posix-path) (setf args (list posix-path))))) (let ((inhibit-file-name-handlers (cons 'cygwin-handler (and (eq inhibit-file-name-operation operation) inhibit-file-name-handlers))) (inhibit-file-name-operation operation)) (apply operation args))) (add-to-list 'file-name-handler-alist '("\\\\" . cygwin-handler)) --------------enig69B5184C058CCDBB5313252C Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Cygwin) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlCIsfcACgkQ17c2LVA10VvvHACdHQGjzIuJZ30gh1JH6B3RO09F ZrYAoNVCIDf9GYDhcWxp8hebERt0Oygw =91T4 -----END PGP SIGNATURE----- --------------enig69B5184C058CCDBB5313252C--