🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.epoch.misc
Article #2062

*-other-screen

#2062
From: Ed Simpson
Date: Thu, 11 Apr 1991 14:12
39 lines
2056 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.  Compare find-alternate-file-other-screen with
find-alternate-file in the lisp library.

(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: <9104111412.AA02676@ed.mc.duke.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!unidui!math.fu-berlin.de!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

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-12 00:20:43 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!unidui!math.fu-berlin.de!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: <9104111412.AA02676@ed.mc.duke.edu>
Date: 11 Apr 91 14:12:47 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 39