Article View: gnu.epoch.misc
Article #2054*-other-screen
From: Ed Simpson
Date: Thu, 11 Apr 1991 14:00
Date: Thu, 11 Apr 1991 14:00
38 lines
1991 bytes
1991 bytes
It's pretty easy to extend existing code to use other screens. Here
are examples of what I've done. I just yanked the original code (e.g
for find-file-read-only) and added the accessory code to put up a new
screen.
(require 'epoch)
(defun find-alternate-file-other-screen (filename)
"Find file FILENAME in a new screen and kill the previous buffer and screen."
(interactive "FFind alternate file: ")
(and (buffer-modified-p)
(not buffer-read-only)
(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))
(oscr (current-screen)))
(rename-buffer " **lose**")
(setq buffer-file-name nil)
(unwind-protect
(progn
(unlock-buffer)
(find-file-other-screen filename))
(cond ((eq obuf (current-buffer))
(setq buffer-file-name ofile)
(lock-buffer)
(rename-buffer oname))))
(kill-buffer obuf)
(delete-screen oscr)))
(defun find-file-other-screen-read-only (filename)
"Edit file FILENAME in another screen but don't save without confirmation.
Like find-file-other-screen but marks buffer as read-only."
(interactive "fFind file read-only: ")
(find-file-other-screen filename)
(setq buffer-read-only t))
Technical Details
Message-ID:
<9104111400.AA02668@ed.mc.duke.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!math.lsa.umich.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!ucbvax!tut.cis.ohio-state.edu!unreplyable!garbageReferences:
<AMIR.91Apr11122647@taux01.nsc.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc7ee,f72cea7727bfb37c X-Google-Attributes: gidfc7ee,public X-Google-ArrivalTime: 1991-04-11 21:13:05 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!math.lsa.umich.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!ucbvax!tut.cis.ohio-state.edu!unreplyable!garbage From: evs@SUNBAR.MC.DUKE.EDU (Ed Simpson) Newsgroups: gnu.epoch.misc Subject: *-other-screen Message-ID: <9104111400.AA02668@ed.mc.duke.edu> Date: 11 Apr 91 14:00:29 GMT References: <AMIR.91Apr11122647@taux01.nsc.com> Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 38