[darcs-users] Windows Editor (was: darcs patch: Resolve issue1093: warn about ugly patch... (and 1 more))

Max Battcher me at worldmaker.net
Wed Feb 4 01:18:18 UTC 2009


Trent W. Buck wrote:
> As to the lack of editor integration on Windows, I would hope that the
> proposed warning messages would politely remind you to address the
> problem (in your Copious Free Time ;-)).  Now that the it's been
> raised,
> I'd like to know more about it.  Is this problem something that affects
> many/most Darcs-on-Windows users?  (If so, please file a bug report.)
> 
> Is is something Darcs can address with code?  If not, is it something
> we
> can address with documentation?  For example, maybe we can document on
> the wiki how to get Darcs to fire up a bunch of preferred editors on
> Windows (eclipse, notepad, etc.), or how to set the "default editor" on
> Windows.

The issue from what I've seen is that darcs uses a standard shell invoke and
so it attempts to run in whatever shell environment the user is running
darcs within.  The issue there is that some Win32 applications entirely fail
to run when started in a command prompt; a standard error here being along
the lines of "This is a Win32 application".  If an editor does launch a
Win32 GUI from a command prompt the standard behavior in Windows is that the
GUI opens in a new process and the shell invocation itself exits
immediately. Darcs relies on the process exit to let it know when to open
the temporary file to use it...

There are special Win32 APIs for executing GUI applications and keeping
track of exit status, but I don't know if there are (good) Haskell bindings
for them, much less if it is worth special casing this for Windows.  Also,
if you were to take that route the best bet would be to make sure the
temporary files get .txt appended to them and there is a variation of the
API to let Explorer figure out what the user default association for a .txt
file is.

A possible Wiki-documentable solution is to make note of the Windows Command
Prompt pseudo-command "start", which is a basic wrapper around those Win32
APIs I just mentioned.  It may work to simply try "start /wait myeditor" as
the value of the EDITOR or DARCS_EDITOR and see if that works when
"myeditor" alone does not.  (... and if darcs used temporary files with a
.txt extension you should be able to omit "myeditor" and leave just "start
/wait" as a possible EDITOR choice to use the Windows default association.)
Caveat: I have not actually verified that this works.  (I myself use Vim for
EDITOR, which mostly "just works"...)

I may verify if "start" works and if it does write up a quick Wiki FAQ page
for it, if it does work, later this week, but someone is welcome to try
beating me to that punch.

--
--Max Battcher--
http://worldmaker.net



More information about the darcs-users mailing list