[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: no-word.el fails on Windows NT
From: |
Eli Zaretskii |
Subject: |
Re: no-word.el fails on Windows NT |
Date: |
Thu, 24 May 2007 10:21:21 +0300 |
> Date: Wed, 23 May 2007 18:17:03 -0400
> From: poti@potis.org
>
> I am looking for an emacs interface for reading Microsoft Word
> documents. I have been using antiword, which is fine and has
> an emacs mode provided by no-word.el. This works fine on OSX and
> Linux. However, when I visit a doc file on Windows NT, I get the
> following error:
>
> - is not a Word Document.
>
>
> This appears to be related to the following elisp code:
> (if file (replace-regexp-in-string " " "\\ " file t t) "-")
> which is concatenated to the command "antiword" and options.
> This is in the no-word function, where file is optional.
> Apparently, visiting the file does not pass a file to this function.
> This is as much as I can figure out. Why is the behavior different on
> Windows, is there a fix that will work as expected across platforms?
I think this is a bug in no-word.el: it assumes that the shell invoked
by shell-command-on-region is a Unixy shell, and so uses that shell's
quoting rules to escape-protect spaces in file names. But on Windows,
the standard shell is cmd.exe, which doesn't understand those quoting
rules.
Try to change the above line to this (untested):
(if file (setq file (shell-quote-argument file)))
(this uses the quoting rules suitable for the underlying platform's
shell).
Note that there are 2 more instances of such quoting in no-word.el;
you may wish to modify them as well.
Also, you should probably report the problem to the author.