From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Doug Lewan Newsgroups: gmane.emacs.help Subject: RE: emacsclient under windows Date: Thu, 21 Jun 2012 15:57:15 +0000 Message-ID: <155DEC68569B714B86C2C7075F5EDA980AE13905@DAKIYA1.pegasus.local> References: <155DEC68569B714B86C2C7075F5EDA980AE127D4@DAKIYA1.pegasus.local> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_155DEC68569B714B86C2C7075F5EDA980AE13905DAKIYA1pegasusl_" X-Trace: dough.gmane.org 1340294258 3819 80.91.229.3 (21 Jun 2012 15:57:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 21 Jun 2012 15:57:38 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 21 17:57:37 2012 Return-path: Envelope-to: geh-help-gnu-emacs@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 1ShjlG-0002aM-Fh for geh-help-gnu-emacs@m.gmane.org; Thu, 21 Jun 2012 17:57:34 +0200 Original-Received: from localhost ([::1]:45791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShjlG-00014O-B2 for geh-help-gnu-emacs@m.gmane.org; Thu, 21 Jun 2012 11:57:34 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Shjl9-00013h-S5 for help-gnu-emacs@gnu.org; Thu, 21 Jun 2012 11:57:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Shjl2-0001RG-7x for help-gnu-emacs@gnu.org; Thu, 21 Jun 2012 11:57:27 -0400 Original-Received: from mailhost.shubertorg.com ([207.246.209.200]:30040 helo=webmail.shubertorg.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Shjl2-0001QS-2U for help-gnu-emacs@gnu.org; Thu, 21 Jun 2012 11:57:20 -0400 Original-Received: from dakiya1.pegasus.local ([::1]) by DAKIYA1.pegasus.local ([::1]) with mapi id 14.01.0339.001; Thu, 21 Jun 2012 11:57:16 -0400 Thread-Topic: emacsclient under windows Thread-Index: Ac1O7CM0RlLoNNUERsCJ36ENDltwCwA2gsKg In-Reply-To: <155DEC68569B714B86C2C7075F5EDA980AE127D4@DAKIYA1.pegasus.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.21.202] X-detected-operating-system: by eggs.gnu.org: Windows XP/2000 (RFC1323+, w+, tstamp-) X-Received-From: 207.246.209.200 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:85353 Archived-At: --_000_155DEC68569B714B86C2C7075F5EDA980AE13905DAKIYA1pegasusl_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Well, I never found a "natural" way to handle DOS pathnames, but the follow= ing 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=3Dshubertticketing.com@gnu.org [mailto:h= elp-gnu-emacs-bounces+dougl=3Dshubertticketing.com@gnu.org] On Behalf Of Do= ug 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 bo= th, 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 --_000_155DEC68569B714B86C2C7075F5EDA980AE13905DAKIYA1pegasusl_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Well, I never found a "natural" way to han= dle 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)<= /p>

=             &nb= sp;         (let ((ret p))

=             &nb= sp;        (while (string-match (regexp-= quote "\\") ret)

=             &nb= sp;          (setq ret (concat (sub= string ret 0 (match-beginning 0)) "/" (substring ret (match-end 0= )))))

=             &nb= sp;        ret))))

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

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

=         (setq dos-path  (substring filen= ame (match-beginning 2) (match-end 2)))

=         (setq cygwin-path (concat "/cygd= rive/"

=             &nb= sp;             dos-= drive

=             &nb= sp;             ;; E= nsure a '/' here.

=             &nb= sp;             (unl= ess (string-match (concat "^" (regexp-quote "\\")) dos-= path) "/")

=             &nb= sp;             (fun= call 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 name= d after a DOS file.

=         )

=        (t t))))

=  

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

 

,Doug

 

 

From: help-gnu= -emacs-bounces+dougl=3Dshubertticketing.com@gnu.org [mailto:help-gnu-em= acs-bounces+dougl=3Dshubertticketing.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 windo= ws. That is I'd like to have it be the default editor for an application th= at we use.

 

Of course, that application [sometimes] uses windows= -style paths and those paths aren't handled well by either emacs or emacscl= ient. (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

 

 

--_000_155DEC68569B714B86C2C7075F5EDA980AE13905DAKIYA1pegasusl_--