monotone-devel
[Top][All Lists]
Advanced

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

[Monotone-devel] Re: Default get_preferred_merge3_command -- converting


From: Steven E. Harris
Subject: [Monotone-devel] Re: Default get_preferred_merge3_command -- converting to Cygwin paths
Date: Thu, 02 Feb 2006 09:54:40 -0800
User-agent: Gnus/5.110004 (No Gnus v0.4) XEmacs/21.4.13 (cygwin32)

"Steven E. Harris" <address@hidden> writes:

> More generally, can anyone offer a means to use XEmacs on Cygwin as
> the merge editor? I may be able to solve the latter if I can get
> more assistance with the former.

Here's what I came up with after much frustration.

First, I created the following elisp file, with some parts nicked from
clearcase.el:

Attachment: merge-translated.el
Description: application/emacs-lisp

The pushes the cygpath translation calls into XEmacs where I'm better
able to manage the output of a shell command. Again, having io.popen
available in Lua would probably be better.

Next, I added the following hook redefinition to my monotonerc file:

,----[ monotonerc additions ]
| function translate_slashes(path)
|    return string.gsub(path, "\\", "/")
| end
| 
| 
| function merge3_emacs_cmd(emacs, lfile, afile, rfile, outfile)
|    local elisp = "(merge-translated-paths \"%s\" \"%s\" \"%s\" nil \"%s\")"
|    return 
|    function()
|       return execute(emacs,
|                      -- NB: Specifying this file path like this is brittle.
|                      "-l", "\\Path\\to\\merge-translated.el",
|                      "--eval", 
|                      string.format(elisp,
|                                    translate_slashes(lfile),
|                                    translate_slashes(rfile),
|                                    translate_slashes(afile),
|                                    translate_slashes(outfile)))
|    end
| end
`----

I had to swap or double the slashes because the original
Windows single-backslash path separators got swallowed by the XEmacs
command-line parser (or so I suspect).

It's not pretty, but it works.

-- 
Steven E. Harris

reply via email to

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