forked from torvalds/uemacs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.cmd
57 lines (49 loc) · 944 Bytes
/
shell.cmd
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
; OS shell interface, MS-DOS and UNIX
store-procedure prompt
set $discmd FALSE
end-of-file
insert-string "shell% "
set-mark
set $discmd TRUE
unmark-buffer
!endm
store-procedure getline
set $discmd FALSE
end-of-file
!force backward-character
exchange-point-and-mark
copy-region
set %shline $kill
end-of-file
set $discmd TRUE
!endm
store-procedure execline
; shell-command "echo command not found > shtmp"
shell-command &cat %shline " > shtmp"
!force insert-file shtmp
!endm
; prompt and execute a command
10 store-macro
run getline
!if ¬ &seq %shline ""
run execline
!endif
run prompt
!endm
11 store-macro
set $discmd FALSE
!if &seq $cbufname "*Shell*"
bind-to-key execute-macro-10 ^M
run prompt
!else
bind-to-key newline ^M
!endif
set $discmd TRUE
!endm
store-procedure openshell
set $discmd FALSE
bind-to-key execute-macro-11 M-FNX
select-buffer "*Shell*"
set $discmd TRUE
!endm
run openshell