[7175] in Athena Bugs
rt 7.2P: emacs
daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Sun Feb 24 04:42:03 1991
From: tuna@ATHENA.MIT.EDU
To: bugs@ATHENA.MIT.EDU
Date: Sun, 24 Feb 91 04:41:42 EST
System name: alefnull
Type and version: RTPC-ROMPC 7.2P (1 update(s) to same version)
Display type: apa16
What were you trying to do?
having loaded "uncompress.el" into my emacs, open a compressed
file for which i didn't have write access.
What's wrong:
got some emacs-lossage message about the buffer being read-only.
What should have happened:
the data should have been successfully uncompressed, as it would
have if i had write access to the file.
Please describe any relevant documentation references:
heck, i don't know. don't remember where i initially heard about
uncompress.el, although it is a standard part of the emacs-18.55
release.
How to fix it:
the following version of uncompress-while-visiting seems to fix
the problem. (kudos to mark eichin for pointing out that wrapping
a (let ((buffer-read-only nil)) ...) around the uncompress line
would solve the problem.
---------------- begin patched code
;; fix bug in uncompress.el -- previously had problems when trying to
;; open a compressed file for which we didn't have read access
;;
(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 (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...")
(let ((buffer-read-only nil))
(shell-command-on-region (point-min) (point-max) "uncompress" t))
(message "Uncompressing...done")
(set-buffer-modified-p nil)
(normal-mode))
---------------- end patched code