[comp.sys.ibm.pc] Microsoft mouse menu program for Micro-emacs

gregh@umd5.UUCP (12/11/86)

Since everyone else is posting their favorite Microsoft mouse menu
program, I thought I would include my own. The following is for
Micro-emacs.  I wrote it one afternoon when I got curious as to how
useful that little mouse actually was.  

I apologize for posting to this group, but since the source is fairly
small and of interest to only a small percentage of people who read
the net, I didnt feel that it belonged in net.sources.  Flames to
/dev/null or nul:.  Other constructive criticisms or queries may be
sent to me.

To make this work, just follow these simple steps:

	1) Download this to your pc, making sure that carriage
	   returns get placed at the end of the lines and that
	   the downloaded file ends with control Z.  If not, the
	   makemenu program will have problems digesting it.  Some
	   communications  programs  will  handle this for you
	   automatically, kermit does.  Yes, I guess I should have
	   posted it in arc format, oh well, this really is not so
	   tough.

	2) Compile it using the makemenu program from the Microsoft mouse
	   utilities disk.

	3) Then type "menu whatever.mnu" where whatever is the output file
	   of the makemenu program.  The menu program is also on the
	   utilities disk.

	4) Call up emacs and try it out.
	   

--------------------------  Cut here --------------------------
;  
; Micro-Emacs Microsoft mouse menu definitions
;
;	Greg Hollingsworth
;	gregh@trantor.umd.edu
;	...seismo!umcp-cs!cvl!umd5!gregh
; 	November 19, 1986
;

;
; Define movement and buttons as well as movement sensitivity
;
BEGIN lb,rb,bb,lm,rm,um,dm,36,44

;
; Define default left button action
;
lb:	EXECUTE emenu			; call up the main emacs menu
;
; Define default right button action
;
rb: 	EXECUTE setmark			; set the mark

;
; Define default action when both buttons are pressed
;
bb:	EXECUTE savefile		; save the file in the current buffer

;
; Define left motion
;
lm:	EXECUTE left

;
; Define right motion
;
rm:	EXECUTE right

;
; Define up motion
;
um:	EXECUTE up

;
; Define down motion
;
dm:	EXECUTE down

;
; Menus
;

;
; Main emacs menu 
;
emenu:	POPUP 1,1,INVERSE
TEXT "  Buffer  Dos  File  Paragraph  Point  Region  Window  Word  Quit               "
SELECT 1,  2,  8, bufmenu			; display the buffer menu
SELECT 1, 10,  5, rundos			; run a dos command
SELECT 1, 15,  6, filemenu			; display the file menu
SELECT 1, 21, 11, paramenu			; display the paragraph menu
SELECT 1, 32,  7, pointmenu			; display the point menu
SELECT 1, 39,  8, regionmenu		; display the region menu	
SELECT 1, 47,  8, windmenu			; display the window menu
SELECT 1, 55,  6, wordmenu			; display the word menu
SELECT 1, 61,  6					; quit
PEND

bufmenu: MENU "Buffer Menu",2,20,INVERSE		
OPTION	 "List Buffers   ", listbuf
OPTION   "Next Buffer    ", nextbuf
OPTION	 "Previous Buffer", prevbuf
OPTION   "Rename Buffer  ", renamebuf
OPTION	 "Switch Buffer  ", switchbuf
OPTION   "Delete Buffer  ", deletebuf
OPTION   "               ", bufmenu
OPTION	 "Main menu      ", emenu
OPTION	 "Exit           "
MEND


filemenu: MENU "File Menu", 2, 20, INVERSE		
OPTION 	  "Change file name", changefile
OPTION 	  "Examine file    ", examinefile
OPTION 	  "Exit emacs      ", exitemacs
OPTION 	  "Insert file     ", insertfile
OPTION 	  "Read file       ", readfile
OPTION 	  "Save file       ", savefile
OPTION 	  "Write file      ", writefile
OPTION 	  "Visit file      ", visitfile
OPTION	  "                ", filemenu
OPTION	 "Main menu        ", emenu
OPTION	 "Exit             "
MEND

paramenu: MENU "Paragraph Menu", 2, 20, INVERSE
OPTION	  "Next paragraph     ", nextpara
OPTION	  "Previous paragraph ", prevpara
OPTION	  "Justify paragraph  ", justpara
OPTION	  "Kill paragraph     ", killpara
OPTION	  "                   ", paramenu
OPTION	  "Main menu          ", emenu
OPTION	  "Exit               "
MEND

pointmenu: MENU "Point Menu", 2, 20, INVERSE
OPTION	  "Exchange point and mark", expm
OPTION	  "Set mark               ", setmark 
OPTION	  "                       ", pointmenu
OPTION	  "Main menu              ", emenu
OPTION	  "Exit                   "
MEND

regionmenu: MENU "Region Menu", 2, 20, INVERSE
OPTION	  "Copy region to kill buffer  ", crtkb
OPTION    "Delete region to kill buffer", drtkb
OPTION    "Lower case region           ", lowerreg
OPTION    "Upper case region           ", upperreg
OPTION	  "                            ", regionmenu
OPTION	  "Main menu                   ", emenu
OPTION	  "Exit                        "
MEND

windmenu: MENU "Window Menu", 2, 20, INVERSE
OPTION	  "Next window          ", nextwind
OPTION	  "Previous window      ", prevwind
OPTION	  "Split  current window", splitwind
OPTION	  "Delete current window", delwind
OPTION	  "Delete other windows ", delother
OPTION	  "                     ", windmenu
OPTION	  "Main menu            ", emenu
OPTION	  "Exit                 "
MEND

wordmenu: MENU "Word Menu", 2, 20, INVERSE
OPTION    "Lower case word      ", lowerword
OPTION	  "Upper case word      ", upperword
OPTION    "Capitolize word      ", capword
OPTION	  "Next word            ", nextword
OPTION    "Previous word        ", prevword
OPTION    "Delete next word     ", delnextword
OPTION    "Delete previoius word", delprevword
OPTION	  "                     ", wordmenu
OPTION	  "Main menu            ", emenu
OPTION	  "Exit                 "
MEND

lowerword:		TYPE 	ESC, "xcase-word-lower", ENTER
upperword:		TYPE    ESC, "xcase-word-capitalize", ENTER
capword:		TYPE	ESC, "xcase-word-capitolize", ENTER
nextword:		TYPE	ESC, "xforward-word", ENTER
prevword:		TYPE	ESC, "xbackward-word", ENTER
delnextword:	TYPE	ESC, "xdelete-next-word", ENTER
delprevword:	TYPE	ESC, "xdelete-previous-word", ENTER

;
; cursor functions
;
right:		EXECUTE cf
up:		TYPE	ESC, "xprevious-line", ENTER
down:		EXECUTE cn
left:		EXECUTE cb

;
; buffer functions
;
listbuf:	TYPE 	ESC, "xlist-buffers", ENTER
nextbuf:	TYPE 	ESC, "xnext-buffer", ENTER
prevbuf:	TYPE	ESC, "xprevious-buffer", ENTER
renamebuf:	TYPE	ESC, "xrename-buffer", ENTER
switchbuf:	TYPE	ESC, "xswitch-to-buffer", ENTER
deletebuf:	TYPE 	ESC, "xdelete-buffer", ENTER

;
; file functions
;
changefile: 	TYPE	ESC, "xchange-file-name", ENTER
examinefile: 	TYPE	ESC, "xexamine-file", ENTER
insertfile: 	TYPE	ESC, "xinsert-file", ENTER
readfile:	TYPE	ESC, "xread-file", ENTER
savefile:	TYPE	ESC, "xsave-file", ENTER
writefile:	TYPE 	ESC, "xwrite-file", ENTER
visitfile:	TYPE	ESC, "xvisit-file", ENTER

;
; window functions
;
delcurr:	TYPE	ESC, "xdelete-window", ENTER
delother:	TYPE	ESC, "xdelete-other-windows", ENTER
delwind:    	TYPE 	ESC, "xdelete-window", ENTER
nextwind:	TYPE	ESC, "xnext-window", ENTER
prevwind:	TYPE 	ESC, "xprevious-window", ENTER
resize:		TYPE	ESC, "xresize-window", ENTER
splitwind:	TYPE	ESC, "xsplit-current-window", ENTER

;
; paragraph functions
;
justpara:	TYPE	ESC, "xjustify-paragraph", ENTER
killpara:	TYPE 	ESC, "xkill-paragraph", ENTER
nextpara:	TYPE 	ESC, "xnext-paragraph", ENTER
prevpara:	TYPE	ESC, "xprevious-paragraph", ENTER

;
; point functions
;
expm:		TYPE	ESC, "xexchange-dot-and-mark", ENTER
setmark:	TYPE	ESC, "xset-mark", ENTER


;
; region functions
;
crtkb:		TYPE 	ESC, "xcopy-region-to-killbuffer", ENTER
drtkb:		TYPE 	ESC, "xdelete-to-killbuffer", ENTER
lowerreg:	TYPE	ESC, "xcase-region-lower", ENTER
upperreg:	TYPE	ESC, "xcase-region-upper", ENTER

;
; misc functions
;
pageup:		TYPE	ESC, "xprevious-page", ENTER
pagedown:  	TYPE	ESC, "xnext-page", ENTER
exitemacs:	TYPE	ESC, "xexit-emacs", ENTER
rundos:		TYPE	ESC, "xpause-emacs", ENTER


;
; The following control and escape codes are defined
; here for convenience.  They are not used much for
; the microemacs menus, but they may be useful in
; converting this menu description to another
; application.
;

;
; Define control codes
;
ca:	TYPE 1
cb:	TYPE 2
cc:	TYPE 3
cd:	TYPE 4
ce:	TYPE 5
cf:	TYPE 6
cg:	TYPE 7 
ch:	TYPE 8 
ci:	TYPE 9
cj:	TYPE 10
ck:	TYPE 11
cl:	TYPE 12
cm:	TYPE 13
cn:	TYPE 14
co:	TYPE 15
cp:	TYPE 16
cq:	TYPE 17
cr:	TYPE 18
cs:	TYPE 19
ct:	TYPE 20
cu:	TYPE 21 
cv:	TYPE 22
cw:	TYPE 23
cx:	TYPE 24
cy:	TYPE 25
cz:	TYPE 26

;
; Define escape codes
;
ea:	TYPE	ESC,"a"
eb:	TYPE	ESC,"b"
ec:	TYPE	ESC,"c"
ed:	TYPE	ESC,"d"
ee:	TYPE	ESC,"e"
ef:	TYPE	ESC,"f"
eg:	TYPE	ESC,"g"
eh:	TYPE	ESC,"h"
ei:	TYPE	ESC,"i"
ej:	TYPE	ESC,"j"
ek:	TYPE	ESC,"k"
el:	TYPE	ESC,"l"
em:	TYPE	ESC,"m"
en:	TYPE	ESC,"n"
eo:	TYPE	ESC,"o"
ep:	TYPE	ESC,"p"
eq:	TYPE	ESC,"q"
er:	TYPE	ESC,"r"
es:	TYPE	ESC,"s"
et:	TYPE	ESC,"t"
eu:	TYPE	ESC,"u"
ev:	TYPE	ESC,"v"
ew:	TYPE	ESC,"w"
ex:	TYPE	ESC,"x"
ey:	TYPE	ESC,"y"
ez:	TYPE	ESC,"z"

-- 
Greg Hollingsworth		...!seismo!umcp-cs!cvl!umd5!gregh
U of Md. CSC Systems staff	            gregh@trantor.umd.edu