From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: how to handle buffer modifications that are not to be saved Date: Mon, 02 Apr 2012 23:13:44 -0600 Message-ID: References: <9tp2tuFo64U1@mid.individual.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1333430018 1376 80.91.229.3 (3 Apr 2012 05:13:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 3 Apr 2012 05:13:38 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 03 07:13:38 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SEw3j-0002kX-Ug for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Apr 2012 07:13:36 +0200 Original-Received: from localhost ([::1]:55846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEw3j-0008Ov-7u for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Apr 2012 01:13:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEw3b-0008N6-Rj for help-gnu-emacs@gnu.org; Tue, 03 Apr 2012 01:13:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SEw3Z-0003HA-CA for help-gnu-emacs@gnu.org; Tue, 03 Apr 2012 01:13:27 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:60527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEw3Z-0003GT-5Z for help-gnu-emacs@gnu.org; Tue, 03 Apr 2012 01:13:25 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SEw3X-0002d5-LO for help-gnu-emacs@gnu.org; Tue, 03 Apr 2012 07:13:23 +0200 Original-Received: from c-71-237-25-24.hsd1.co.comcast.net ([71.237.25.24]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 03 Apr 2012 07:13:23 +0200 Original-Received: from kevin.d.rodgers by c-71-237-25-24.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 03 Apr 2012 07:13:23 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 40 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-71-237-25-24.hsd1.co.comcast.net User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 In-Reply-To: <9tp2tuFo64U1@mid.individual.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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 Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84281 Archived-At: On 3/31/12 1:06 PM, Will Parsons wrote: > I recently discovered a utility (Perl script) to convert a Word .docx > file to plain text (http://docx2txt.sourceforge.net/). The author > thoughtfully provides the following addition to .emacs for viewing a > .docx file within Emacs using the utility: > ---------------- > (add-to-list 'auto-mode-alist '("\\.docx\\'" . docx2txt)) > > (defun docx2txt () > "Run docx2txt on the entire buffer." > (shell-command-on-region (point-min) (point-max) "docx2txt.pl" t t)) > ---------------- > He also warns: > > Be warned that with above ~/.emacs code addition, if you happen to > save the buffer/file, it will overwrite the .docx file with the text > content. > > I would like to avoid the danger of unintentionally overwriting the > original file. Then don't specify t for the optional OUTPUT-BUFFER and REPLACE arguments. > I know I could do that my renaming the buffer to end > in .txt rather than .docx, but really I probably don't want a separate > text file, or have to answer a question about saving a modified > buffer. What would be the recommended way of simply making the > converted .docx buffer temporary, so I don't have to worry about > saving it accidentally, or answering any questions about saving it > when exiting? Create a buffer that is not visiting a file: (shell-command-on-region (point-min) (point-max) "docx2txt.pl" (generate-new-buffer "*docx2txt*") t) -- Kevin Rodgers Denver, Colorado, USA