From owner-ntemacs-users@cs.washington.edu  Thu Jun 12 12:37:16 1997
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Thu" "12" "June" "1997" "13:58:14" "-0500" "Dean Andrews" "dean@dra.com" nil "104" "RE: adjusting dos filename in elisp?" "^From:" nil nil "6" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with SMTP id MAA09976 for <voelker@june.cs.washington.edu>; Thu, 12 Jun 1997 12:37:16 -0700
Received: from trout.cs.washington.edu (trout.cs.washington.edu [128.95.1.178]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id MAA41502 for <voelker@joker.cs.washington.edu>; Thu, 12 Jun 1997 12:37:14 -0700
Received: (majordom@localhost) by trout.cs.washington.edu (8.8.5+CS/7.2ws+) id LAA06094 for ntemacs-users-outgoing; Thu, 12 Jun 1997 11:57:34 -0700 (PDT)
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by trout.cs.washington.edu (8.8.5+CS/7.2ws+) with ESMTP id LAA06089 for <ntemacs-users@trout.cs.washington.edu>; Thu, 12 Jun 1997 11:57:29 -0700 (PDT)
Received: from mail.dra.com (mail.dra.com [192.65.218.159]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with ESMTP id LAA06052 for <ntemacs-users@cs.washington.edu>; Thu, 12 Jun 1997 11:57:28 -0700
Received: from stlmail.dra.com (stlmail.dra.com [192.65.218.119]) 	by mail.dra.com (8.8.5/8.8.5) with SMTP id NAA18085 	for <ntemacs-users@cs.washington.edu>; Thu, 12 Jun 1997 13:57:27 -0500 (CDT)
Received: by stlmail.dra.com with SMTP (Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63) 	id <01BC7738.8FF2F6F0@stlmail.dra.com>; Thu, 12 Jun 1997 13:57:27 -0500
Message-ID: <c=US%a=_%p=Data_Research_As%l=NLXMAIL-970612185814Z-2802@stlmail.dra.com>
X-Mailer:  Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Precedence: bulk
From: Dean Andrews <dean@dra.com>
Sender: owner-ntemacs-users@cs.washington.edu
To: "'ntemacs-users@cs.washington.edu'" <ntemacs-users@cs.washington.edu>,         "'Janus'" <janus@eskimo.com>
Subject: RE: adjusting dos filename in elisp?
Date: Thu, 12 Jun 1997 13:58:14 -0500

On Thursday, June 12, 1997 9:55 AM, Janus[SMTP:janus@eskimo.com] wrote:
> Hi all,
> 
> I'm trying to use Gnudoit to get emacs to print a file from Explorer,
> but all I can't find any built in functions to convert a path like
> "C:\foo.bar" into "C:/foo.bar" for passing into find-file, and I'm
> not good enough in elisp to write even a simple string replacement.
>[...] 
> Any suggestions?
> 
> Steven Tate
> 
The problem is that when elisp interprets the string it performs 
the translation so any elisp sees control characters.
Unless you want to convert from control characters to their \c equivalent
the translation has to be performed within gnudoit.

I had this working for me under a much previous version.  But with
gnudoit.cpp, there where too many changes to simply re-apply the patch
and since I no longer used it anymore, I didn't bother to emerge.

In gnudoit.c the changes would be:
c:\emacs-19.31\gnuserv>diff -C3 gnudoit.c.orig gnudoit.c
diff -C3 gnudoit.c.orig gnudoit.c
*** gnudoit.c.orig	Tue Jan 07 16:45:04 1997
--- gnudoit.c	Wed Dec 18 11:40:58 1996
***************
*** 43,48 ****
--- 43,49 ----
       char *argv[];
  {
    int    qflg   = 0;			 /* quick edit */
+   int    fflg   = 0;			 /* translate msdos filenames */
    int    dbgflg = 0;			 /* debug flag */
    int    errflg = 0;			 /* option error */
    int    c;				 /* char from getopt */
***************
*** 56,64 ****
  
    progname = argv[0];
  
    /* Parse arguments */
!   while ((c = getopt(argc, argv, "h:qd?" )) != EOF)
      switch (c) {
      case 'q':
        qflg++;
        break;
--- 57,73 ----
  
    progname = argv[0];
  
+ #ifdef WIN_VERSION
+   qflg++;
+ #endif
+ 
    /* Parse arguments */
!   while ((c = getopt(argc, argv, "h:fqd?" )) != EOF)
      switch (c) {
+     case 'f':
+       fflg++;
+       break;
+ 
      case 'q':
        qflg++;
        break;
***************
*** 112,118 ****
    {
      for (; optind < argc; optind++)
        {
! 	SendString (h, argv[optind]);
  	SendString (h, " ");
  	
  	if (dbgflg)
--- 121,148 ----
    {
      for (; optind < argc; optind++)
        {
! 	if (fflg) {
! 	  char buf[2048], *arg = argv[optind];
! 	  int i=0, o=0;
! 	  while (arg[i]) 
! 	    if ('\\' == arg[i]) {
! 	      if ('"' == arg[i+1]) {
! 		buf[o++] = arg[i+1];
! 		i += 2;
! 	      }
! 	      else {
! 		buf[o++] = '\\';
! 		buf[o++] = '\\';
! 		i++;
! 	      };
! 	    }
! 	    else
! 	      buf[o++] = arg[i++];
! 	  buf[o++]=0;
! 	  SendString (h, buf);
! 	}
! 	else
! 	  SendString (h, argv[optind]);
  	SendString (h, " ");
  	
  	if (dbgflg)


From owner-ntemacs-users@cs.washington.edu  Thu Jun 12 14:31:18 1997
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Thu" "12" "June" "1997" "16:54:00" "-0400" "Peter Breton" "pbreton@i-kinetics.com" nil "30" "RE: adjusting dos filename in elisp?" "^From:" nil nil "6" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with SMTP id OAA18402 for <voelker@june.cs.washington.edu>; Thu, 12 Jun 1997 14:31:18 -0700
Received: from trout.cs.washington.edu (trout.cs.washington.edu [128.95.1.178]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id OAA41576 for <voelker@joker.cs.washington.edu>; Thu, 12 Jun 1997 14:31:17 -0700
Received: (majordom@localhost) by trout.cs.washington.edu (8.8.5+CS/7.2ws+) id NAA07724 for ntemacs-users-outgoing; Thu, 12 Jun 1997 13:56:49 -0700 (PDT)
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by trout.cs.washington.edu (8.8.5+CS/7.2ws+) with ESMTP id NAA07719 for <ntemacs-users@trout.cs.washington.edu>; Thu, 12 Jun 1997 13:56:46 -0700 (PDT)
Received: from ns.i-kinetics.com (ns.i-kinetics.com [205.181.32.10]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with ESMTP id NAA15653 for <ntemacs-users@cs.washington.edu>; Thu, 12 Jun 1997 13:56:45 -0700
Received: (from mail@localhost) by ns.i-kinetics.com (8.8.5/8.7.3) id QAA20736; Thu, 12 Jun 1997 16:33:18 -0400 (EDT)
X-Authentication-Warning: ns.i-kinetics.com: mail set sender to <pbreton@dirac.i-kinetics.com> using -f
Received: from dirac.i-kinetics.com(192.31.81.157) by ns.i-kinetics.com via smap (V2.0) 	id xma020663; Thu, 12 Jun 97 16:32:51 -0400
Received: from volte.i-kinetics.com (volte.i-kinetics.com [192.31.81.160]) 	by dirac.i-kinetics.com (8.8.5/8.8.5) with SMTP id QAA01231; 	Thu, 12 Jun 1997 16:53:14 -0400 (EDT)
Received: by volte.i-kinetics.com (SMI-8.6/SMI-SVR4) 	id QAA18830; Thu, 12 Jun 1997 16:54:00 -0400
Message-Id: <199706122054.QAA18830@volte.i-kinetics.com>
In-Reply-To: <c=US%a=_%p=Data_Research_As%l=NLXMAIL-970612185814Z-2802@stlmail.dra.com>
References: <c=US%a=_%p=Data_Research_As%l=NLXMAIL-970612185814Z-2802@stlmail.dra.com>
Reply-To: pbreton@i-kinetics.com
Mime-Version: 1.0 (generated by tm-edit 7.102)
Content-Type: text/plain; charset=US-ASCII
Precedence: bulk
From: Peter Breton <pbreton@i-kinetics.com>
Sender: owner-ntemacs-users@cs.washington.edu
To: Dean Andrews <dean@dra.com>
Cc: "'ntemacs-users@cs.washington.edu'" <ntemacs-users@cs.washington.edu>,         "'Janus'" <janus@eskimo.com>
Subject: RE: adjusting dos filename in elisp?
Date: Thu, 12 Jun 1997 16:54:00 -0400


  A different way of approaching this is to change gnuserv.el to
allow arbitrary functions to be used to find-file; then the hack
to gnudoit would not be necessary. (In general, I think the auxiliary
programs should be as simple as possible, and Lisp should be used
to customize things).

  I made this enhancement, and submitted it to the Gnuserv maintainer,
Andy Norman.  Gnuclient would have to be altered slightly to make this
change work. 

To give a concrete example, you could do:

  (defun my-special-find-file (filename)
    ;; Whatever you like here
   )	

Then from the shell:

  gnuclient -l my-special-find-file "C:\boot.ini"

I can make the patched gnuserv.el (which is backwards compatible) 
available if anyone is interested.

  I also wrote an implementation of gnuserv & friends in Java (using RMI
for transport) which demonstrates this (as well as the fact that RMI is
much higher level and much more pleasant to program), and that too is 
available to interested parties.

				Peter

From owner-ntemacs-users@cs.washington.edu  Thu Jun 12 18:50:41 1997
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Thu" "12" "June" "1997" "20:15:19" "-0500" "Dean Andrews" "dean@dra.com" nil "50" "RE: adjusting dos filename in elisp?" "^From:" nil nil "6" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with SMTP id SAA06153 for <voelker@june.cs.washington.edu>; Thu, 12 Jun 1997 18:50:40 -0700
Received: from trout.cs.washington.edu (trout.cs.washington.edu [128.95.1.178]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id SAA41144 for <voelker@joker.cs.washington.edu>; Thu, 12 Jun 1997 18:50:39 -0700
Received: (majordom@localhost) by trout.cs.washington.edu (8.8.5+CS/7.2ws+) id SAA10146 for ntemacs-users-outgoing; Thu, 12 Jun 1997 18:14:37 -0700 (PDT)
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by trout.cs.washington.edu (8.8.5+CS/7.2ws+) with ESMTP id SAA10142 for <ntemacs-users@trout.cs.washington.edu>; Thu, 12 Jun 1997 18:14:34 -0700 (PDT)
Received: from mail.dra.com (mail.dra.com [192.65.218.159]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with ESMTP id SAA03511 for <ntemacs-users@cs.washington.edu>; Thu, 12 Jun 1997 18:14:33 -0700
Received: from stlmail.dra.com (stlmail.dra.com [192.65.218.119]) 	by mail.dra.com (8.8.5/8.8.5) with SMTP id UAA20692 	for <ntemacs-users@cs.washington.edu>; Thu, 12 Jun 1997 20:14:32 -0500 (CDT)
Received: by stlmail.dra.com with SMTP (Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63) 	id <01BC776D.3DC8C640@stlmail.dra.com>; Thu, 12 Jun 1997 20:14:33 -0500
Message-ID: <c=US%a=_%p=Data_Research_As%l=NLXMAIL-970613011519Z-2931@stlmail.dra.com>
X-Mailer:  Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Precedence: bulk
From: Dean Andrews <dean@dra.com>
Sender: owner-ntemacs-users@cs.washington.edu
To: "'ntemacs-users@cs.washington.edu'" <ntemacs-users@cs.washington.edu>
Subject: RE: adjusting dos filename in elisp?
Date: Thu, 12 Jun 1997 20:15:19 -0500

By the time find-file was called with the input string 
"c:\home\emacs\.emacs.el" it had been translated to:
c:home^[macs.emacs.el
and it was already too late to translate it back.

On Thursday, June 12, 1997 1:54 PM, Peter 
Breton[SMTP:pbreton@i-kinetics.com] wrote:
>
>   A different way of approaching this is to change gnuserv.el to
> allow arbitrary functions to be used to find-file; then the hack
> to gnudoit would not be necessary. (In general, I think the 
auxiliary
gnudoit already has the ability to call any function.  This is missing 
the point that the problem is in read-from-string which is 
interpreting the \c.
> programs should be as simple as possible, and Lisp should be used
> to customize things).
>
>   I made this enhancement, and submitted it to the Gnuserv 
maintainer,
> Andy Norman.  Gnuclient would have to be altered slightly to make 
this
> change work.
gnuclient doesn't need this it already converts the slashes after 
getting the full path.
>
> To give a concrete example, you could do:
>
>   (defun my-special-find-file (filename)
>     ;; Whatever you like here
>    )	
>
> Then from the shell:
>
>   gnuclient -l my-special-find-file "C:\boot.ini"
>
> I can make the patched gnuserv.el (which is backwards compatible)
> available if anyone is interested.
>
>   I also wrote an implementation of gnuserv & friends in Java (using 
RMI
> for transport) which demonstrates this (as well as the fact that RMI 
is
> much higher level and much more pleasant to program), and that too 
is
> available to interested parties.
>
> 				Peter



From owner-ntemacs-users@cs.washington.edu  Thu Jun 12 20:17:12 1997
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil "Thu" "12" "June" "1997" "22:43:28" "-0400" "Peter Breton" "pbreton@i-kinetics.com" nil "51" "RE: adjusting dos filename in elisp?" "^From:" nil nil "6" nil nil nil nil]
	nil)
Received: from joker.cs.washington.edu (joker.cs.washington.edu [128.95.1.42]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with SMTP id UAA10456 for <voelker@june.cs.washington.edu>; Thu, 12 Jun 1997 20:17:12 -0700
Received: from trout.cs.washington.edu (trout.cs.washington.edu [128.95.1.178]) by joker.cs.washington.edu (8.6.12/7.2ws+) with ESMTP id UAA41210 for <voelker@joker.cs.washington.edu>; Thu, 12 Jun 1997 20:17:11 -0700
Received: (majordom@localhost) by trout.cs.washington.edu (8.8.5+CS/7.2ws+) id TAA12615 for ntemacs-users-outgoing; Thu, 12 Jun 1997 19:45:52 -0700 (PDT)
Received: from june.cs.washington.edu (june.cs.washington.edu [128.95.1.4]) by trout.cs.washington.edu (8.8.5+CS/7.2ws+) with ESMTP id TAA12611 for <ntemacs-users@trout.cs.washington.edu>; Thu, 12 Jun 1997 19:45:49 -0700 (PDT)
Received: from ns.i-kinetics.com (ns.i-kinetics.com [205.181.32.10]) by june.cs.washington.edu (8.8.5+CS/7.2ju) with ESMTP id TAA09027 for <ntemacs-users@cs.washington.edu>; Thu, 12 Jun 1997 19:45:47 -0700
Received: (from mail@localhost) by ns.i-kinetics.com (8.8.5/8.7.3) id WAA23629; Thu, 12 Jun 1997 22:22:18 -0400 (EDT)
X-Authentication-Warning: ns.i-kinetics.com: mail set sender to <pbreton@dirac.i-kinetics.com> using -f
Received: from dirac.i-kinetics.com(192.31.81.157) by ns.i-kinetics.com via smap (V2.0) 	id xma023627; Thu, 12 Jun 97 22:22:16 -0400
Received: from volte.i-kinetics.com (volte.i-kinetics.com [192.31.81.160]) 	by dirac.i-kinetics.com (8.8.5/8.8.5) with SMTP id WAA04995; 	Thu, 12 Jun 1997 22:42:42 -0400 (EDT)
Received: by volte.i-kinetics.com (SMI-8.6/SMI-SVR4) 	id WAA21887; Thu, 12 Jun 1997 22:43:28 -0400
Message-Id: <199706130243.WAA21887@volte.i-kinetics.com>
In-Reply-To: <c=US%a=_%p=Data_Research_As%l=NLXMAIL-970613011519Z-2931@stlmail.dra.com>
References: <c=US%a=_%p=Data_Research_As%l=NLXMAIL-970613011519Z-2931@stlmail.dra.com>
Reply-To: pbreton@i-kinetics.com
Mime-Version: 1.0 (generated by tm-edit 7.102)
Content-Type: text/plain; charset=US-ASCII
Precedence: bulk
From: Peter Breton <pbreton@i-kinetics.com>
Sender: owner-ntemacs-users@cs.washington.edu
To: Dean Andrews <dean@dra.com>
Cc: "'ntemacs-users@cs.washington.edu'" <ntemacs-users@cs.washington.edu>
Subject: RE: adjusting dos filename in elisp?
Date: Thu, 12 Jun 1997 22:43:28 -0400


 Dean> By the time find-file was called with the input string
 Dean> "c:\home\emacs\.emacs.el" it had been translated to:
 Dean> c:home^[macs.emacs.el and it was already too late to translate
 Dean> it back.

Your reasoning is flawed. The string arrives in Emacs exactly as
the client program sends it; you can confirm this by creating a
*server* buffer and watching the requests. It is certainly
possible to process the string before Emacs actually evaluates it.
For instance, you could advise the function `server-process-filter'
to do exactly the kind of processing you did in C, except that
this approach would be vastly more flexible and powerful (albeit 
slightly slower).

For example, this hack should convert slashes to backslashes
using the function I sent earlier:

(defadvice server-process-filter (before server activate)
  (ad-set-arg 1 (replace-slash (ad-get-arg 1) t)))

 >>  A different way of approaching this is to change gnuserv.el to
 >> allow arbitrary functions to be used to find-file; then the hack
 >> to gnudoit would not be necessary. 

 Dean> gnudoit already has the ability to call any function.
 Dean> This is missing the point that the problem is in
 Dean> read-from-string which is interpreting the \c.

Not at all. What I suggested was, if you want some work done on a
file, use gnuclient and a specialized Lisp function. Hacking gnudoit
to double up backslashes seems like the wrong way to go about it.

 Peter> I made this enhancement, and submitted it to the Gnuserv
 Peter> maintainer, Andy Norman.  Gnuclient would have to be altered
 Peter> slightly to make this change work.

 Dean> gnuclient doesn't need this it already converts the slashes
 Dean> after getting the full path.

Yes, I know; in fact, I wrote that code :-)

The changes to gnuclient would be to allow a -l flag to specify the
desired Lisp function. That's a very minor change, and I put it
in the Java/RMI version. It's also useful for specifying that some
files should be opened read-only, or in view-mode, etc

			Peter




