mackenzi@thor.acc.stolaf.edu (David MacKenzie) (05/14/89)
I've updated the tags macros a bit for MicroEMACS 3.10. ; Find C tags for MicroEMACS 3.10 ; Author: Reimer Mellin ; Modified by: David MacKenzie ; Latest revision: 13 May 1989 ; These macros go to the tag in a second window using a vi format tags ; file (not a GNU Emacs format TAGS file). set $discmd FALSE ; Don't display messages on command line. ; Search for the tag of the identifier that starts at point. store-procedure find-point-tag setup-tags !if ¬ %ok !return !endif set %savemode $cmode add-mode "magic" !force search-forward "[^0-9A-Za-z_]" ; search for end of identifier set $cmode %savemode backward-character copy-region ; get identifier !if &sequal $kill "" write-message "No tag specified" set $discmd TRUE !return !endif set %ident $kill find-tags !endm macro-to-key find-point-tag M-T ; Search for the tag of the identifier prompted for in the message line. store-procedure find-msg-tag setup-tags !if ¬ %ok !return !endif set %ident @"Search for tag: " !if &sequal %ident "ERROR" write-message "[Aborted]" !return !endif find-tags !endm macro-to-key find-msg-tag ^XT store-procedure setup-tags set $discmd FALSE !if ¬ &exist "tags" write-message "No tags file" set %ok FALSE !return !endif set %startcwl $cwline set-mark set %ok TRUE !endm store-procedure find-tags write-message &cat "Searching for tag " &cat %ident " . . ." delete-other-windows set %lfrombot &sub $wline $cwline %lfrombot next-line ; go to last line of window split-current-window previous-window ; complicated calculation for restoring the old context %lfrombot previous-line exchange-point-and-mark ; return to original point !if &less $wline %startcwl set %startcwl $wline !endif !if &less $cwline %startcwl &sub %startcwl $cwline move-window-up !endif next-window find-file "tags" ; find identifier in tags file add-mode "exact" add-mode "magic" beginning-of-file ; rewind tags file !force search-forward &cat "^" &cat %ident &chr 9 !if ¬ $status set %errmesg &cat %ident ": No such tag in tags file" *error1 !force delete-window *error2 write-message %errmesg set $discmd TRUE !return !endif ; extract filename set-mark search-forward &chr 9 ; find tab after filename backward-character copy-region set %tagfile $kill ; extract search string 3 forward-character ; skip past tab /^ set-mark end-of-line 2 backward-character ; back up past / copy-region set %pattern $kill !force find-file %tagfile !if ¬ $status set %errmesg &cat %tagfile " not found" !goto error1 !endif ; search for pattern in tagfile beginning-of-file set %savemode $cmode add-mode "exact" ; we don't use magic mode because of problems with "*". delete-mode "magic" !force search-forward %pattern !if ¬ $status set %errmesg "Pattern for tag not found; rerun ctags" set $cmode %savemode !goto error1 !endif set $cmode %savemode beginning-of-line ; found the tag set-mark clear-message-line set $discmd TRUE !endm set $discmd TRUE ; Display messages on command line. -- David MacKenzie mackenzi@thor.stolaf.edu or edf@rocky2.rockefeller.edu