help-gnu-emacs
[Top][All Lists]
Advanced

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

how to handle buffer modifications that are not to be saved


From: Will Parsons
Subject: how to handle buffer modifications that are not to be saved
Date: 31 Mar 2012 19:06:39 GMT
User-agent: slrn/0.9.9p1 (FreeBSD)

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.  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?

-- 
Will


reply via email to

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