[net.sources] emacs edt emulator part 1 of 3

jimb@tekcbi.UUCP (05/20/86)

This distribution is in three parts:
     1. .emacs_pro
        edt-help
        time.ml
     2. edt-sup  this is the basic guts of the thing
     3. help-**  all the individual help screens


This emacs_pro can be used as an example.  just insert the proper lines
into yours.

Create your own directory /lib or whatever to stick the edt-sup and help
files.  You may need to go into edt-sup and search for all "read-file"
occurences and insert the proper path in front of the file names.  The
same is true for the "load"'s in .emacs_pro.

Some of the code may appear crude but it does work.  It is a pretty close
emulation of DEC's EDT including the help screens.  The keypad is identical
with few exceptions.  

One note:  in EDT you end the find argument by hitting either 4 or 5 to 
let it know which direction to search.  Here, you need to have selected
the direction first and then hit Gold Find, enter the string and terminate
it by pressing return, not enter.  Sorry bout that but that's the way it
works.

Insert disclaimers here.  DEC is registered to Digital Equipment Corp. 
 etc.

Look over edt-sup and it will give you an idea of what it does.


----------------------cut here-------------------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	.emacs_pro
#	edt-help
#	time.ml
# This archive created: Mon Mar 10 14:54:32 1986
export PATH; PATH=/bin:$PATH
if test -f '.emacs_pro'
then
	echo shar: will not over-write existing file "'.emacs_pro'"
else
cat << \SHAR_EOF > '.emacs_pro'
	; .emacs_pro             jim boland / tekcbi          11-Dec-85
	; written to allow usage of edt style emacs for vt100 
	; otherwise, the basic features of emacs are implemented
	
	 (load "time.ml")
	
	
	 (progn term
		(setq term (getenv "TERM"))
		(if (= (substr term 3 3) "100")
				(load "edt-sup")
			)
		(if (= (substr term 3 3) "100")
				(send-string-to-terminal "\033=")
			)
	 )
	
	; take care of problems with sytek
	  (bind-to-key "novalue" "\021")
	  (bind-to-key "novalue" "\023")
	  (bind-to-key "quote-character" "\014")
	
	; enlarge, shrink window
	
	  (bind-to-key "enlarge-window" "\^W>")
	  (bind-to-key "shrink-window" "\^W<")

	(defun
	   (rot13 odot
		  (setq odot (dot))
		  (message "Rotating buffer")
		  (sit-for 0)
		  (beginning-of-file)
		  (set-mark)
		  (end-of-file)
		  (rot13-region)
		  (goto-character odot))
	   (rot13-region
		  (filter-region "tr A-Za-z N-ZA-Mn-za-m")
		  (message "done"))
	)
	(bind-to-key "rot13-region" "OP")
	(bind-to-key "rot13-region" "OP")
	
	; unbind some problems
	
	  (bind-to-key "illegal-operation" "\^Xm")
	  (set "checkpoint-frequency" 32000)
	  (setq-default changed-buffer 0)
	
	
SHAR_EOF
fi # end of overwriting check
if test -f 'edt-help'
then
	echo shar: will not over-write existing file "'edt-help'"
else
cat << \SHAR_EOF > 'edt-help'
   ____________________________         _____________________________________
   |  ^  | Down |      |      |         |        | Help   | Fndnxt | Del L  |
   |  |  |   |  | <--- | ---> |         |  GOLD  |        |        |        |
   |  |  |   |  | Left | Right|         |        | APROPOS| FIND   | UND L  |
   | Up  |   v  |      |      |         -------------------------------------
   ----------------------------         | Repeat | Sect   | Append | Del W  |
APROPOS   Gives Unix style manual help  |        |        |        |        |
Backspace Backup to Beginning of Line   | COMMAND|        | REPLACE| UND W  |
Delete    Rubout Previous Character     -------------------------------------
Linefeed  Rubout Previous Word          | Advance| Backup |  Cut   | Del C  |
Ctrl/R    Refresh Screen                |        |        |        |        |
GOLD .    Insert Special Marker         | BOTTOM |  TOP   | PASTE  | UND C  |
GOLD /    Find & Remove Special Marker  -------------------------------------
^G        Copy from a Buffer            | Word   |  Eol   | Char   |        |
^V        Cut Region to a Buffer        |        |        |        | Enter  |
GOLD ^G   Replace Region with Buffer    |CHNGCASE| DEL EOL| CLN BUF|        |
GOLD ^V   Append Region to Buffer       ---------------------------|        |
GOLD I    Input File to a Buffer        |      Line       | Select | SUBS   |
GOLD O    Output a Buffer to File       |                 |        |        |
Keys in caps require pressing GOLD first|    OPEN LINE    |        |        |
Hit space bar to return to editor.      -------------------------------------
Press keypad key for help on that key.
SHAR_EOF
fi # end of overwriting check
if test -f 'time.ml'
then
	echo shar: will not over-write existing file "'time.ml'"
else
cat << \SHAR_EOF > 'time.ml'
; A simple clock for the mode line.

(declare-global time-running)
(setq time-running 0)
(if (! (is-bound ships-bells)) (setq-default ships-bells 0))
(if (! (is-bound checkpoint-interval)) (setq-default checkpoint-interval 5))
(setq-default &checkpoint-interval 0)

(defun
    (time dead
	(if (|
		(setq dead (< (process-status "newtime") 0))
		(! time-running))
	    (save-excursion
		(if (! dead)
		    (kill-process "newtime"))
		(setq global-mode-string "time and load")
		(setq time-running 0)
		(start-filtered-process 
		    "exec /usr/lib/local/cmu-emacs/loadst -n 60"
		    "newtime" "newtime-filter")))
	(novalue)
    )
)

(defun (newtime-filter
	   (setq global-mode-string (process-output))
	   (if (>= (setq &checkpoint-interval (+ &checkpoint-interval 1))
		   checkpoint-interval)
	       (progn (setq &checkpoint-interval 0)
		      (if (checkpoint)
			  (message "Checkpointed..."))))
	   (if (| (= (substr global-mode-string -8 4) "Mail")
		  (= (substr global-mode-string -7 4) "Mail"))
	       (progn (if (= time-running 1)
			  (progn (send-string-to-terminal "\^G")
				 (message "You have new mail")))
		      (setq time-running 2))
	       (setq time-running 1))
	   (if ships-bells
	       (progn
		     (if (= (substr global-mode-string 2 1) ":")
			 (setq global-mode-string (concat " " global-mode-string)))
		     (if (= (substr global-mode-string 4 2) "00")
			 (bells (substr global-mode-string 1 2) 7)
			 (= (substr global-mode-string 4 2) "15")
			 (bells 1 7)
			 (= (substr global-mode-string 4 2) "30")
			 (bells 2 7)
			 (= (substr global-mode-string 4 2) "45")
			 (bells 3 7))
		     (if (= (substr global-mode-string 1 6) "12:00p")
			 (setq global-mode-string 
			       (concat "Noon" 
				       (substr global-mode-string 8 -8)))
			 (= (substr global-mode-string 1 6) "12:00a")
			 (setq global-mode-string 
			       (concat "Midnight" 
				       (substr global-mode-string 8 -8))))
		     (if (= (substr global-mode-string 6 1) "p")
			 (if (= (substr global-mode-string 1 2) "12")
			     (setq global-mode-string 
				   (concat "Lunch? " global-mode-string))
			     (= (substr global-mode-string 1 2) " 6")
			     (setq global-mode-string 
				   (concat "Dinner? " global-mode-string))
			     (= (substr global-mode-string 1 2) "11")
			     (setq global-mode-string 
				   (concat "Bedtime? " global-mode-string))))
	       ))
	   (sit-for 0)))

(defun (bells num long
	      (setq num (arg 1 "How many? "))
	      (setq long (arg 2 "How long? "))
	      (while (> num 0)
		     (send-string-to-terminal "\^G")
		     (sit-for long)
		     (setq num (- num 1)))))
;(defun
;    (newtime-filter
;	(setq global-mode-string (process-output))
;	(setq time-running 1)
;	(sit-for 0)
;    )
;)



SHAR_EOF
fi # end of overwriting check
#	End of shell archive
exit 0