Well, I never found a "natural" way to handle DOS pathnames, but the following seems to do what I want.

 

(defun dos-find-file-hook ()

  "Handle DOS path names by converting them to CYGWIN paths."

  (let ((fname "dos-find-file-hook")

     (dos-path-re ".+/\\(?1:.\\):\\(?2:.+$\\)")

     (dos-drive)

     (dos-path)

     (cygwin-path)

     (filename (buffer-file-name))

     (dos-to-cygwin-path (lambda (p)

                      (let ((ret p))

                     (while (string-match (regexp-quote "\\") ret)

                       (setq ret (concat (substring ret 0 (match-beginning 0)) "/" (substring ret (match-end 0)))))

                     ret))))

    (cond ((string-match dos-path-re filename)

        (setq dos-drive (substring filename (match-beginning 1) (match-end 1)))

        (setq dos-path  (substring filename (match-beginning 2) (match-end 2)))

        (setq cygwin-path (concat "/cygdrive/"

                          dos-drive

                          ;; Ensure a '/' here.

                          (unless (string-match (concat "^" (regexp-quote "\\")) dos-path) "/")

                          (funcall dos-to-cygwin-path dos-path)))

        (find-file cygwin-path)

        ;; emacs under CYGWIN is smart enough to know that this is the same file,

        ;; so we don't have to clean up.

        ;; I.e. No need to kill a buffer named after a DOS file.

        )

       (t t))))

 

(add-hook 'find-file-hooks 'dos-find-file-hook)

 

,Doug

 

 

From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On Behalf Of Doug Lewan
Sent: Wednesday, 2012 June 20 09:54
To: help-gnu-emacs@gnu.org
Subject: emacsclient under windows

 

I'd like to use emacsclient as an editor under windows. That is I'd like to have it be the default editor for an application that we use.

 

Of course, that application [sometimes] uses windows-style paths and those paths aren't handled well by either emacs or emacsclient. (It looks like both, I'm guessing.)

 

Is there a "correct" and "natural way" of getting emacs to recognize things like X:\your\name\here?

 

,Douglas

Douglas Lewan

Shubert Ticketing

(201) 489-8600 ext 224