bam@rudedog.sgi.com (Brian McClendon) (09/29/89)
Does anyone have ctags macros for uEmacs 3.10? I have heard of a version for GNU, but prefer to fight rather than switch. -------------------------------------------------------------------------- Brian McClendon bam@rudedog.SGI.COM ...!uunet!sgi!rudedog!bam 415-335-1110 "... Cornnuts ..." - Heather 1 --------------------------------------------------------------------------
hirano@tkl.iis.u-tokyo.ac.jp (Satoshi Hirano) (10/02/89)
In article <724@odin.SGI.COM> bam@rudedog.sgi.com (Brian McClendon) writes: >Does anyone have ctags macros for uEmacs 3.10? I have >heard of a version for GNU, but prefer to fight rather >than switch. OK, Here is my tags.cmd and compile_it.cmd for uEmacs3.9e. ^^^^^^^^^^ Note that I used undocumented '$kill' variable on uEmacs3.9e. I don't know you can use $kill on uEmacs3.10 or not. ------------ HIRANO Satoshi Institute of Industrial Science Univ. of Tokyo Japan hirano@tkl.iis.u-tokyo.ac.jp #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # tags.cmd # compile_it.cmd # This archive created: Mon Oct 2 18:19:40 1989 export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'tags.cmd' then echo shar: "will not over-write existing file 'tags.cmd'" else cat << \SHAR_EOF > 'tags.cmd' ; @(#)tags.cmd 87/12/20 (Halca.Hirano) ; ; Author: Hirano Satoshi ; (C) 1987 Halca Computer Science Laboratory TM ; University of Tokyo. ; Copy free! ; ; Entry: ; procedure tag-jump jump to function() body ; procedure tag-back jump back to tag-jump point ; ; NOTE: ; This utilites is used with ctags command on Unix BSD/V. ; ; Edition History: ; 1.1 87/12/20 Halca.Hirano creation ; ; global var %tagbuf %tagline %tagcol store-procedure tag-jump ; tag-jump ; 1) save original position for tag-back ; 2) get function() name to search ; 3) use tags buffer ; 4) get function() entry in tags file ; 5) get file name including function() ; 6) get regular expretion to search function() ; 7) find file including function() body ; 8) search function() ; ; local var %funcname %filename %funcdef ; external var %tagbuf %tagline %tagcol ; ; save original position set %tagbuf $cbufname set %tagline $curline set %tagcol $curcol save-window ; get function() name add-mode MAGIC set-mark !force search-forward "[ ()~t~n]" ; [^a-zA-Z_] ???does not work??? backward-character copy-region set %funcname $kill ; get function name ; use tags buffer select-buffer tags beginning-of-file ; get function() entry !force search-forward %funcname !if ¬ $status select-buffer %tagbuf !force restore-window write-message &cat "No tag for " %funcname !return !endif ; get file name for function() search-forward "~t" set-mark ; beginning of file name search-forward "~t" 1 backward-character copy-region set %filename $kill ; get file name ; get definition of function() 3 forward-character ; point to not regular expression part set-mark end-of-line 2 backward-character copy-region set %funcdef $kill ; get function definition parg ; find file for function() body !force find-file %filename !if ¬ $status ; file doesn't exist select-buffer &tagbuf !force restore-window write-message &cat %filename " not found" !return !endif beginning-of-file delete-mode MAGIC ; search function() ; NOTE I would like to use MAGIC mode search with tags' regular ex. ; But closure may not work correctly. !force search-forward %funcdef beginning-of-line add-mode MAGIC ; ??? redraw-display !endm store-procedure tag-back ; jump back to saved position ; ; local var ; extern var %tagbuf %tagcol %tagline ; !if &sequal %tagbuf "ERROR" ; no previous tag jump write-message "No previous tag jump" !return; !endif !force select-buffer %tagbuf !if ¬ $status ; no previous buffer write-message &and &and "No previous buffer [" %tagbuf "]" !return; !endif set $curline %tagline set $curcol %tagcol redraw-display !endm 2 store-macro run tag-jump !endm 3 store-macro run tag-back !endm 4 store-macro search-forward "^{" !endm 5 store-macro search-forward "^}" !endm 6 store-macro search-reverse "^{" !endm 7 store-macro search-reverse "^}" !endm 8 store-macro ; read tags file !if &sequal &find "tags" "tags" ; caution &find returns STRING not BOOL !force view-file "tags" select-buffer "main" !endif !endm bind-to-key execute-macro-2 ^T bind-to-key execute-macro-3 ^XT bind-to-key execute-macro-4 ^X{ bind-to-key execute-macro-5 ^X} bind-to-key execute-macro-6 M-{ bind-to-key execute-macro-7 M-} execute-macro-8 SHAR_EOF fi if test -f 'compile_it.cmd' then echo shar: "will not over-write existing file 'compile_it.cmd'" else cat << \SHAR_EOF > 'compile_it.cmd' ; @(#)compile_it.cmd 1.2 10/08/88 (Halca.Hirano) ; ; compile_it.cmd: call compiler ; ; Author: Hirano Satoshi ; (C) 1987 Halca Computer Science Laboratory TM ; University of Tokyo. ; Copy free! ; ; Edition History: ; 1.1 87/12/20 Halca.Hirano creation ; 1.2 88/10/08 Halca.Hirano add sh,shell description ; store-procedure save_all ; save all of buffer set %curBuffer $cbufname ; get current buffer name !while TRUE !if &equ &band $cmode 16 0 ; check non VIEW mode write-message &cat &cat "[Saving " $cbufname " ]~r" !force save-file ; SCCS user's (caution; I can't test whether file is updated or not) ; set %sccsfile &cat "s." $cfname ; !if &find %sccsfile ; write-message &cat "delta " %sccsfile ; shell-command &cat "delta " %sccsfile ; !endif ; end SCCS support !endif !force next-buffer !if &sequal %curBuffer $cbufname !break !endif !endwhile !endm store-procedure rm_errorlog ; remove errorlog window and buffer ; force errorlog window invisible set %curWindow $cbufname ; get current buffer name !while TRUE !if &sequal $cbufname "errorlog" delete-window !break !endif next-window !if &sequal $cbufname %curWindow !break !endif !endwhile ; delete buffer for errorlog !force delete-buffer errorlog ; set $debug FALSE !endm store-procedure compile_it ; compile program ; 1) save all buffer ; 2) remove errorlog buffer and window ; 3) get user's command line for calling compiler ; 4) exec compiler with '2>errorlog' ; 5) make errorlog window with VIEW mode ; 6) remove file errorlog ; set %newprog @&cat &cat "compile [" %defprog "]: " !if &sequal %newprog "ERROR" ; command aborted write-message "[Aborted]" !return !endif !if ¬ &equal &length %newprog 0 set %defprog %newprog !endif run rm_errorlog run save_all !force shell-command &cat %defprog %redir !if ¬ &equ $rval 0 ; if error in compiling split-current-window view-file errorlog 1 next-window !endif !force shell-command %rmprog !endm ;***** USER CHANGABLE PART **************************** 1 store-macro run compile_it !endm set %defprog "make" ; default compile_it command line set %rmprog "rm -f errorlog" ; remove errorlog file ;set %redir " 2> errorlog" ; for sh set %redir " >& errorlog" ; for csh, OS-9 msh ;set %redir " >> errorlog" ; for OS-9 standard shell bind-to-key execute-macro-1 ^X^E ;***** END compile_it.cmd ***************************** SHAR_EOF fi exit 0 # End of shell archive