From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Thomas Persson Newsgroups: gmane.emacs.help Subject: Re: How to convert .doc to plain text ascii in emacs. Date: Sat, 01 May 2004 21:02:44 +0200 Organization: Lund Institute of Technology, Sweden Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87u0z0vuln.fsf@spacecentre.se> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1083438973 780 80.91.224.253 (1 May 2004 19:16:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 1 May 2004 19:16:13 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 01 21:16:03 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BJzxz-0007fG-00 for ; Sat, 01 May 2004 21:16:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BJzxf-0006Rk-EG for geh-help-gnu-emacs@m.gmane.org; Sat, 01 May 2004 15:15:43 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!irazu.switch.ch!switch.ch!ltu.se!luth.se!130.235.20.4.MISMATCH!news.lth.se!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-NNTP-Posting-Host: e211.vildanden.afb.lu.se NNTP-Posting-User: thomas User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:kKVY0gLMqz5gA579D19/ybQVdRY= Original-Xref: shelby.stanford.edu gnu.emacs.help:122902 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:18189 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:18189 Yoni Rabkin Katzenell writes: > Don Saklad writes: > >> What related emacs commands are there that might convert an rmail >> attachment from .doc to plain text ascii ?... >> >> It is an rmail message distributed from local government about an >> upcoming public hearing. > > I heard that Antiword [http://www.winfield.demon.nl/] can convert doc > files into plain text and postscript. Note though, that I have never > used the software myself. I use antiword and the following code to integrate it with emacs: (defun antiword-buffer () "Takes the current buffer as input to the external program antiword. If the current buffer is a ms-word document it's contents are replaced with the output from antiword and the extension `.doc' is replaced with `.txt' in the buffer-file-name." (let ((txt-buffer-file-name (concat (substring (buffer-file-name) 0 -4) ".txt"))) (shell-command-on-region (point-min) (point-max) "cat | antiword -" nil t nil) (undo-start) (if (equal (buffer-string) "- is not a Word Document.\n") (or (undo-more 1) (message "%s - is not a Word Document."(current-buffer))) (set-visited-file-name txt-buffer-file-name) (not-modified)))) ;; The following expression makes sure that antiword-buffer is run when a ;; file with the .doc extension is opened. (setq auto-mode-alist (append '(("\\.doc\\'" . antiword-buffer)) auto-mode-alist))