From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Arnaldo Mandel Newsgroups: gmane.emacs.help Subject: Re: MS Word mode? Date: Fri, 8 Nov 2002 11:52:33 -0200 Sender: help-gnu-emacs-admin@gnu.org Message-ID: <15819.49569.674208.505936@gargle.gargle.HOWL> References: <87fzudc5k0.fsf@emacswiki.org> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1036765747 31355 80.91.224.249 (8 Nov 2002 14:29:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 8 Nov 2002 14:29:07 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18AA89-00089V-00 for ; Fri, 08 Nov 2002 15:29:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 18AA7t-00073U-00; Fri, 08 Nov 2002 09:28:49 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18A9ZU-0007fr-00 for help-gnu-emacs@gnu.org; Fri, 08 Nov 2002 08:53:16 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18A9ZP-0007eg-00 for help-gnu-emacs@gnu.org; Fri, 08 Nov 2002 08:53:15 -0500 Original-Received: from bidu.ime.usp.br ([143.107.45.12]) by monty-python.gnu.org with smtp (Exim 4.10) id 18A9ZM-0007ab-00 for help-gnu-emacs@gnu.org; Fri, 08 Nov 2002 08:53:09 -0500 Original-Received: (qmail 19886 invoked from network); 8 Nov 2002 13:52:35 -0000 Original-Received: from benavuya.ime.usp.br (143.107.45.38) by bidu.ime.usp.br with SMTP; 8 Nov 2002 13:52:35 -0000 Original-Received: (qmail 10527 invoked by uid 201); 8 Nov 2002 13:52:34 -0000 Original-To: help-gnu-emacs@gnu.org Original-Newsgroups: gnu.emacs.help In-Reply-To: <87fzudc5k0.fsf@emacswiki.org> X-Mailer: VM 7.03 under Emacs 21.1.9 Full-Name: Arnaldo Mandel Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:3395 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3395 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. am