From: Daniel Colascione <dancol@dancol.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: substitute-in-file-name is not distributive
Date: Wed, 24 Oct 2012 20:28:52 -0700 [thread overview]
Message-ID: <5088B1F4.90302@dancol.org> (raw)
In-Reply-To: <jwvk3ufw8eu.fsf-monnier+emacs@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2280 bytes --]
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?
>
> Long story. For typical escaping/quoting this does hold.
> Of course, for more general rewrites, it doesn't.
>
> 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))
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]
next prev parent reply other threads:[~2012-10-25 3:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-10 5:36 substitute-in-file-name is not distributive Daniel Colascione
2012-10-10 6:39 ` Andreas Schwab
2012-10-10 15:31 ` Eli Zaretskii
2012-10-10 16:48 ` Daniel Colascione
2012-10-10 17:18 ` Eli Zaretskii
2012-10-10 17:40 ` Daniel Colascione
2012-10-11 3:25 ` Stephen Leake
2012-10-25 3:20 ` Stefan Monnier
2012-10-25 3:28 ` Daniel Colascione [this message]
2012-10-27 16:08 ` Stefan Monnier
2012-10-28 19:09 ` Stefan Monnier
2012-10-30 4:10 ` Daniel Colascione
2012-10-30 13:15 ` Stefan Monnier
2012-10-30 15:01 ` Daniel Colascione
2012-10-30 18:58 ` Stefan Monnier
2012-10-30 20:12 ` Daniel Colascione
2012-10-30 21:24 ` Stefan Monnier
2012-10-30 21:34 ` Daniel Colascione
2012-10-31 3:41 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5088B1F4.90302@dancol.org \
--to=dancol@dancol.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.