[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: no-word.el fails on Windows NT
From: |
poti |
Subject: |
Re: no-word.el fails on Windows NT |
Date: |
Thu, 24 May 2007 16:07:12 -0400 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
On 10:21 Thu 24 May , Eli Zaretskii wrote:
> > 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.
>
I tried your suggestion. It failed in the same way. When the
no-word command is called by the interactive function through
M-x no-word-find-file everything works. The problem appears
to be in what happens when a file is visited with C-x C-f, in
particular, with how "-" is understood in Windows.
> Also, you should probably report the problem to the author.
I will forward a copy of this to him.