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!
>
> 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...
It's a bug. Please "M-x report-emacs-bug RET".
I'm working on a fix.
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)
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.
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
AFAIK, ediff does not have an interface for commandline usage as an
external merge resolution tool.
--
David Kastrup
That'd be easy to add, I'm sure.
Stefan
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
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
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
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]
`----