From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Benjamin Riefenstahl Newsgroups: gmane.emacs.help Subject: Re: emacs rmail. How to convert .doc to plain text Date: 24 Nov 2002 18:08:22 +0100 Organization: None Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1038158028 7688 80.91.224.249 (24 Nov 2002 17:13:48 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 24 Nov 2002 17:13:48 +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 18G0KI-0001zr-00 for ; Sun, 24 Nov 2002 18:13:46 +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 18G0IJ-0006xe-00; Sun, 24 Nov 2002 12:11:43 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!news-out.visi.com!hermes.visi.com!sn-xit-05!sn-xit-06!sn-post-01!supernews.com!news.supernews.com!cicero.benny.turtle-trading.net!nobody Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-X-Complaints-To: abuse@supernews.com Original-Lines: 53 Original-Xref: shelby.stanford.edu gnu.emacs.help:107376 Original-To: help-gnu-emacs@gnu.org 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:3929 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3929 Hi, Puff Addison writes: > Yes, please post your Emacs integration code. Ok, see below. I should note that it is probably also possible to (ab-)use jka-compr for this, which would make my two functions obsolete. so long, benny >>>>>>> (defun benny-antiword-file-handler (operation &rest args) ;; First check for the specific operations ;; that we have special handling for. (cond ((eq operation 'insert-file-contents) (apply 'benny-antiword-insert-file args)) ((eq operation 'file-writable-p) nil) ((eq operation 'write-region) (error "Word documents can't be written")) ;; Handle any operation we don't know about. (t (let ((inhibit-file-name-handlers (cons 'benny-antiword-file-handler (and (eq inhibit-file-name-operation operation) inhibit-file-name-handlers))) (inhibit-file-name-operation operation)) (apply operation args))))) (defun benny-antiword-insert-file (filename &optional visit beg end replace) (set-buffer-modified-p nil) (setq buffer-file-name (file-truename filename)) (setq buffer-read-only t) (let ((start (point)) (inhibit-read-only t)) (if replace (delete-region (point-min) (point-max))) (save-excursion (let ((coding-system-for-read 'utf-8) (filename (encode-coding-string buffer-file-name (or file-name-coding-system default-file-name-coding-system)))) (call-process "antiword" nil t nil "-m" "UTF-8.txt" filename)) (list buffer-file-name (- (point) start))))) (setq file-name-handler-alist (cons '("\\.doc\\'" . benny-antiword-file-handler) file-name-handler-alist)) <<<<<<<