[comp.editors] MicroEmacs macros

johnm@trsvax.UUCP (02/18/89)

I was wondering if anybody had MicroEmacs macros that would automatically
process the error output of either the Turbo or Microsoft C compilers?

Somebody posted their tags macro for MicroEmacs not to long ago and that
has proved to be very usefull.
 
John Munsch

schro@nixpbe.uucp (02/22/89)

hello, John Munsch wrote:
> I was wondering if anybody had MicroEmacs macros that would automatically
> process the error output of either the Turbo or Microsoft C compilers?

this is errlin.cmd .
it has been tested with microemacs 3.9e on output files
from ms-c 4.0, ms-c 5.0, masm 4.0 and masm 5.1 .
i don't have turbo .

1. execute-file errlin.cmd
2. enter the output file containing error messages
3. hit alt-f3 to go to the source-file and -line of the first/next error
4. hit alt-f3 to go back to output file
5. repeat step 3 and 4 for next error

hope this helps .
django

#--------------------------------CUT HERE-------------------------------------
#! /bin/sh
#
# This is a shell archive.  Save this into a file, edit it
# and delete all lines above this comment.  Then give this
# file to sh by executing the command "sh file".  The files
# will be extracted into the current directory owned by
# you with default permissions.
#
# The files contained herein are:
#
# -rw-------   1 schro    pws          853 Feb 22 16:23 errlin.cmd
#
echo 'x - errlin.cmd'
if test -f errlin.cmd; then echo 'shar: not overwriting errlin.cmd'; else
sed 's/^X//' << '________This_Is_The_END________' > errlin.cmd
X; Find-Error-Line Macro for MicroEMACS 3.9e and higher
X; Author: W.F.Schroeder  uunet!mcvax!unido!nixpbe!schroeder.pad
X; Date: 22 Feb. 1989
X;
X; Goes to file and line corresponding to error or warning in output file
X; Tested with MS-C 4.0, MS-C 5.0, MASM 4.0 and MASM 5.1
X;
X32	store-macro
X	!if %back2log
X		select-buffer %logbuf
X		set %back2log 0
X	!else
X		set %logbuf $cbufname
X		add-mode "MAGIC"
X		search-forward "\.[a-z][a-z]*([1-9][0-9]*) *: *[ew]"
X		search-reverse "\."
X		previous-word
X		set-mark
X		search-forward "("
X		backward-character
X		copy-region
X		set %srcfile $kill
X		search-forward "("
X		set-mark
X		search-forward ")"
X		backward-character
X		copy-region
X		set %line $line
X		find-file %srcfile
X		$kill goto-line
X		write-message %line
X		set %back2log 1
X	!endif
X!endm
X
Xset %back2log 0
Xbind-to-key execute-macro-32		FNj	;ALT-F3
Xclear-message-line
________This_Is_The_END________
if test `wc -l < errlin.cmd` -ne 38; then
	echo 'shar: errlin.cmd was damaged during transit (should have been 38 bytes)'
fi
fi		; : end of overwriting check
exit 0

+---------------+------------------------+-----------------------------+
| W.F.Schroeder |  Workstation Software  | Paper-: Nixdorf Computer AG |
+---------------+------------------------+ mail  : Dep. PE PC-SOFTWARE |
| UUCP: {uunet,mcvax}!unido!nixpbe!schro |         Pontanusstr. 55     |
| Phone: nat-5251-14-6694                |         D-4790 Paderborn    |
| AMPR:  DL5YEC @ DB0BQ  IP:44.130.16.15 |         Fed. Rep of Germany |
+----------------------------------------+-----------------------------+

johnm@trsvax.UUCP (02/25/89)

Apparently no one has already done macros to handle MSC and Turbo C error
output (yeah right...) so I'll have to do my own.  In the mean time I did
get a couple of requests for the previously posted ctags macro.  I've modified
it so that it will ask for a tag name to find if you are not actually sitting
on a function name.

The original author mentioned that ESC-tab makes a good binding for it.

John Munsch

========================= chew here ========================
; Find-Tags Macro for uEMACS 3.8i and higher ....
; simply add to your '.emacsrc'-file
; Author: Reimer Mellin
; Date: 13.apr.88
; You can copy, modify, use, abuse this stuff as you wish
;
; If you use this Macro please send a small contribution to GreenPeace
; or to some organisation against famine in the third world !!!!!!!!
; Minor-mods: John Munsch
; Date: 2.feb.89

22      store-macro
	!if &not &band $cmode 2
		!return
	!endif			; only allowed in CMODE 
	set $discmd FALSE
	set %tmp01 $cwline	; remember line
	add-mode "magic"
	set-mark
!force  search-forward "[^0-9A-Za-z_]"	; search for end of identifier
        delete-mode "magic"
	backward-character
	copy-region		; get identifier
	set %tagstr $kill
        !if &seq %tagstr ""
			set %tagstr @"Tag: "
        !endif
        !if &seq %tagstr ""
           set %var1 "no identifier specified"
          !goto error2
        !endif
        set %var1 &sub $wline $cwline
        %var1 next-line		; go to last line of window
        split-current-window	; so the new window will be the lower one
        previous-window
        %var1 previous-line
        exchange-point-and-mark
	set %tmp02 %tmp01
	!if &gre %tmp02 $wline
		set %tmp02 $wline
	!endif
	!if &les $cwline %tmp02
		&sub %tmp02 $cwline move-window-up
	!endif		; complicate calculation for restoring the
				; old context
	next-window
	!if &exist TAGS		; the TAGS-file ...
		find-file TAGS
	!else
                set %var1 "tags-file not found"
                previous-window
		!goto error1
	!endif
	add-mode "exact"	; for speed ....
	beginning-of-file	; rewind tags-file
!force  search-forward %tagstr
	!if &not $status
            set %var1 &cat %tagstr " not in tags-file"
*error1
!force 		delete-window
*error2
		write-message &cat "Fatal error: " %var1
		set $discmd TRUE
		!return
	!endif
        forward-character	; we were at end of identifier ...
	set-mark		; extract filename ..
	search-forward &chr 9
	backward-character
	copy-region
	set %var1 $kill
	3 forward-character	; extract pattern without '^' and '$' !!
	set-mark
	end-of-line
	2 backward-character
	copy-region
	set %pattern $kill
!force  find-file %var1		; look for filename
	!if &not $status
                set %var1 &cat %var1 " not found"
		!goto error1
	!endif
        beginning-of-file
        add-mode "exact"
!force  search-forward %pattern
	!if &not $status
                set %var1 &cat %var1 " is not as I remember (run ctags again)"
		!goto error1
	!endif
        delete-mode "exact"
        beginning-of-line	; found it ....
	set-mark
	set $discmd TRUE
!endm					;DONE