[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacsclient: support `/' directory separator on w32

From: Lennart Borgman
Subject: Re: emacsclient: support `/' directory separator on w32
Date: Wed, 29 Nov 2006 00:12:00 +0100
User-agent: Thunderbird (Windows/20061025)

Eli Zaretskii wrote:
Date: Tue, 28 Nov 2006 16:43:18 +0100
From: Lennart Borgman <address@hidden>
Cc: Juanma Barranquero <address@hidden>, address@hidden

Emacsclient knows which args are file names and sends cwd just before the file name so it seems easy to fix. I am going to try later today.

No, please don't!  This is an obscure and little-used case; rocking
the pretest boat for its sake is entirely inappropriate!

I decided to test since I consider it a bug. It is easy to fix once you understand the pretty obscure code in emacsclient.c. I have tested a little change like this:

  if ((argc - optind > 0))
      for (i = optind; i < argc; i++)
          int is_file;
          is_file = 0;
          if (eval)
            ; /* Don't prepend any cwd or anything like that.  */
          else if (*argv[i] == '+')
              char *p = argv[i] + 1;
              while (isdigit ((unsigned char) *p) || *p == ':') p++;
              if (*p != 0)
                  trace("+ obscure path\n");
                  SEND_QUOTED (cwd);
                  SEND_STRING ("/");
          else //if (! file_name_absolute_p (argv[i]))
              //SEND_QUOTED (cwd);
              //SEND_STRING ("/");
              /* It is a file name, expand it! */
              trace("file path\n");
              is_file = 1;
              expand_file_name(cwd, argv[i], srvfile);

          trace("is_file=%d\n", is_file);
          if (is_file)
            SEND_QUOTED (srvfile);
            SEND_QUOTED (argv[i]);
          SEND_STRING (" ");

The only important change here is that the expanding to an absolute file name is made explicit and therefore is easier to understand and to make system independent. You can see what I have commented out and the call to expand_file_name (which I just wrote, nothing special, just what we just wrote about for w32 and the same as above for other systems).

This works pretty well I believe. I will distribute it with my patched version and would be glad if we used it in the official version.

Gnuclient also had this bug before and I was quite disturbed of by it.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]