home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
3
/
3dired11.zip
/
DOSDIRED.CMD
next >
Wrap
OS/2 REXX Batch file
|
1992-08-22
|
28KB
|
906 lines
; Hi,
;
; This is version 1.1-Dos of Dired for MicroEMACS, enhanced and de-boned
; over the first release. I've added a couple features and cleaned
; up the code. It should work well under both Dos 4.x and Dos 5.0 now
; as well as 4DOS. 4DOS users should adjust the %dirfunc variable to dir /j
; in the initial set of "set %..."'s. Thanks very much to Richard Meitzler for
; the 4DOS fix and for beta testing this 1.1 version.
;
; The Unix or "ls -al" driven version exists also for anyone who would
; like to have Dired in MicroEMACS under Unix; it's version 1.1-Unix,
; and the file is unxdired.cmd.
;
; Of course I'm happy to hear bug reports and feedback about this code
; so don't hesitate to write if something goes wrong (or even right).
; I'm at:
;
; hetrick@gauge.phys.uva.nl
; Theoretical Physics Institute
; University of Amsterdam, The Netherlands
;
; Salut,
; Jim Hetrick
;
;=====================================================================
;
; =====DosDired.cmd=====
; version 1.1-Dos
;
; A Directory Facility for MicroEMACS 3.11 on the PC
;
; (C)opyright 1992 by James E. Hetrick
;
;
;
;
; Dired.cmd is modeled after GNUEmacs' Dired.el to some degree.
; It lists directories, allows you to manipulate files in them,
; and to move around your directory tree.
;
; It relies on three other executables being in the path:
;
; MV.EXE --- File mover. Any one should do. If yours isn't
; called MV then edit the line:
; set %mvfunc "mv "
; to reflect the name of your mv. Be sure to
; add the space at the end.
;
; PKzip and
; PKunzip --- The standards. You can also edit these parts
; of DIRED.CMD to use LHZ or ZOO or whatever you
; like.
;
; ******* READ THIS ***** READ THIS ****** READ THIS ********
;
; As this program has the capability to DELETE YOUR
; FILES please put some test files in a subdirectory and try it
; out on them. After you're convinced of its integrity, put it
; wherever your .cmd files live and fire at will.
;
; ******* READ THIS ***** READ THIS ****** READ THIS ********
;
;
; ===============
; Documentation
; ===============
;
; To Load: either -> uncomment the Dired code page below and
; make the changes to your emacs.rc file
; or -> load with "execute-file dired.cmd"
;
; To Run: hit C-x d (^XD) or M-x D-open to start dired.
;
; (C-x d is remapped by Dired.cmd. If you need it,
; remap D-open to some other key).
;
; Dired prompts you for a directory. Either type an alternative
; directory or accept (by hitting <ENTER>) the default directory
; from which MicroEMACS was called.
;
; From here you can move UP and DOWN the files with the arrow keys
; and the mouse (left button). Placing the cursor on the line of
; a file and hitting <ENTER> or clicking with the right mouse button
; loads the file into a buffer for editting replacing the Dired directory.
;
; If you type <ENTER> on a subdirectory, that subdir is loaded as
; a Dired buffer.
;
; Dired-buffers (Dired-C:\DIR\...) are like others and stay in the
; background while editing files or performing other tasks. If you
; "next-buffer" (C-x x) into a Dired directory buffer, Dired starts
; again and you have it's commands at your disposal. If you should
; find yourself back in a Dired-buffer which is not responding to
; Dired commands such as happens when you split the screen by C-<ENTER>
; "view-file-other-window" or S-F9 "zip-view" on a . zip file, just
; type C-x C-d to restart the Dired command processor in the window.
;
; I prefer C-x k to delete the current buffer and replace
; with the next on the stack like GNUEmacs, so I have the
; macro "kill-this-one" bound to C-x k, in my emacs.rc.
; If you like it, do the same, and Dired will process it. Otherwise,
; you can comment out the !if..."kill-this-one" loop out (or leave it).
;
; ***************************************************************
;store-procedure kill-this-one
; set %thisone $cbufname
; set %ans @&cat &cat "Delete [" %thisone "]: "
; !if &seq %ans ""
; !force next-buffer
; !force delete-buffer %thisone
; !else
; !force delete-buffer %ans
; !endif
;!endm
;
;macro-to-key kill-this-one ^XK
; ****************************************************************
;
; Below is the list of Dired commands, executed singly when the cursor is
; on a file name and no files are marked (*ed), or executed on the
; *ed files en masse:
;
; Movement: = Usual: Up, Down, PgUp, PgDn, etc., and left mouse button
;
; <ENTER> = Load File (on files)
; or right = Load Subdir into Dired window (on subdirs)
; mouse button (with mouse hit the left button first to move the
; point to the current line, then click the right one)
;
; C-<ENTER> = Split screen, load File/Subdir in second window
;
; C-x C-f = Open new file: A single name gets the currently viewed
; directory prepended. If the entered name contains directory
; names, ie. has a "\" in it, it is opened as is.)
;
; C-x e = Execute File, works on some cmd files, like CAL1.CMD
;
; C-c = Exit the Dired command processor. This just leaves
; you in the Directory listing as an ordinary file.
;
; When entering filenames, for copy, move, etc., a single name gets
; the currently viewed diredctory prepended. Names which contain "\"
; are taken as is. Names ending in ":", ie. "A:" get a "\" postfixed.
; Below, --- is the action on a single file,
; -*- is the action if files are marked.
;
; S-F1 = Copy --- you are prompted for a name/destination.
; -*- prompt for dest; copy all marked files
;
; S-F2 = Delete --- delete file. (you're prompted)
; -*- or all marked files. (prompted)
; >>>[prompting can be turned off for the brave]
;
; S-F3 = Move --- you are prompted for a destination.
; -*- prompt for dest; move all marked files
; (exact behavior depends on your "mv" function)
;
; S-F4 = Rename --- rename file
;
; S-F5 = Mark --- Mark file with %markstr ( * ) and move to next line.
;
; S-F6 = Un-Mark --- Unmarks file.
;
; S-F7 = Revert --- Updates Dired buffer by re-reading
; directory from disk.
;
; S-F8 = Make Subdir --- Make a new subdirectory
;
; S-F9 = PK-Zip --- PKzips file.
; -*- PKzips marked files into one zipfile.
; file.zip If pressed on an file ending in .ZIP,
; ie. trying to zip a zipped file,
; invokes PKzip -v, to view contents
; of file in another window.
;
; S-F10 = PK-UnZip --- Un-zip file
;
;====================== Dired Code Page =============================
;
;; If you would like Dired to be loaded as a macro page in the function
;; key window, then uncomment the following code page loader (hacked
;; shamelessly from from the WPAGE.CMD in the distribution). Then rename
;; DIRED.CMD -> DPAGE.CMD and modify your EMACS.RC file to have an entry
;; "Dired" replacing one of the pages you don't use.
;
;; ++++++++++++++++this code page loader taken from WPAGE.CMD:+++++++
;; DPAGE.CMD: Dired Macro Page
;; for MicroEMACS 3.9d and above
;; from WPAGE.CMD: (C)opyright 1987 by Daniel M Lawrence
;
;
;; make sure the function key window is up
; set %rcfkeys FALSE
; toggle-fkeys
; write-message "Loading Dired..."
;
;; Write out the page instructions
; save-window
; 1 next-window
; beginning-of-file
; set $curcol 25
; overwrite-string " F1 Copy F2 Delete "
; next-line
; set $curcol 25
; overwrite-string " F3 Move F4 Rename [ C-x d ]"
; next-line
; set $curcol 25
; overwrite-string " F5 Mark F6 UnMark [ invokes ]"
; next-line
; set $curcol 18
; overwrite-string "DIRED]"
; set $curcol 25
; overwrite-string " F7 Revert Directory F8 Make Dir [ Dired ]"
; next-line
; set $curcol 25
; overwrite-string " F9 PK-Zip /(Zip-View) F10 PK-Un-Zip "
; unmark-buffer
; beginning-of-file
; !force restore-window
; update-screen
;; ++++++++++++++++++++++++++++++
;========================== Dired.cmd ===========================
; Feel free to comment out this one:
write-message " -\|/- Dired [1.1-Dos] for MicroEMACS === 1992 (c) J. E. Hetrick >> C-x d
set %marked 0
set %revert FALSE
set %dot FALSE
set %othwin FALSE
set %dirowin FALSE
set %dirfunc "dir "
;set %dirfunc "dir /j " ; 4DOS Users, uncomment this one
;set %comseq "q" ; only needed if you use Unix style commands (see D-getcmd)
set %markstr " * " ; must be 3 chars
set %mvfunc "mv " ; name of move function PLUS a space
; =======D-check
store-procedure D-check
!if &seq &left $cbufname 6 "Dired-"
set $discmd FALSE
set %length &len $cbufname
set %dir &rig $cbufname &sub %length 6
set %Dbuffer &cat "Dired-" %dir
change-file-name " "
beginning-of-file
set %starred FALSE
set %marked 0
!while &seq %starred FALSE
!force search-forward %markstr
!if &seq $status TRUE
set %marked &add %marked 1
!else
set %starred TRUE
!endif
!endwhile
unmark-buffer %Dbuffer
beginning-of-file
!force search-forward ".."
set %ncol &sub $curcol 2
next-line
beginning-of-line
!force %ncol forward-character
set %filename " "
set $discmd TRUE
D-process
!endif
!endm
; ==============D-open
store-procedure D-open
set $discmd FALSE
!if &seq %rcfkeys TRUE
!force toggle-fkeys
!endif
pipe-command "cd"
beginning-of-file
set %cwd #command
set %dir @&cat &cat "Directory [" %cwd "]: "
!if &seq %dir "ERROR"
write-message "Aborting..."
delete-window
delete-buffer "command"
!return
!endif
delete-window
set $discmd TRUE
!if &sequal %dir ""
set %dir %cwd
!endif
D-window
!endm
; =========D-window
store-procedure D-window
!if &seq %revert FALSE
write-message &cat &cat "[Reading " %dir "...]
!endif
!if &seq &right %dir 1 ":"
pipe-command &cat &cat %dirfunc %dir "\"
!else
pipe-command &cat %dirfunc %dir
!endif
!if &seq %othwin FALSE
delete-other-windows
!endif
set %othwin FALSE
!if &seq %dirowin TRUE
set %dirowin FALSE
save-window
next-window
delete-window
restore-window
!endif
!force delete-buffer "stale"
set %rcfkeys FALSE
delete-mode "View"
set %Dbuffer &cat "Dired-" %dir
name-buffer %Dbuffer
change-file-name " "
beginning-of-file
set-mark
end-of-file
set %tabno $hardtab
set $hardtab 3
indent-region
detab-region
set $hardtab %tabno
beginning-of-file
unmark-buffer %Dbuffer
!if &seq %revert TRUE
goto-line %oldline
set %revert FALSE
!else
!force search-forward ".."
!if &seq $status TRUE
set %ncol &sub $curcol 2
next-line
!else
set %ncol 3
beginning-of-file
!force 4 next-line
!endif
!endif
beginning-of-line
!force %ncol forward-character
set %filename " "
set $discmd TRUE
D-process
!endm
; ==============D-getcmd
store-procedure D-getcmd
; This is the default PC configuration: Commands are entered via the
; S-FN keys, as this is faster. If your PC has some warp speed clock,
; your FN keys aren't working, or you prefer Unix(GNU/Tree)-like
; commands on letter keys, ie. f, o, m, d, x, etc., comment out this
; "PC" segment and uncomment the next section called "Unix".
; Then change all "!if &seq %cmd..." lines in D-process to the matching
; Unix format "!if &seq %key...".
; -------------------------- PC Function Key command input
!if &seq $pending FALSE
!force update-screen
!endif
set %cmd >cmd
set %cmd &bind %cmd
; -------------------------- PC
; -------------------------- Unix letter key command input
; !if &seq $pending FALSE
; !force update-screen
; !endif
; set %cmd " "
; set %key >key
; !if &seq %key %comseq
; write-message "Command sequence:"
; set %cmd >cmd
; set %cmd &bind %cmd
; write-message %cmd
; !endif
; -------------------------- Unix
!endm
; ==============D-process
store-procedure D-process
write-message "Dired ON"
set $discmd FALSE
set %done FALSE
Porting to
another system should only be a matter of changing the
"ls" or "dir" to whatever lists directories. !while &seq %done FALSE
D-getcmd
; ---------------------------------------------------------------------------
; To convert to Unix-like command input switch all %cmd input !if's
; from:
; !if &seq %cmd "previous-line"
; to:
; !if &or &or &seq %key "k" &seq %key "P" &seq %cmd "previous-line"
; by exchanging the ";"
;----------------------------------------------------------------------------
;======Movement======
!if &seq %cmd "previous-line"
; !if &or &or &seq %key "k" &seq %key "P" &seq %cmd "previous-line"
!force previous-line
beginning-of-line
!force %ncol forward-character
!goto endproc
!endif
!if &seq %cmd "previous-page"
; !if &or &seq %key "Z" &seq %cmd "previous-page"
!force previous-page
beginning-of-line
!force %ncol forward-character
!goto endproc
!endif
!if &seq %cmd "next-line"
; !if &or &or &seq %key "j" &seq %key "N" &seq %cmd "next-line"
!force next-line
beginning-of-line
!force %ncol forward-character
!goto endproc
!endif
!if &seq %cmd "next-page"
; !if &or &seq %key "V" &seq %cmd "next-page"
!force next-page
beginning-of-line
!force %ncol forward-character
!goto endproc
!endif
; ======Edit file====== <return>
!if &or &seq %cmd "newline" &seq %cmd "mouse-region-down"
; !if &seq %key "f" &seq %cmd "mouse-region-down"
D-getfile
D-load-file
!endif
; ======Edit file other window====== <C-return>
!if &seq %cmd "newline-and-indent"
; !if &seq %key "o"
set %othwin TRUE
2 split-current-window
D-getfile
!if &seq %dirq "d"
set %dirowin TRUE
!endif
D-load-file
!endif
; ======Copy file======= S-F1
!if &seq %cmd "execute-macro-10"
; !if &seq %key "c"
D-getfile
!if &gre %marked 0
set %copy @"Copy marked files to: "
!if &seq %copy ".."
set %copy &cat %dir "\.."
!else
!if &seq &right %copy 1 ":"
set %copy &cat %copy "\"
!endif
!if &equ &sind %copy "\" 0
set %copy &cat &cat %dir "\" %copy
!endif
!endif
set %count 0
!while &gre %marked 0
beginning-of-file
search-forward %markstr
3 delete-previous-character
insert-string " "
set %marked &sub %marked 1
D-getfile
shell-command &cat &cat &cat "copy " %filename " " %copy
set %count &add %count 1
!endwhile
write-message &cat %count " files copied"
!else
set %copy @&cat &cat "Copy " %shortfile " to: "
!if &seq %copy ".."
set %copy &cat %dir "\.."
!else
!if &seq &right %copy 1 ":"
set %copy &cat %copy "\"
!endif
!if &equ &sind %copy "\" 0
set %copy &cat &cat %dir "\" %copy
!endif
!endif
shell-command &cat &cat &cat "copy " %filename " " %copy
!endif
D-revert
!break
; !goto endproc
!endif
; ======Delete file(s)== S-F2
!if &seq %cmd "execute-macro-11"
; !if &seq %key "x"
!if &gre %marked 0
set %count 0
!while &gre %marked 0
beginning-of-file
search-forward %markstr
3 delete-previous-character
insert-string " "
set %marked &sub %marked 1
D-getfile
; comment this set-if-loop out for no-prompt deletion of marked files
set %delq @&cat &cat "Delete " %filename "? [y/n]"
!if &seq &low %delq "y"
D-delete
!endif
set %count &add %count 1
!endwhile
write-message &cat %count " files deleted"
!else
D-getfile
; comment this set-if-loop out for no-prompt deletion of file
set %delq @&cat &cat "Delete " %filename "? [y/n]"
!if &seq &low %delq "y"
D-delete
!else
write-message "No files deleted"
!endif
!endif
beginning-of-line
!force %ncol forward-character
set %delq " "
!goto endproc
!endif
; ======Move file======= S-F3
!if &seq %cmd "execute-macro-12"
; !if &seq %key "r"
!if &gre %marked 0
set %move @"Move marked files to: "
!if &seq %move ".."
set %move &cat %dir "\.."
!else
!if &seq &right %move 1 ":"
set %move &cat %move "\"
!endif
!if &equ &sind %move "\" 0
set %move &cat &cat %dir "\" %move
!endif
!endif
set %count 0
!while &gre %marked 0
beginning-of-file
search-forward %markstr
3 delete-previous-character
insert-string " "
set %marked &sub %marked 1
D-getfile
shell-command &cat &cat &cat %mvfunc %filename " " %move
set %count &add %count 1
!endwhile
write-message &cat %count " files moved"
!else
D-getfile
set %move @&cat &cat "Move " %shortfile " to: "
!if &seq %move ".."
set %move &cat %dir "\.."
!else
!if &seq &right %move 1 ":"
set %move &cat %move "\"
!endif
!if &equ &sind %move "\" 0
set %move &cat &cat %dir "\" %move
!endif
!endif
shell-command &cat &cat &cat %mvfunc %filename " " %move
unmark-buffer %Dbuffer
!endif
D-revert
!break
!endif
; ======Rename file======= S-F4
!if &seq %cmd "execute-macro-13"
; no corresponding Unix function ("r" does both)
D-getfile
set %renm @&cat &cat "Rename " %filename " to: "
shell-command &cat &cat &cat "rename " %filename " " %renm
unmark-buffer "Dbuffer"
D-revert
!break
!endif
; =======Mark File====== S-F5
!if &seq %cmd "execute-macro-14"
; !if &or &seq %key "m" &seq %key "d"
beginning-of-line
set %markq &left #%Dbuffer 3
previous-line
beginning-of-line
!if &seq %markq %markstr
write-message "file already marked"
!else
!force 3 forward-character
3 delete-previous-character
insert-string %markstr
set %marked &add %marked 1
!if ¬ &equ $curline %lastline
next-line
!endif
beginning-of-line
!force %ncol forward-character
write-message &cat %marked " marked files"
unmark-buffer %Dbuffer
!endif
!goto endproc
!endif
; =======Unmark file===== S-F6
!if &seq %cmd "execute-macro-15"
; !if &seq %key "u"
beginning-of-line
set %markq &left #%Dbuffer 3
previous-line
beginning-of-line
!if &seq %markq " "
write-message "file not marked"
!else
3 forward-character
3 delete-previous-character
insert-string " "
set %marked &sub %marked 1
beginning-of-line
next-line
!force %ncol forward-character
write-message &cat %marked " marked files"
unmark-buffer %Dbuffer
!endif
!goto endproc
!endif
; =======Revert Buffer===== S-F7
!if &seq %cmd "execute-macro-16"
; !if &seq %key "g"
D-revert
!break
!endif
; =======Make Sub-Directory===== S-F8
!if &seq %cmd "execute-macro-17"
; !if &seq %key "+"
set %mkdir @&cat &cat "sub-directory: " %dir "\"
shell-command &cat &cat &cat "mkdir " %dir "\" %mkdir
D-revert
!break
!endif
; =======PK-ZIP===== S-F9
!if &seq %cmd "execute-macro-18"
; !if &seq %key "t"
D-getfile
!if &seq &right %filename 4 ".ZIP"
write-message &cat "Zip-view of " %shortfile
D-zipview
!break
!else
!if &gre %marked 0
set %zipfile @"Name of archive file? (.zip added): "
!if &equ &sind %zipfile "\" 0
set %zipfile &cat &cat %dir "\" %zipfile
!endif
set %zipfile &cat %zipfile ".zip"
write-message &cat &cat "Zipping marked files into " %zipfile "..."
set %count 0
!while &gre %marked 0
beginning-of-file
search-forward %markstr
D-getfile
beginning-of-line
3 forward-character
3 delete-previous-character
insert-string " "
shell-command &cat &cat &cat &cat &cat "pkzip -b" %dir " -a " %zipfile " " %filename
set %marked &sub %marked 1
set %count &add %count 1
!endwhile
write-message &cat &cat %count " files zipped into " %zipfile
set %marked 0
!else
D-getfile
set %zipfile %shortfile
write-message &cat &cat &cat &cat "Zipping " %shortfile " into " %shortfile ".zip"
shell-command &cat &cat &cat &cat "pkzip -b" %dir " " %shortfile ".ZIP " %shortfile
!endif
!endif
D-revert
!break
!endif
; =======PK-UnZIP===== S-F10
!if &seq %cmd "execute-macro-19"
D-getfile
write-message &cat "Un-Zipping " %shortfile
shell-command &cat &cat &cat "pkunzip " %filename " " %dir
D-revert
!break
!endif
; =======Execute file===== C-x e
!if &seq %cmd "execute-macro"
; !if &seq %key "a"
D-getfile
set %done TRUE
execute-file %filename
!break
!endif
; =======Exit Dired Mode======= C-c
!if &seq %cmd "insert-space"
; !if &seq %key "z"
write-message "Exiting Dired command processor... (C-x C-d to resume)"
set %done TRUE
!break
!endif
; =======Find file===== C-x C-f
!if &seq %cmd "find-file"
set %cmd " "
set %newbuf @"Find file: "
!if &equ &sind %newbuf "\" 0
set %newbuf &cat &cat %dir "\" %newbuf
!endif
!force find-file %newbuf
set %done TRUE
!break
!endif
; =======Pass commands=====
!if &seq %cmd "delete-buffer"
set %done TRUE
next-buffer
delete-buffer %Dbuffer
!endif
!if &seq %cmd "[D-open]"
!force D-open
!endif
!if &seq %cmd "[mouse-clicks]"
!force mouse-move-down
!goto endproc
!endif
!if &seq %cmd "[toggle-fkeys]"
execute-procedure "toggle-fkeys"
!goto endproc
!endif
!if &seq %cmd "[get-help]"
execute-procedure "get-help"
!goto endproc
!endif
!if &seq %cmd "next-buffer"
set %done TRUE
unmark-buffer %Dbuffer
next-buffer
!goto endproc
!endif
!if &seq %cmd "[kill-this-one]"
set %done TRUE
set %cmd " "
execute-procedure kill-this-one
!goto endproc
!endif
!force execute-named-command %cmd
*endproc
!endwhile
!endm
store-procedure D-getfile
end-of-line
!if &les $curcol %ncol
write-message "Not positioned on file or directory"
!goto endget
!endif
beginning-of-line
17 forward-character
set %dirq &low &left #%Dbuffer 1
previous-line
beginning-of-line
3 forward-character
set %ffront &trim &left #%Dbuffer 8
previous-line
beginning-of-line
12 forward-character
set %fext &left #%Dbuffer 3
!if ¬ &seq %dirq "d"
set %filename &trim &cat &cat %ffront "." %fext
!endif
!if &seq %ffront "."
write-message "Tried to open ~".~" (Use S-F7 to revert buffer)"
previous-line
!force %ncol forward-character
set %dot TRUE
!goto endget
!endif
!if &seq %dirq "d"
!if &seq %ffront ".."
set %testdir &upper %dir
set %orgdir %testdir
set %dirlen &len %testdir
set %orglen %dirlen
set %slash &sind %testdir "\"
!while ¬ &equ %slash 0
set %testdir &right %testdir &sub %dirlen %slash
set %dirlen &len %testdir
set %slash &sind %testdir "\"
!endwhile
set %newdir &left %orgdir &sub %orglen &add 1 &len %testdir
!else
set %newdir &cat &cat %dir "\" &upper %ffront
!endif
!else
set %shortfile %filename
set %filename &cat &cat %dir "\" %filename
set %dirq " "
!endif
previous-line
!force %ncol forward-character
*endget
!endm
; ==============D-load-file
store-procedure D-load-file
!if &seq %dot FALSE
!if &seq %dirq "d"
!force delete-buffer &cat "Dired-" %newdir
set %dirq " "
set %dir %newdir
!if &seq %revert FALSE
write-message &cat &cat "[Reading " %dir "...]"
!endif
set %done TRUE
D-window
!else
write-message &cat &cat "[Reading " %filename "...]"
!if &seq %othwin FALSE
delete-other-windows
!else
set %othwin FALSE
!endif
!force find-file %filename
set %done TRUE
!endif
!endif
set %dot FALSE
*loadend
!endm
; ==============D-delete
store-procedure D-delete
write-message &cat &cat "Deleting " %filename "..."
shell-command &cat &cat "del " %filename
beginning-of-line
1 kill-to-end-of-line
set %lastline &sub %lastline 1
update-screen
unmark-buffer %Dbuffer
!endm
; ==============D-zipview
store-procedure D-zipview
set %cmd " "
!force pipe-command &cat "pkzip -v " %filename
set %done TRUE
name-buffer %shortfile
change-file-name "zip-view"
beginning-of-file
update-screen
!endm
store-procedure D-revert
set %revert TRUE
set %oldline $curline
name-buffer "stale"
unmark-buffer "stale"
D-window
!endm
set $discmd FALSE
macro-to-key D-open ^XD
macro-to-key D-check ^X^D
set $bufhook D-check
set $discmd TRUE