Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using emerge on windows? Funky errors with Temp files

24 views
Skip to first unread message

fork

unread,
Mar 18, 2011, 5:23:07 PM3/18/11
to help-gn...@gnu.org
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!


fork

unread,
Mar 18, 2011, 5:31:23 PM3/18/11
to help-gn...@gnu.org
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...


Eli Zaretskii

unread,
Mar 18, 2011, 5:36:25 PM3/18/11
to help-gn...@gnu.org
> From: fork <forka...@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.

Eli Zaretskii

unread,
Mar 18, 2011, 5:48:09 PM3/18/11
to help-gn...@gnu.org
> From: fork <forka...@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)

Eli Zaretskii

unread,
Mar 18, 2011, 5:54:29 PM3/18/11
to help-gn...@gnu.org
> From: fork <forka...@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.

Stefan Monnier

unread,
Mar 18, 2011, 10:02:44 PM3/18/11
to
> 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

David Kastrup

unread,
Mar 19, 2011, 4:08:32 AM3/19/11
to
Stefan Monnier <mon...@iro.umontreal.ca> writes:

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

--
David Kastrup

Stefan Monnier

unread,
Mar 21, 2011, 9:05:18 PM3/21/11
to
>>> 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

David Kastrup

unread,
Mar 22, 2011, 4:01:06 AM3/22/11
to
Stefan Monnier <mon...@iro.umontreal.ca> writes:

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

Kevin Rodgers

unread,
Mar 22, 2011, 10:56:56 PM3/22/11
to help-gn...@gnu.org

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


David Kastrup

unread,
Mar 23, 2011, 3:23:19 AM3/23/11
to
Kevin Rodgers <kevin.d...@gmail.com> writes:

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

Kevin Rodgers

unread,
Mar 24, 2011, 11:55:54 PM3/24/11
to help-gn...@gnu.org
On 3/23/11 1:23 AM, David Kastrup wrote:
> Kevin Rodgers<kevin.d...@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]
`----

0 new messages