Article View: gnu.emacs.bug
Article #99622find-alternate-file
From: shapiro
Date: Tue, 31 Jul 1990 07:50
Date: Tue, 31 Jul 1990 07:50
40 lines
2241 bytes
2241 bytes
I think there is a small bug in find-alternate-file (files.el, emacs
18.55). If you are in RMAIL mode and do find-alternate-file
(presumably by mistake) it will read in the alternate file without
giving you a chance of saving your mail.
The fix is quite simple. Just take out the test "(not
buffer-read-only)". Why is it there anyway?
;; slight change from standard definition
;; because if current file is RMAIL + modified the test for
;; buffer-read-only allows it to be thrown away!
(defun find-alternate-file (filename)
"Find file FILENAME, select its buffer, kill previous buffer.
If the current buffer now contains an empty file that you just visited
\(presumably by mistake), use this command to visit the file you really want."
(interactive "FFind alternate file: ")
(and (buffer-modified-p)
;; (not buffer-read-only) ; comment out this line!
(not (yes-or-no-p (format "Buffer %s is modified; kill anyway? "
(buffer-name))))
(error "Aborted"))
(let ((obuf (current-buffer))
(ofile buffer-file-name)
(oname (buffer-name)))
(rename-buffer " **lose**")
(setq buffer-file-name nil)
(unwind-protect
(progn
(unlock-buffer)
(find-file filename))
(cond ((eq obuf (current-buffer))
(setq buffer-file-name ofile)
(lock-buffer)
(rename-buffer oname))))
(kill-buffer obuf)))
Marc Shapiro
INRIA, B.P. 105, 78153 Rocquencourt Cedex, France. Tel.: +33 (1) 39-63-53-25;
fax: +33 (1) 39-63-53-30; e-mail: shapiro@sor.inria.fr
Technical Details
Message-ID:
<9007310750.AA05549@sor>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!decwrl!sdd.hp.com!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!CORTO.INRIA.FR!shapiroShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,dfa3de3d38903dd8,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1990-07-31 00:50:13 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!decwrl!sdd.hp.com!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!CORTO.INRIA.FR!shapiro From: shapiro@CORTO.INRIA.FR Newsgroups: gnu.emacs.bug Subject: find-alternate-file Message-ID: <9007310750.AA05549@sor> Date: 31 Jul 90 07:50:13 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: INRIA, BP 105, F-78153 Rocquencourt Cedex, France telephone +33(1)39-63-55-11, telex 697033 F, fax +33(1)39-63-53-30 Lines: 40 Posted: Tue Jul 31 08:50:13 1990