home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
001-099
/
ff093.lzh
/
MicroEmacs
/
doc
/
cmacros
< prev
next >
Wrap
Text File
|
1987-08-22
|
3KB
|
97 lines
; Cmacros!
;
; Here are a couple handy macros for MircoEMACS 38i. You can add these to
; your startup file ".emacsrc" or simply "execute-file" this macro file. It
; attaches two macro programs to F9 and F10. Pressing F9 causes the source
; in the current buffer to be compiled. ( based on buffer file name )
; On errors a jump is made to the source line(s) with the error message(s)
; shown as the top line of the screen.
; The output of the compile is sent to a error file "error.dat"...If there
; are any errors after the compile you will be automatically positioned at the
; error line with the corresponding error message displayed at the top of the
; screen. Pressing F10 causes you to proceed to the next error.
;
; Compile and error check
;
; This macro will compile the source file in the current buffer. Then it
; will call the error handling macro which looks for a magic file
; named "error.dat"...The error handling macro takes it from there...
;
; This macro is bound to the F9 function key.
;
bind-to-key execute-macro-9 FN8
9 store-macro
delete-other-windows
delete-buffer "error.dat"
set %command "CC "
set %command &cat %command ">error.dat "
set %command &cat %command $cfname
shell-command %command
execute-macro-8
!endm
;
; Error handling macro.
;
; This macro is smart in knowing the format of Aztec C's error messages.
; It will automagically look for a file named "error.dat" in the current
; directory. If found it will find the first error message and the file
; it belongs to. It then reads the file in and jumps to the first known
; error line. All this macro needs is a file in the current directory
; named "error.dat" to function. ( assuming "error.dat" is the redirected
; output from the Aztec C compiler. ) This macro can be called repeatly to
; process every error line in "error.dat"
;
; This macro is bound to the F10 function key.
;
bind-to-key execute-macro-8 FN9
8 store-macro
delete-other-windows
split-current-window
1 next-window
9 shrink-window
!force find-file "error.dat"
!if &sequal $status "FALSE"
write-message "Error file not found."
!return
!endif
beginning-of-line
next-line
!force search-forward ":"
!if &sequal $status "FALSE"
write-message "No more errors found."
next-window
delete-other-windows
!return
!endif
beginning-of-line
set %file &chr $curchar
*fileget
forward-character
!if &equal $curchar 58
!goto filehave
!endif
set %file &cat %file &chr $curchar
!goto fileget
*filehave
search-forward ":"
set %line &chr $curchar
*lineget
forward-character
!if &equal $curchar 58
!goto linegot
!endif
set %line &cat %line &chr $curchar
!goto lineget
*linegot
next-window
!force find-file %file
!if &sequal $status "FALSE"
write-message "Source file not found."
!return
!endif
goto-line %line
!endm
;
; EOF
;