all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Doug Lewan <dougl@shubertticketing.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: emacsclient under windows
Date: Thu, 21 Jun 2012 15:57:15 +0000	[thread overview]
Message-ID: <155DEC68569B714B86C2C7075F5EDA980AE13905@DAKIYA1.pegasus.local> (raw)
In-Reply-To: <155DEC68569B714B86C2C7075F5EDA980AE127D4@DAKIYA1.pegasus.local>

[-- Attachment #1: Type: text/plain, Size: 2240 bytes --]

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



[-- Attachment #2: Type: text/html, Size: 9354 bytes --]

      parent reply	other threads:[~2012-06-21 15:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20 13:53 emacsclient under windows Doug Lewan
2012-06-20 14:00 ` Juanma Barranquero
2012-06-20 14:01   ` Juanma Barranquero
2012-06-20 14:23   ` Doug Lewan
2012-06-20 14:29     ` Juanma Barranquero
2012-06-20 16:41     ` Eli Zaretskii
2012-06-21 19:42     ` Ken Goldman
2012-06-21 15:57 ` Doug Lewan [this message]

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=155DEC68569B714B86C2C7075F5EDA980AE13905@DAKIYA1.pegasus.local \
    --to=dougl@shubertticketing.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.