Article View: comp.editors
Article #3432MicroEmacs macros
From: johnm
Date: Fri, 24 Feb 1989 17:26
Date: Fri, 24 Feb 1989 17:26
106 lines
3489 bytes
3489 bytes
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 ¬ &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 ¬ $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 ¬ $status
set %var1 &cat %var1 " not found"
!goto error1
!endif
beginning-of-file
add-mode "exact"
!force search-forward %pattern
!if ¬ $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
Technical Details
Message-ID:
<225600003@trsvax>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!ames!killer!texbell!merch!cpe!hal6000!trsvax!johnmShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!ames!killer!texbell!merch!cpe!hal6000!trsvax!johnm From: johnm@trsvax.UUCP Newsgroups: comp.editors Subject: MicroEmacs macros Message-ID: <225600003@trsvax> Date: 24 Feb 89 17:26:00 GMT Lines: 106 Nf-ID: #N:trsvax:225600003:000:3051 Nf-From: trsvax.UUCP!johnm Feb 24 11:26:00 1989