[Top][All Lists]

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

Re: MS Word mode?

From: Arnaldo Mandel
Subject: Re: MS Word mode?
Date: Fri, 8 Nov 2002 11:52:33 -0200

Alex Schroeder wrote (on Nov 8, 2002):

 >                 Actually all you need is this:
 > (add-to-list 'auto-mode-alist '("\\.doc\\'" . no-word))
 > (defun no-word ()
 >   "Run antiword on the entire buffer."
 >   (shell-command-on-region (point-min) (point-max) "antiword - " t t))

On my system there are lots of filenames ending in .doc whose files
are not Word files.  So I modified your function thusly

(defun no-word ()
  "Run antiword on the entire buffer."
  (if (string-match "Microsoft "
                    (shell-command-to-string (concat "file " buffer-file-name)))
      (shell-command-on-region (point-min) (point-max) "antiword - " t t)))

Works in Solaris and Linux, and should work on other unixes as well.


reply via email to

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