unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] emacs lib-src/ChangeLog lib-src/emacsclient.c l...
       [not found] <E1Lh2e7-0006nh-EY@cvs.savannah.gnu.org>
@ 2009-03-10 15:13 ` Juanma Barranquero
  2009-03-10 15:58   ` Stefan Monnier
  2009-03-10 18:05   ` Sebastian Rose
  0 siblings, 2 replies; 5+ messages in thread
From: Juanma Barranquero @ 2009-03-10 15:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

On Tue, Mar 10, 2009 at 15:09, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

>        * emacsclient.c (main): Always pass cwd via "-dir".  Pass the file
>        names without prepending cwd to them, so Emacs uses its customary
>        rules to determine how to interpret the file name.

This change breaks useful Windows behavior.

Previously:

  C:\> g:
  G:\> cd test
  G:\test> c:
  C:\> emacsclient g:myfile.txt

opened g:\test\myfile.txt. Now it tries to open g:/myfile.txt.

The problem is that the "Emacs [...] customary rules to determine how
to interpret the file name" do not help, because the interpretation of
g:myfile.txt depends on the shell where you do run emacsclient (you
can perfectly have two different default directories in g: in
different shell invocations).

    Juanma




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Emacs-diffs] emacs lib-src/ChangeLog lib-src/emacsclient.c l...
  2009-03-10 15:13 ` [Emacs-diffs] emacs lib-src/ChangeLog lib-src/emacsclient.c l Juanma Barranquero
@ 2009-03-10 15:58   ` Stefan Monnier
  2009-03-11  0:57     ` Juanma Barranquero
  2009-03-10 18:05   ` Sebastian Rose
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2009-03-10 15:58 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Emacs developers

>>        * emacsclient.c (main): Always pass cwd via "-dir".  Pass the file
>>        names without prepending cwd to them, so Emacs uses its customary
>>        rules to determine how to interpret the file name.

> This change breaks useful Windows behavior.

> Previously:

>   C:\> g:
>   G:\> cd test
>   G:\test> c:
>   C:\> emacsclient g:myfile.txt

> opened g:\test\myfile.txt. Now it tries to open g:/myfile.txt.

> The problem is that the "Emacs [...] customary rules to determine how
> to interpret the file name" do not help, because the interpretation of
> g:myfile.txt depends on the shell where you do run emacsclient (you
> can perfectly have two different default directories in g: in
> different shell invocations).

Hmmm.... does the patch below help?  If so, please install it,


        Stefan


--- emacsclient.c.~1.155.~	2009-03-10 11:49:18.000000000 -0400
+++ emacsclient.c	2009-03-10 11:56:38.000000000 -0400
@@ -1635,6 +1635,26 @@
                   continue;
                 }
             }
+#ifdef WINDOWSNT
+	  else if (! file_name_absolute_p (argv[i])
+		   && (isalpha (argv[i][0]) && argv[i][1] == ':'))
+	    /* Windows can have a different default directory for each
+	       drive, so the cwd passed via "-dir" is not sufficient
+	       to account for that.
+	       If the user uses <drive>:<relpath>, we hence need to be
+	       careful to expand <relpath> with the default directory
+	       corresponding to <drive>.  */
+	    {
+	      char *filename = (char *) xmalloc (MAX_PATH);
+	      DWORD size;
+
+	      size = GetFullPathName (argv[i], MAX_PATH, filename, NULL);
+	      if (size > 0 && size < MAX_PATH)
+		argv[i] = filename;
+	      else
+		free (filename);
+	    }
+#endif
 
           send_to_emacs (emacs_socket, "-file ");
           quote_argument (emacs_socket, argv[i]);




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Emacs-diffs] emacs lib-src/ChangeLog lib-src/emacsclient.c l...
  2009-03-10 15:13 ` [Emacs-diffs] emacs lib-src/ChangeLog lib-src/emacsclient.c l Juanma Barranquero
  2009-03-10 15:58   ` Stefan Monnier
@ 2009-03-10 18:05   ` Sebastian Rose
  2009-03-11  1:29     ` Stefan Monnier
  1 sibling, 1 reply; 5+ messages in thread
From: Sebastian Rose @ 2009-03-10 18:05 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Stefan Monnier, Emacs developers

Juanma Barranquero <lekktu@gmail.com> writes:
> On Tue, Mar 10, 2009 at 15:09, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
>>        * emacsclient.c (main): Always pass cwd via "-dir".  Pass the file
>>        names without prepending cwd to them, so Emacs uses its customary
>>        rules to determine how to interpret the file name.
>
> This change breaks useful Windows behavior.
>
> Previously:
>
>   C:\> g:
>   G:\> cd test
>   G:\test> c:
>   C:\> emacsclient g:myfile.txt
>
> opened g:\test\myfile.txt. Now it tries to open g:/myfile.txt.
>
> The problem is that the "Emacs [...] customary rules to determine how
> to interpret the file name" do not help, because the interpretation of
> g:myfile.txt depends on the shell where you do run emacsclient (you
> can perfectly have two different default directories in g: in
> different shell invocations).
>
>     Juanma

I think that indeed emacsclient should behave like most other
applications do these days, and always request absolute filenames of the
form:

   Protocol://path/to/resource

(NOTE: no special OS dependend directory separator)
In your example:

   g:/myfile.txt

which is what you requested, but for another reason I believe.
`g:' should be considered a _protocol_ `g' and therefore map to
`g:/myfile'.

See rfc1738 section 2.1 for more on this.



If emacsclient finds a relative filename that is

  1.) not starting with a protocol
  2.) not starting with a slash

it should try to make it absolute and add the `file:' protocol.

That way emacsclient would become much more usefull, than it is now.



We can open `file:///home/sebastian/.emacs' through find-file, but not
through `emacsclient file:///home/sebastian/.emacs' which is a bug
IMHO.




Best regards,

-- 
Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover
Tel.:  +49 (0)511 - 36 58 472
Fax:   +49 (0)1805 - 233633 - 11044
mobil: +49 (0)173 - 83 93 417
Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
Http:  www.emma-stil.de




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Emacs-diffs] emacs lib-src/ChangeLog lib-src/emacsclient.c l...
  2009-03-10 15:58   ` Stefan Monnier
@ 2009-03-11  0:57     ` Juanma Barranquero
  0 siblings, 0 replies; 5+ messages in thread
From: Juanma Barranquero @ 2009-03-11  0:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

On Tue, Mar 10, 2009 at 16:58, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> Hmmm.... does the patch below help?  If so, please install it,

Yes. Applied.

Thanks,

    Juanma




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Emacs-diffs] emacs lib-src/ChangeLog lib-src/emacsclient.c l...
  2009-03-10 18:05   ` Sebastian Rose
@ 2009-03-11  1:29     ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2009-03-11  1:29 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Juanma Barranquero, Emacs developers

> We can open `file:///home/sebastian/.emacs' through find-file, but not
> through `emacsclient file:///home/sebastian/.emacs' which is a bug
> IMHO.

As mentioned in the parent of the article to which you replied,
"emacsclient file:///home/sebastian/.emacs" should now work,


        Stefan




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-11  1:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1Lh2e7-0006nh-EY@cvs.savannah.gnu.org>
2009-03-10 15:13 ` [Emacs-diffs] emacs lib-src/ChangeLog lib-src/emacsclient.c l Juanma Barranquero
2009-03-10 15:58   ` Stefan Monnier
2009-03-11  0:57     ` Juanma Barranquero
2009-03-10 18:05   ` Sebastian Rose
2009-03-11  1:29     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).