Article View: gnu.emacs.bug
Article #1139uncompress-while-visiting dies on read only files
From: Barry Brachman
Date: Wed, 02 Nov 1988 19:21
Date: Wed, 02 Nov 1988 19:21
34 lines
1745 bytes
1745 bytes
--text follows this line--
In GNU Emacs 18.52.1 of Thu Sep 15 1988 on grads.cs.ubc.ca (berkeley-unix)
Index: uncompress.el
If you visit a compressed file that you can't write, the compressed file
is placed in a read-only buffer. Subsequent execution of
shell-command-on-region to uncompress the contents of the buffer fails
because the buffer has been marked read-only.
Suggested fix:
(defun uncompress-while-visiting ()
"Temporary \"major mode\" used for .Z files, to uncompress the contents.
It then selects a major mode from the uncompressed file name and contents."
(if buffer-read-only ;; Allow uncompress on the buffer - bjb
(toggle-read-only)) ;;
(if (and (not (null buffer-file-name))
(string-match "\\.Z$" buffer-file-name))
(set-visited-file-name
(substring buffer-file-name 0 (match-beginning 0))))
(message "Uncompressing...")
(shell-command-on-region (point-min) (point-max) "uncompress" t)
(message "Uncompressing...done")
(set-buffer-modified-p nil)
(normal-mode))
-----
Barry Brachman | {alberta,uw-beaver,uunet}!
Dept. of Computer Science| ubc-vision!ubc-csgrads!brachman
Univ. of British Columbia| brachman@grads.cs.ubc.cdn
Vancouver, B.C. V6T 1W5 | brachman%ubc.csnet@csnet-relay.arpa
(604) 228-4327 | brachman@ubc.csnet (ubc-csgrads=128.189.97.20)
Technical Details
Message-ID:
<675*brachman@cs.ubc.ca>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!cs.ubc.ca!brachmanShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!cs.ubc.ca!brachman From: brachman@cs.ubc.ca (Barry Brachman) Newsgroups: gnu.emacs.bug Subject: uncompress-while-visiting dies on read only files Message-ID: <675*brachman@cs.ubc.ca> Date: 2 Nov 88 19:21:00 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 34