unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Using emerge on windows? Funky errors with Temp files
@ 2011-03-18 21:23 fork
  2011-03-18 21:31 ` fork
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: fork @ 2011-03-18 21:23 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all, 

Is there a trick to getting emerge to work on a Windows machine?  I installed
GetGnuWin32 for my Gnu tools, set up my paths (am able to run "ls").  Then I
loaded two files and tried to emerge-buffers, but get the following error:

diff: c:/DOCUME\~1/webbs/LOCALS\~1/Temp/emergeA4208Vv8: No such file or directory
diff: c:/DOCUME\~1/webbs/LOCALS\~1/Temp/emergeB4208e2I: No such file or directory

There is output in the *merge* buffer, but it is just one of the files.

Note -- I am an emerge newbie, so, um, be gentle..

Tx!




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

* Re: Using emerge on windows? Funky errors with Temp files
  2011-03-18 21:23 fork
@ 2011-03-18 21:31 ` fork
  2011-03-18 21:54   ` Eli Zaretskii
  2011-03-18 21:36 ` Eli Zaretskii
  2011-03-18 21:48 ` Eli Zaretskii
  2 siblings, 1 reply; 12+ messages in thread
From: fork @ 2011-03-18 21:31 UTC (permalink / raw)
  To: help-gnu-emacs

fork <forkandwait <at> gmail.com> writes:

> 
> Hi all, 
> 
> Is there a trick to getting emerge to work on a Windows machine? 

Well, maybe set the temp directory to to something that actually exists? Like:

(setq temporary-file-directory "C:\\Temp")

I still haven't figured out emerge, but that's another story...




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

* Re: Using emerge on windows? Funky errors with Temp files
  2011-03-18 21:23 fork
  2011-03-18 21:31 ` fork
@ 2011-03-18 21:36 ` Eli Zaretskii
  2011-03-18 21:48 ` Eli Zaretskii
  2 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2011-03-18 21:36 UTC (permalink / raw)
  To: help-gnu-emacs

> From: fork <forkandwait@gmail.com>
> Date: Fri, 18 Mar 2011 21:23:07 +0000 (UTC)
> 
> Is there a trick to getting emerge to work on a Windows machine?  I installed
> GetGnuWin32 for my Gnu tools, set up my paths (am able to run "ls").  Then I
> loaded two files and tried to emerge-buffers, but get the following error:
> 
> diff: c:/DOCUME\~1/webbs/LOCALS\~1/Temp/emergeA4208Vv8: No such file or directory
> diff: c:/DOCUME\~1/webbs/LOCALS\~1/Temp/emergeB4208e2I: No such file or directory

It's a bug.  Please "M-x report-emacs-bug RET".

I'm working on a fix.



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

* Re: Using emerge on windows? Funky errors with Temp files
  2011-03-18 21:23 fork
  2011-03-18 21:31 ` fork
  2011-03-18 21:36 ` Eli Zaretskii
@ 2011-03-18 21:48 ` Eli Zaretskii
  2 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2011-03-18 21:48 UTC (permalink / raw)
  To: help-gnu-emacs

> From: fork <forkandwait@gmail.com>
> Date: Fri, 18 Mar 2011 21:23:07 +0000 (UTC)
> 
> diff: c:/DOCUME\~1/webbs/LOCALS\~1/Temp/emergeA4208Vv8: No such file or directory
> diff: c:/DOCUME\~1/webbs/LOCALS\~1/Temp/emergeB4208e2I: No such file or directory

The patch below should set you up.  (Don't forget to recompile
emerge.el, and then load it or restart Emacs.)

--- lisp/emerge.el~	2011-03-10 19:56:29.093750000 +0200
+++ lisp/emerge.el	2011-03-18 23:42:32.078125000 +0200
@@ -3187,21 +3187,26 @@
 
 ;; Metacharacters that have to be protected from the shell when executing
 ;; a diff/diff3 command.
-(defcustom emerge-metachars "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]"
-  "Characters that must be quoted with \\ when used in a shell command line.
+(defcustom emerge-metachars
+  (if (memq system-type '(ms-dos windows-nt))
+      "[ \t\"&<=>?*^|]"
+    "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]")
+  "Characters that must be quoted when used in a shell command line.
 More precisely, a [...] regexp to match any one such character."
   :type 'regexp
   :group 'emerge)
 
 ;; Quote metacharacters (using \) when executing a diff/diff3 command.
 (defun emerge-protect-metachars (s)
-  (let ((limit 0))
-    (while (string-match emerge-metachars s limit)
-      (setq s (concat (substring s 0 (match-beginning 0))
-		      "\\"
-		      (substring s (match-beginning 0))))
-      (setq limit (1+ (match-end 0)))))
-  s)
+  (if (memq system-type '(ms-dos windows-nt))
+      (shell-quote-argument s)
+    (let ((limit 0))
+      (while (string-match emerge-metachars s limit)
+	(setq s (concat (substring s 0 (match-beginning 0))
+			"\\"
+			(substring s (match-beginning 0))))
+	(setq limit (1+ (match-end 0)))))
+    s))
 
 (provide 'emerge)
 



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

* Re: Using emerge on windows? Funky errors with Temp files
  2011-03-18 21:31 ` fork
@ 2011-03-18 21:54   ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2011-03-18 21:54 UTC (permalink / raw)
  To: help-gnu-emacs

> From: fork <forkandwait@gmail.com>
> Date: Fri, 18 Mar 2011 21:31:23 +0000 (UTC)
> 
> Well, maybe set the temp directory to to something that actually exists? Like:
> 
> (setq temporary-file-directory "C:\\Temp")

The temporary directory used by emerge by default is
"c:/DOCUME~1/webbs/LOCALS~1/Temp/", and it surely exists, albeit you
are probably used to its full name:

   c:/Documents and Settings/webbs/Local Settings/Temp/

(The name emerge uses is the 8+3 alias of the full name.)

The problem is that emerge.el had a bug whereby it would escape the
"~" characters with a backslash, which produces an invalid file name
on Windows (because the Windows shell does not treat a backslash as a
quote character).  The patch I sent solves this.



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

* Re: Using emerge on windows? Funky errors with Temp files
       [not found] <mailman.14.1300483407.31996.help-gnu-emacs@gnu.org>
@ 2011-03-19  2:02 ` Stefan Monnier
  2011-03-19  8:08   ` David Kastrup
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2011-03-19  2:02 UTC (permalink / raw)
  To: help-gnu-emacs

> Note -- I am an emerge newbie, so, um, be gentle..

BTW, is there a particular reason you use emerge rather than ediff3?
I thought emerge was only used by old-time users, all new ones
preferring the snazzier ediff3.


        Stefan


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

* Re: Using emerge on windows? Funky errors with Temp files
  2011-03-19  2:02 ` Using emerge on windows? Funky errors with Temp files Stefan Monnier
@ 2011-03-19  8:08   ` David Kastrup
  2011-03-22  1:05     ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: David Kastrup @ 2011-03-19  8:08 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Note -- I am an emerge newbie, so, um, be gentle..
>
> BTW, is there a particular reason you use emerge rather than ediff3?
> I thought emerge was only used by old-time users, all new ones
> preferring the snazzier ediff3.

AFAIK, ediff does not have an interface for commandline usage as an
external merge resolution tool.

-- 
David Kastrup


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

* Re: Using emerge on windows? Funky errors with Temp files
  2011-03-19  8:08   ` David Kastrup
@ 2011-03-22  1:05     ` Stefan Monnier
  2011-03-22  8:01       ` David Kastrup
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2011-03-22  1:05 UTC (permalink / raw)
  To: help-gnu-emacs

>>> Note -- I am an emerge newbie, so, um, be gentle..
>> BTW, is there a particular reason you use emerge rather than ediff3?
>> I thought emerge was only used by old-time users, all new ones
>> preferring the snazzier ediff3.
> AFAIK, ediff does not have an interface for commandline usage as an
> external merge resolution tool.

That'd be easy to add, I'm sure.


        Stefan


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

* Re: Using emerge on windows? Funky errors with Temp files
  2011-03-22  1:05     ` Stefan Monnier
@ 2011-03-22  8:01       ` David Kastrup
  2011-03-23  2:56         ` Kevin Rodgers
       [not found]         ` <mailman.2.1300849017.12215.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 12+ messages in thread
From: David Kastrup @ 2011-03-22  8:01 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>>> Note -- I am an emerge newbie, so, um, be gentle..
>>> BTW, is there a particular reason you use emerge rather than ediff3?
>>> I thought emerge was only used by old-time users, all new ones
>>> preferring the snazzier ediff3.
>> AFAIK, ediff does not have an interface for commandline usage as an
>> external merge resolution tool.
>
> That'd be easy to add, I'm sure.

I once tried for about a week (since i would have liked to have ediff be
an option for merge resolution in git) and then gave up.  ediff is a
maze of twisty little hooks and indirections, catering without useful
documentation for everything except that which you'd actually need.

In any case, "that'd be easy to add" is nothing that is going to make
users switch.  The proof is in the pudding.

-- 
David Kastrup


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

* Re: Using emerge on windows? Funky errors with Temp files
  2011-03-22  8:01       ` David Kastrup
@ 2011-03-23  2:56         ` Kevin Rodgers
       [not found]         ` <mailman.2.1300849017.12215.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Kevin Rodgers @ 2011-03-23  2:56 UTC (permalink / raw)
  To: help-gnu-emacs

On 3/22/11 2:01 AM, David Kastrup wrote:
> Stefan Monnier<monnier@iro.umontreal.ca>  writes:
>
>>>>> Note -- I am an emerge newbie, so, um, be gentle..
>>>> BTW, is there a particular reason you use emerge rather than ediff3?
>>>> I thought emerge was only used by old-time users, all new ones
>>>> preferring the snazzier ediff3.
>>> AFAIK, ediff does not have an interface for commandline usage as an
>>> external merge resolution tool.
>>
>> That'd be easy to add, I'm sure.
>
> I once tried for about a week (since i would have liked to have ediff be
> an option for merge resolution in git) and then gave up.  ediff is a
> maze of twisty little hooks and indirections, catering without useful
> documentation for everything except that which you'd actually need.
>
> In any case, "that'd be easy to add" is nothing that is going to make
> users switch.  The proof is in the pudding.

I have this in my ~/.emacs to run ediff-files.  I think you just need to add
file-c in the obvious way to call ediff3 instead:

(defun diff-command-line-args (switch)
   "Run `ediff-files' on the following 2 command line arguments (after SWITCH)."
   ;; (prog1 ...) == (pop command-line-args-left):
   (let ((file-a (prog1 (car command-line-args-left)
		  (setq command-line-args-left
			(cdr command-line-args-left))))
         (file-b (prog1 (car command-line-args-left)
		  (setq command-line-args-left
			(cdr command-line-args-left)))))
     (ediff-files file-a file-b)))

(setq command-switch-alist
       (cons '("--diff" . diff-command-line-args) command-switch-alist))

-- 
Kevin Rodgers
Denver, Colorado, USA




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

* Re: Using emerge on windows? Funky errors with Temp files
       [not found]         ` <mailman.2.1300849017.12215.help-gnu-emacs@gnu.org>
@ 2011-03-23  7:23           ` David Kastrup
  2011-03-25  3:55             ` Kevin Rodgers
  0 siblings, 1 reply; 12+ messages in thread
From: David Kastrup @ 2011-03-23  7:23 UTC (permalink / raw)
  To: help-gnu-emacs

Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:

> On 3/22/11 2:01 AM, David Kastrup wrote:
>> Stefan Monnier<monnier@iro.umontreal.ca>  writes:
>>
>>>>>> Note -- I am an emerge newbie, so, um, be gentle..
>>>>> BTW, is there a particular reason you use emerge rather than ediff3?
>>>>> I thought emerge was only used by old-time users, all new ones
>>>>> preferring the snazzier ediff3.
>>>> AFAIK, ediff does not have an interface for commandline usage as an
>>>> external merge resolution tool.
>>>
>>> That'd be easy to add, I'm sure.
>>
>> I once tried for about a week (since i would have liked to have ediff be
>> an option for merge resolution in git) and then gave up.  ediff is a
>> maze of twisty little hooks and indirections, catering without useful
>> documentation for everything except that which you'd actually need.
>>
>> In any case, "that'd be easy to add" is nothing that is going to make
>> users switch.  The proof is in the pudding.
>
> I have this in my ~/.emacs to run ediff-files.  I think you just need to add
> file-c in the obvious way to call ediff3 instead:
>
> (defun diff-command-line-args (switch)
>   "Run `ediff-files' on the following 2 command line arguments (after SWITCH)."
>   ;; (prog1 ...) == (pop command-line-args-left):
>   (let ((file-a (prog1 (car command-line-args-left)
> 		  (setq command-line-args-left
> 			(cdr command-line-args-left))))
>         (file-b (prog1 (car command-line-args-left)
> 		  (setq command-line-args-left
> 			(cdr command-line-args-left)))))
>     (ediff-files file-a file-b)))
>
> (setq command-switch-alist
>       (cons '("--diff" . diff-command-line-args) command-switch-alist))

There is more to it than that, like exit status.  And IIRC, ediff-files
returned more or less immediately, basically just starting the ediff.

-- 
David Kastrup


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

* Re: Using emerge on windows? Funky errors with Temp files
  2011-03-23  7:23           ` David Kastrup
@ 2011-03-25  3:55             ` Kevin Rodgers
  0 siblings, 0 replies; 12+ messages in thread
From: Kevin Rodgers @ 2011-03-25  3:55 UTC (permalink / raw)
  To: help-gnu-emacs

On 3/23/11 1:23 AM, David Kastrup wrote:
> Kevin Rodgers<kevin.d.rodgers@gmail.com>  writes:
...
>> I have this in my ~/.emacs to run ediff-files.  I think you just need to add
>> file-c in the obvious way to call ediff3 instead:
>>
>> (defun diff-command-line-args (switch)
>>    "Run `ediff-files' on the following 2 command line arguments (after SWITCH)."
>>    ;; (prog1 ...) == (pop command-line-args-left):
>>    (let ((file-a (prog1 (car command-line-args-left)
>> 		  (setq command-line-args-left
>> 			(cdr command-line-args-left))))
>>          (file-b (prog1 (car command-line-args-left)
>> 		  (setq command-line-args-left
>> 			(cdr command-line-args-left)))))
>>      (ediff-files file-a file-b)))
>>
>> (setq command-switch-alist
>>        (cons '("--diff" . diff-command-line-args) command-switch-alist))
>
> There is more to it than that, like exit status.  And IIRC, ediff-files
> returned more or less immediately, basically just starting the ediff.

OK, you bit on my bait, so I'll reciprocate:

What exit status should be returned to the caller under what circumstances?

Once that's understood, just call kill-emacs:

,----
| kill-emacs is an interactive built-in function in `C source code'.
|
| (kill-emacs &optional ARG)
|
| Exit the Emacs job and kill it.
| If ARG is an integer, return ARG as the exit program code.
| If ARG is a string, stuff it as keyboard input.
|
| The value of `kill-emacs-hook', if not void,
| is a list of functions (of no args),
| all of which are called before Emacs is actually killed.
|
| [back]
`----

-- 
Kevin Rodgers
Denver, Colorado, USA




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

end of thread, other threads:[~2011-03-25  3:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.14.1300483407.31996.help-gnu-emacs@gnu.org>
2011-03-19  2:02 ` Using emerge on windows? Funky errors with Temp files Stefan Monnier
2011-03-19  8:08   ` David Kastrup
2011-03-22  1:05     ` Stefan Monnier
2011-03-22  8:01       ` David Kastrup
2011-03-23  2:56         ` Kevin Rodgers
     [not found]         ` <mailman.2.1300849017.12215.help-gnu-emacs@gnu.org>
2011-03-23  7:23           ` David Kastrup
2011-03-25  3:55             ` Kevin Rodgers
2011-03-18 21:23 fork
2011-03-18 21:31 ` fork
2011-03-18 21:54   ` Eli Zaretskii
2011-03-18 21:36 ` Eli Zaretskii
2011-03-18 21:48 ` Eli Zaretskii

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).