summaryrefslogtreecommitdiff
path: root/kepteditor.com
blob: 78594548a0bf4236c89b5e2183ac5af3fe33ce42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
$ verify = f$verify (0)
$ !
$ ! Kept_Editor.COM
$ ! Command file for use on VMS to spawn an Emacs process
$ ! that can be suspended with C-z and will not go away
$ ! when other programs are run.  This is the normal way
$ ! for users to invoke Emacs on VMS; the command "emacs"
$ ! is normally defined to execute this file.
$ ! That definition, and other definitions used by it, are done by `emacs.com'.
$ ! Users who want to use Emacs should have their `login.com' files
$ ! execute `emacs.com', which is to be found in this directory.
$ !
$ ! Joe Kelsey
$ ! FlexComm Corp.
$ !
$ ! September, 1985
$ !
$ ! Run or attach to an editor in a kept fork.
$ !
$ ! Modified by Marty Sasaki to define the job logical name
$ ! "EMACS_FILE_NAME" with the value of the filename on the command
$ ! line. Lisp code can then use the value of the logical to resume or
$ ! to start editing in that file.
$ !
$ !
$	edit		= ""
$	name		= p1 + " " + f$trnlnm ( "TT" ) - ":"
$	priv_list	= f$setprv ("NOWORLD, NOGROUP")
$	pid 		= 0
$ 10$:
$ 	proc		= f$getjpi ( f$pid ( pid ), "PRCNAM")
$ 	if proc .eqs. name then -
$		goto attach
$ 	if pid .ne. 0 then -
$		goto 10$
$ spawn:
$	args		= p2 + " " + p3 + " " + p4 + " " + p5 + " " + -
    			  p6 + " " + p7 + " " + p8
$ 	priv_list	= f$setprv ( priv_list )
$ 	write sys$error -
"[Spawning a new Kept ''P1']"
$	if p1 .nes. "TPU" then -
$		goto check_emacs
$ 	define/user	sys$input	sys$command
$ 	spawn	/process="''NAME'" -
    		/nolog -
    		edit/'p1' 'args'
$ 	goto quit1
$ check_emacs:
$	if p1 .nes. "EMACS" then -
$		goto un_kempt
$	define/user	sys$input	sys$command
$	spawn	/process="''NAME'" -
		/nolog -
		runemacs 'args'
$	goto quit1
$ un_kempt:
$ ! The editor is unruly - spawn a process and let the user deal with the
$ ! editor himself.
$	spawn	/process="''NAME'" -
		/nolog
$	goto quit1
$ attach:
$ 	priv_list	= f$setprv ( priv_list )
$	message_status = f$environment("message")
$	set noon
$	on control_y then goto quit
$	set message /nofacility/noidentification/noseverity/notext
$	if p2 .eqs. "" then goto no_logical
$	temp = f$trnlnm("SYS$DISK") + f$directory() + p2
$	temp = f$edit(temp,"lowercase")
$	define/nolog/job emacs_file_name "''temp'"
$ no_logical:
$ 	write sys$error -
"[Attaching to process ''NAME']"
$ 	define/user	sys$input	sys$command
$ 	attach "''NAME'"
$ quit:
$	set noon
$	if p2 .eqs. "" then goto quit1
$	deassign/job emacs_file_name
$ quit1:
$	set message 'message_status
$ 	write sys$error -
"[Attached to DCL in directory ''F$TRNLNM("SYS$DISK")'''F$DIRECTORY()']"
$ 	if verify then -
$		set verify
$	exit