@if-using not(ocl-file-tags-mac) @use (ocl-file-tags-mac) ;OCL{{{}}} ;OCL{{{ libs @if-using not(ocl-file-delchar) @lib delchar @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE T-COMP ) @if-using not(ocl-file-hide-buffer) @lib hide-buffer @fi @fi ;OCL}}} ;OCL{{{ reference description @if-using ( FUN-REFERENCE ) ; 1 ; This is a libary file, supporting the standard (vi-known) tags file for moving to other positions and tag-completion! This package can only be used, if Origami is compiled to support regular expressions. ;OCL{{{ @tags-mac conditional compilation If this package is included more than once, all needed tags have to be defined at the first include! The following tags can be set: @ref-start-tbl Tag 16 Function 50 E-G-T-ABUFF @@ enter-and-go-tags-adjacent-buffer E-G-T-BUFF @@ enter-and-go-tags-buffer E-O-T-ABUFF @@ enter-and-open-tags-adjacent-buffer E-O-T-BUFF @@ enter-and-open-tags-buffer F-G-T-ABUFF @@ find-and-go-tags-adjacent-buffer F-G-T-BUFF @@ find-and-go-tags-buffer F-O-T-ABUFF @@ find-and-open-tags-adjacent-buffer F-O-T-BUFF @@ find-and-open-tags-buffer FE-G-T-ABUFF @@ find-or-enter-and-go-tags-adjacent-buffer FE-G-T-BUFF @@ find-or-enter-and-go-tags-buffer FE-O-T-ABUFF @@ find-or-enter-and-open-tags-adjacent-buffer FE-O-T-BUFF @@ find-or-enter-and-open-tags-buffer GO-TAG-MARK @@ go-tag-mark I-T-FILE @@ insert-tags-file O-T-AFILE @@ open-adjacent-buffer-tags-file O-T-FILE @@ open-buffer-tags-file Q-U-G-T-BUFF @@ quit-unchanged-to-other-buffer S-N-I-T @@ search-next-incorrect-tag-entry S-U-T-FILE @@ set-user-tag T-COMP @@ tag-completion @ref-end-tbl If your filesystems uses special names for absolut filenames, define the tag ROOT-TEST and a function, returning true, if the word starting at current cursor position is an absolute filename. ;OCL}}} ;OCL{{{ @tags-mac error/message return The OCL-variable tags-error contains the error/message coding for the tags actions: @ref-start-tbl Value 5 Error/Message 50 0 @@ ok 1 @@ tagged file edited more than once 2 @@ no tag iven 3 @@ cannot open tags-file 4 @@ no valid tag in tags-file 5 @@ cannot open tagged file 6 @@ tag notfound in tagged file 7 @@ File edted only once 8 @@ Currentbuffer is changed 9 @@ position not found in other buffer (folds entered) 10 @@ position not found in other buffer 11 @@ using yur tags file first 12 @@ using dfault tags files 13 @@ Sorry, o regular expressions! * @@ unspecified error @ref-end-tbl ;OCL}}} @fi ;OCL}}} ;OCL{{{ reference tags-file @if-using ( FUN-REFERENCE ) ; Tags file ; file-reference If you want to use the tags facilities, Origami needs to read a special tags file. The functions try to use the first of the following files: @ref-start-tbl File 48 directory-of-file/tags or file/tags (*) tags ~/tags ~/.oritags @ref-end-tbl @ref-start-item * depending on the type of the current file. @ref-end-item During the editor session, you can specify another tags file, using function set-user-tags-file. Entries in the tags file are normal tags entries: ;OCL{{{ @tags-mac tag filename search-exp @ref-start-tbl Item 10 Meaning 48 tag @@ name of a tag, a string filename @@ a string search-exp @@ /^text$/ @@ ?^text$? @@ /^text/ @@ ?^text? @@ /text$/ @@ ?text$? @@ /text/ @@ ?text? @ref-end-tbl These entries might be produced by ctags! ;OCL}}} ;OCL{{{ @tags-mac tag filename line-number @ref-start-tbl Item 10 Meaning 48 tag @@ name of a tag, a string filename @@ a string line-number @@ a sequence of digits 0..9 @ref-end-tbl These entries might be produced by ctags! ;OCL}}} ;OCL{{{ @tags-mac tag file Bexpression @ref-start-tbl Item 10 Meaning 48 tag @@ name of a tag, a string filename @@ a string expression @@ a basic-regular search expression @ref-end-tbl These entries are an extension to the standard tags syntax! ;OCL}}} ;OCL{{{ @tags-mac tag file Eexpression @ref-start-tbl Item 10 Meaning 48 tag @@ name of a tag, a string filename @@ a string expression @@ a extended-regular search expression @ref-end-tbl These entries are an extension to the standard tag syntax! ;OCL}}} ;OCL{{{ @tags-mac string `tag-completion' reads only the first word on the lines. So a line containing a simple string can be used to add keywords for tag-completion! Such short entries cannot be used for jumping to a tagged position! ;OCL}}} @fi ;OCL}}} ;OCL{{{ reference tags @if-using ( FUN-REFERENCE ) ; Tags ; find-open-ref find-aopen-ref enter-open-ref enter-aopen-ref find-go-ref find-ago-ref enter-go-ref enter-ago-ref fe-open-ref fe-aopen-ref fe-go-ref fe-ago-ref go-tag-mark-ref Tags are defined using two character sets: @ref-start-item c-tags-x-word-set / c-tags-word-set tag names are buildt using only these characters, c-tags-x-word-set is only used, if language None is active. @ref-end-item @ref-start-item c-tags-start-word-set: first character has to be in this set @ref-end-item Default values are: @ref-start-picture ( defset c-tags-start-word-set ( alpha ) ) ( defset c-tags-word-set ( alpha digit "_ ) ) ( defset c-tags-x-word-set ( c-tags-word-set "- ) ) @ref-end-picture Changing these sets at runtime, changes the tag-search algorythm! c-tags-start-word-set has to be a subset of c-tags-word-set! @fi ;OCL}}} ( demand-load ( ;OCL{{{ history (used as string variable) @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-U-T-FILE I-T-FILE O-T-FILE O-T-AFILE S-N-I-T T-COMP ) ( history tags-history ) ( history tags-file ) @fi ;OCL}}} ;OCL{{{ variables ( defvar ( @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-N-I-T T-COMP I-T-FILE O-T-FILE O-T-AFILE ) tags-old-regexp-mode @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE T-COMP ) tags-old-buffer tags-dummy-buffer @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE T-COMP ) tags-hidden-buffer @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-U-T-FILE I-T-FILE O-T-FILE O-T-AFILE T-COMP ) tags-user-tags-file @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF Q-U-G-T-BUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE ) tags-fileno @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-U-T-FILE I-T-FILE O-T-FILE O-T-AFILE S-N-I-T T-COMP ) tags-error tags-extended-set @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF T-COMP ) tags-height tags-width @fi @if-using ( E-O-T-BUFF E-O-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-U-T-FILE T-COMP ) tags-op @fi @if-using ( E-O-T-BUFF E-O-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) tags-extend @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF T-COMP ) tags-absolut @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) tags-add-start tags-add-end tags-reg-type @fi ) ) ;OCL}}} ;OCL{{{ set for tags @if-using ( F-O-T-BUFF F-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF T-COMP ) ( defset c-tags-start-word-set ( alpha ) ) ( defset c-tags-word-set ( c-tags-start-word-set digit "_ ) ) ( defset c-tags-x-word-set ( c-tags-word-set "- ) ) @fi ;OCL}}} ;OCL{{{ local functions ;OCL{{{ shortcuts for reg expressions @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-N-I-T ) ( defmac SPACE-SET ( "[:space:] ) ) @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-N-I-T ) ( defmac RE1 ( "\ "( ) ) ( defmac RE2 ( "\ ") ) ) ( defmac OR ( "\ "| ) ) ( defmac SPACE ( "[ SPACE-SET "] "\+ ) ) ( defmac NO_SPACE ( "[^ SPACE-SET "] "\+ ) ) ( defmac B_SL ( "\\ )) @fi ;OCL}}} ;OCL{{{ file-and-tag-expression @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-N-I-T ) ( deffun file-and-tag-expression ( SPACE ; space NO_SPACE ; filename SPACE ; space RE1 ; tag as "[[:digit:]]\+ ; line number OR ; or "/ RE1 "[^ B_SL "] OR B_SL "[ B_SL "/ "] RE2 "*/ ; search patter forward OR ; or "? RE1 "[^ B_SL "] OR B_SL "[ B_SL "/ "] RE2 "*? ; search patter reverse OR ; or RE1 "B\|E RE2 ".* ; regexp RE2 "$ ) ) @fi ;OCL}}} ;OCL{{{ handle magic mode ;OCL{{{ tags-basic-magic @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-N-I-T T-COMP ) ( deffun tags-basic-magic ( delete-mode-regular-expression set tags-old-regexp-mode +(1 ocl-argument) add-mode-basic-regular-expression if =(ocl-argument 0) ( set tags-error 13 ) fi ) ) @fi ;OCL}}} ;OCL{{{ tags-restore-magic @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-N-I-T T-COMP I-T-FILE O-T-FILE O-T-AFILE ) ( defmac tags-restore-magic ( case ( pre ( set tags-old-regexp-mode -(tags-old-regexp-mode 1) ) =(tags-old-regexp-mode 0) ( delete-mode-regular-expression ) ) ( pre ( set tags-old-regexp-mode -(tags-old-regexp-mode 1) ) =(tags-old-regexp-mode 0) ( add-mode-basic-regular-expression ) ) ( pre ( set tags-old-regexp-mode -(tags-old-regexp-mode 1) ) =(tags-old-regexp-mode 0) ( add-mode-extended-regular-expression ) ) default ( set tags-old-regexp-mode 0 ) esac ) ) @fi ;OCL}}} ;OCL{{{ pretty-basic-regexp @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) @if-using not( basic-regexp-chars-defined ) @use ( basic-regexp-chars-defined ) ( defset basic-regexp-chars ( "* ". "[ "] "^ "$ "\ ) ) @fi ( deffun ( full ) pretty-basic-regexp ( if in-prompt ( beginning-of-line if test-char-set space ;OCL{{{ change indentation search ( "[ SPACE-SET "]* while test-char-set space ( forward-character delete-previous-character ) ) ;OCL}}} fi while not(test-end-line) ;OCL{{{ test for critical, maybe quote, and move -> ( if test-char-set basic-regexp-chars ( if or(full not(test-char "\)) ( "\ ) fi ) fi forward-character ) ;OCL}}} ) fi ) ) @fi ;OCL}}} ;OCL}}} ;OCL{{{ tags file ;OCL{{{ close-tags-file @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE T-COMP ) ( defmac close-tags-file ( goto-buffer-id tags-dummy-buffer leave-hidden-dummy-buffer(tags-old-buffer) set tags-hidden-buffer 0 ) ) @fi ;OCL}}} ;OCL{{{ open-tags-file @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE T-COMP ) ( deffun ( parse ) open-tags-file ( ;OCL{{{ tags filename to tags-history screen-off history-edit-filename tags-history () end-of-line case ;OCL{{{ file ( =(file-type 0) ( backward-character while and(not(test-char path-separator) not(test-end-line)) ( forward-character delete-previous-character backward-character ) ) ) ;OCL}}} ;OCL{{{ directory ( =(file-type 1) ( backward-character if not(test-char path-separator) ( forward-character insert-ascii path-separator backward-character ) fi ) ) ;OCL}}} esac if not(test-begin-line) ( forward-character ) fi "tags newline-and-indent screen-on ;OCL}}} ;OCL{{{ open buffer set tags-old-buffer current-buffer-id open-hidden-dummy-buffer(false) set tags-dummy-buffer current-buffer-id ;OCL}}} set tags-hidden-buffer current-buffer-id if tags-user-tags-file ;OCL{{{ try to read user defined tags file ( if last-message M_CANTOPEN () fi insert-file get-history tags-file 0 newline-and-indent ) ;OCL}}} else ;OCL{{{ cannot open ( message ( M_CANTOPEN ) ) ;OCL}}} fi if last-message M_CANTOPEN ;OCL{{{ try default path ( insert-file get-history tags-history 0 newline-and-indent if last-message M_CANTOPEN ;OCL{{{ try tags ( insert-file "tags newline-and-indent if last-message M_CANTOPEN ;OCL{{{ try ~/tags ( insert-file "~ insert-ascii path-separator "tags newline-and-indent if last-message M_CANTOPEN ;OCL{{{ try ~/.oritag ( insert-file "~ insert-ascii path-separator ".oritags newline-and-indent if last-message M_CANTOPEN ;OCL{{{ error ( set tags-error 3 close-tags-file ) ;OCL}}} fi ) ;OCL}}} fi ) ;OCL}}} fi ) ;OCL}}} fi ) ;OCL}}} fi ) ) @fi ;OCL}}} ;OCL{{{ cut-first-tag-entry @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) ( defmac cut-first-tag-entry ( if in-prompt ( beginning-of-line while not(test-char-set space) ( forward-character delete-previous-character ) while test-char-set space ( forward-character delete-previous-character ) ) fi ) ) @fi ;OCL}}} ;OCL}}} ;OCL{{{ tags-complain ;OCL{{{ reference @if-using ( FUN-REFERENCE ) 2 ; tag-complain-ref ;OCL{{{ tags-complain If tags-error is set, show the corresponding message. ;OCL}}} @fi ;OCL}}} @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-U-T-FILE I-T-FILE O-T-FILE O-T-AFILE S-N-I-T T-COMP ) ;OCL{{{ tags-error-message ;OCL{{{ define string for missing re ( demand-load not ( ( defmac no-reg-exp ( "Sorry, " "no " "regular " "expressions! ) ) ( undeclare ( no-reg-exp ) ) ) ) ;OCL}}} ( deffun tags-error-message ( case ;OCL{{{ 1 multi-edit ( =(tags-error 1) ( message ("tagged " "file " "edited " "more " "than " "once! ) ) ) ;OCL}}} ;OCL{{{ 2 no tag ( =(tags-error 2) ( message ("no " "tag " "given! ) ) ) ;OCL}}} ;OCL{{{ 3 no tags file ( =(tags-error 3) ( message (M_CANTOPEN " "tags-file! ) ) ) ;OCL}}} ;OCL{{{ 4 tag not in tags file ( =(tags-error 4) ( message ("no " "valid " "tag " "in " "tags-file " history file "! )) ) ;OCL}}} ;OCL{{{ 5 cannot open taged file ( =(tags-error 5) ( message (M_CANTOPEN " "tagged " "file " history file "! ) ) ) ;OCL}}} ;OCL{{{ 6 tag not found in tagged file ( =(tags-error 6) ( message ("tag " "not " "found " "in " "tagged " "file! ) ) ) ;OCL}}} ;OCL{{{ 7 no multi edit ( =(tags-error 7) ( message ( "File " "edited " "only " "once! ) ) ) ;OCL}}} ;OCL{{{ 8 current changed ( =(tags-error 8) ( message ( "Current " "buffer " "is " "changed! ) ) ) ;OCL}}} ;OCL{{{ 9 not found in other buffer ( =(tags-error 9) ( message ( "position " "not " "found " "in " "other " "buffer " "(folds " "entered ") "! ) ) ) ;OCL}}} ;OCL{{{ 10 not found in other buffer ( =(tags-error 10) ( message ( "position " "not " "found " "in " "other " "buffer! ) ) ) ;OCL}}} ;OCL{{{ 11 using your tags file first ( =(tags-error 11) ( message ( "using " "your " "tags " "file " history tags-file " "first! ) ) ) ;OCL}}} ;OCL{{{ 12 using default tags files ( =(tags-error 12) ( message ( "using " "default " "tags " "files! ) ) ) ;OCL}}} ;OCL{{{ 13 no regexp ( =(tags-error 13) ( message ( "Sorry, " "no " "regular " "expressions! ) ) ) ;OCL}}} default ( message ( M_FAILED ) ) esac ) ) ;OCL}}} ( deffun tags-complain ( if tags-error ( tags-error-message load-function not(tags-error-message) ) else ( message () ) fi ) ) @fi ;OCL}}} ;OCL{{{ go-tag-mark @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) ( forward quit-unchanged-to-other-buffer ) ( deffun (adjacent unique extend) go-tag-mark ( if not(tags-error) ;OCL{{{ try search ( ;OCL{{{ get size for tags-buffer set tags-height div(screen-height 2) set tags-width div(screen-width 2) ;OCL}}} ;OCL{{{ move tag to tags-history, cut tag and check absolut filename screen-off history-edit tags-history () get-history search 0 newline-and-indent screen-on ;OCL}}} open-tags-file(false) if not(tags-error) ;OCL{{{ try to reach position ( tags-basic-magic if not(tags-error) ( ;OCL{{{ search item in tags file if last-message M_FAILED () fi beginning-of-fold search-forward get-history tags-history 1 pretty-basic-regexp(true) beginning-of-line "^ end-of-line if extend ( ".* ) fi file-and-tag-expression newline-and-indent if last-message M_FAILED ( set tags-error 4 ) fi ;OCL}}} if not(tags-error) ( ;OCL{{{ move tag line to tags-history history-edit-line tags-history () cut-first-tag-entry beginning-of-line set tags-absolut @if-using (ROOT-TEST) eval ( root-test ) @fi @if-using not(ROOT-TEST) counter or(test-char "~ test-char path-separator) @fi newline-and-indent ;OCL}}} ;OCL{{{ open buffer for the file if last-message M_CANTOPEN () fi goto-buffer-id tags-old-buffer if adjacent ( open-adjacent-buffer ) else ( open-buffer ) fi ;OCL{{{ get filename if not(tags-absolut) ;OCL{{{ append path from tags file ( previous-line end-of-line while and ( not(test-char path-separator) not(test-begin-line) ) ( backward-character ) if test-char path-separator ( forward-character ) fi delete-to-end-of-line ) ;OCL}}} fi get-history tags-history 0 beginning-of-line while not(test-char-set space) ( forward-character ) delete-to-end-of-line ;OCL}}} newline-and-indent ;OCL}}} if last-message M_CANTOPEN ;OCL{{{ error ( set tags-error 5 exit-buffer ) ;OCL}}} else ;OCL{{{ search for tag ( history-edit tags-history () previous-line cut-first-tag-entry beginning-of-line if test-char-set digit ;OCL{{{ ok, goto line ( newline-and-indent goto-line get-history tags-history 0 newline-and-indent set tags-old-buffer current-buffer-id ) ;OCL}}} else ;OCL{{{ search ( set tags-reg-type add-mode-basic-regular-expression case ;OCL{{{ E -> ext regexp literally ( test-char "E ( set tags-reg-type add-mode-extended-regular-expression forward-character delete-previous-character ) ) ;OCL}}} ;OCL{{{ B -> basic regexp literally ( test-char "B ( forward-character delete-previous-character ) ) ;OCL}}} default ;OCL{{{ [^]text with quoted \[$] ( ;OCL{{{ cut /[^] and store adding ^ forward-character delete-previous-character set tags-add-start false if test-char "^ ( set tags-add-start true forward-character delete-previous-character ) fi ;OCL}}} ;OCL{{{ cut [$]/ and store adding $ end-of-line delete-previous-character backward-character set tags-add-end false if test-char "$ ( set tags-add-end 1 forward-character delete-previous-character ) fi ;OCL}}} pretty-basic-regexp(false) ;OCL{{{ maybe add ^ if tags-add-start ( beginning-of-line "^ ) fi ;OCL}}} ;OCL{{{ maybe add $ if tags-add-end ( end-of-line "$ ) fi ;OCL}}} ) ;OCL}}} esac newline-and-indent beginning-of-fold insert-ascii tags-reg-type if last-message M_FAILED () fi if last-message M_REG_EXP () fi search-forward get-history tags-history 0 newline-and-indent if last-message M_REG_EXP ;OCL{{{ end search and error ( beginning-of-line delete-to-end-of-line newline-and-indent set tags-error 6 ) ;OCL}}} else ( if last-message M_FAILED ;OCL{{{ exit buffer and error ( set tags-error 6 exit-buffer ) ;OCL}}} else ;OCL{{{ new buffer is the target! ( set tags-old-buffer current-buffer-id ) ;OCL}}} fi ) fi add-mode-basic-regular-expression ) ;OCL}}} fi ) ;OCL}}} fi ) fi ) fi close-tags-file tags-restore-magic ) ;OCL}}} fi if =(tags-error 0) ;OCL{{{ show buffer, maybe warn multi edit ( screen-off while <(screen-height tags-height) ( grow-buffer ) while <(screen-width tags-width) ( widen-buffer ) if >(multi-edit 1) ( set tags-error 1 ) fi screen-on redraw-display ) ;OCL}}} fi if and(unique <(tags-error 2) >(multi-edit 1)) ( quit-unchanged-to-other-buffer pop-buffer-layout ) fi screen-on redraw-display ) ;OCL}}} fi tags-complain ) ) @fi ;OCL}}} ;OCL{{{ find-tag-under-cursor @if-using ( F-O-T-BUFF F-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF T-COMP ) ( deffun find-tag-under-cursor ( set tags-extended-set counter test-language None screen-off history-edit-line search () if or ( test-char-set c-tags-word-set and ( tags-extended-set test-char-set c-tags-x-word-set ) ) ;OCL{{{ try to extend word under the cursor ( while and ( or ( test-char-set c-tags-word-set and ( tags-extended-set test-char-set c-tags-x-word-set ) ) not(test-begin-line) ) ( backward-character ) if not ( or ( test-char-set c-tags-word-set and ( tags-extended-set test-char-set c-tags-x-word-set ) ) ) ( forward-character ) fi if not(test-char-set c-tags-start-word-set) ( set tags-error 2 ) else ( ;OCL{{{ cut leading stuff while not(test-begin-line) ( delete-previous-character ) ;OCL}}} ;OCL{{{ skip to end of word while or ( test-char-set c-tags-word-set and ( tags-extended-set test-char-set c-tags-x-word-set ) ) ( forward-character ) ;OCL}}} ;OCL{{{ delete trailing stuff delete-to-end-of-line ;OCL}}} ) fi ) ;OCL}}} else ( set tags-error 2 ) fi newline-and-indent screen-on ) ) @fi ;OCL}}} ;OCL{{{ prompt-for-tag @if-using ( E-O-T-BUFF E-O-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) ( deffun prompt-for-tag ( set tags-extend false history-edit search "tag do ( begin-prompt-macro prompt-char-counter tags-op () end-prompt-macro if =(tags-op filename-completion) ( set tags-extend true set tags-op newline-and-indent ) fi if =(tags-op newline-and-indent) ( end-of-line if test-begin-line ( set tags-error 2 ) fi ) fi insert-ascii tags-op ) while <>(tags-op newline-and-indent) ) ) @fi ;OCL}}} ;OCL}}} ;OCL{{{ quit-unchanged-to-other-buffer ;OCL{{{ reference @if-using ( FUN-REFERENCE ) ; 2 ; quit-unchanged-ref find-go-ref find-ago-ref enter-go-ref enter-ago-ref fe-go-ref fe-ago-ref go-tag-mark-ref ;OCL{{{ quit-unchanged-to-other-buffer If the current buffer contains a unchanged file, also edited in other buffer[s], the macro tries to reach the same position in the other buffer. Searching with a regular expression for the current line does not exit entered folds! ;OCL}}} @fi ;OCL}}} @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF Q-U-G-T-BUFF ) ( deffun quit-unchanged-to-other-buffer ( if in-prompt ( return-from-macro ) fi set tags-error 0 case ( =(multi-edit 1) ( set tags-error 7 ) ) ( test-file-changed ( set tags-error 8 ) ) default ;OCL{{{ search ( ;OCL{{{ screen off screen-off push-buffer-layout ;OCL}}} ;OCL{{{ store current buffer data ;OCL{{{ do regexp for current line in tags-history history-edit-line tags-history () pretty-basic-regexp(true) beginning-of-line "^ end-of-line "$ newline-and-indent ;OCL}}} set tags-old-buffer current-buffer-id set tags-fileno file-number ;OCL}}} ;OCL{{{ destination=current set tags-dummy-buffer current-buffer-id ;OCL}}} tags-basic-magic ;OCL{{{ search, if found, change tags-dummy-buffer to id local () ( goto-buffer-number 1 repeat used-buffers ( if ;OCL{{{ other buffer, but same file and ( =(file-number tags-fileno) <>(tags-old-buffer current-buffer-id) ) ;OCL}}} ;OCL{{{ search for tag in current buffer ( if last-message M_FAILED () fi beginning-of-fold ;OCL{{{ search forward search-forward get-history tags-history 0 newline-and-indent ;OCL}}} if last-message M_FAILED ;OCL{{{ search reverse ( search-reverse previous-line newline-and-indent ) ;OCL}}} fi if not(last-message M_FAILED) ;OCL{{{ buffer found, so store current buffer id, break from loop ( set tags-dummy-buffer current-buffer-id return-from-macro ;break from loop! ) ;OCL}}} fi if and(set-enter not(tags-error)) ( set tags-error 9 ) else ( set tags-error 10 ) fi ) ;OCL}}} fi next-buffer ) ) ;OCL}}} tags-restore-magic goto-buffer-id tags-old-buffer if =(tags-old-buffer tags-dummy-buffer) ;OCL{{{ error ( if not(tags-error) ( set tags-error 10 ) fi ) ;OCL}}} else ;OCL{{{ quit-old-buffer ( exit-buffer goto-buffer-id tags-dummy-buffer ) ;OCL}}} fi ;OCL{{{ screen on pop-buffer-layout screen-on redraw-display ;OCL}}} ) ;OCL}}} esac tags-complain ) ) @fi ;OCL}}} ;OCL{{{ open/enter tags file ;OCL{{{ reference @if-using ( FUN-REFERENCE ) ; 2 ; find-open-ref find-aopen-ref enter-open-ref enter-aopen-ref find-go-ref find-ago-ref enter-go-ref enter-ago-ref fe-open-ref fe-aopen-ref fe-go-ref fe-ago-ref go-tag-mark-ref @if-using ( complete go-tag-mark-ref ) ;OCL{{{ go-tag-mark This is the function, used by all enter/find tags commands. It uses three boolean arguments: @ref-start-item adjacent open buffer adjacent @ref-end-item @ref-start-item unique switch to existing buffer, if possible @ref-end-item @ref-start-item extend is tags given as prefix @ref-end-item It uses the last value in search-history. ;OCL{{{ Tags ;OCL}}} ;OCL{{{ quit-unchanged-to-other-buffer ;OCL}}} ;OCL}}} @fi @if-using ( complete find-open-ref find-aopen-ref enter-open-ref enter-aopen-ref ) ;OCL{{{ open tags buffer @if-using ( find-open-ref ) ;OCL{{{ find-and-open-tags-buffer Open a new buffer, using the word under the cursor as tag. ;OCL{{{ Tags ;OCL}}} ;OCL}}} @fi @if-using ( find-aopen-ref ) ;OCL{{{ find-and-open-tags-adjacent-buffer Open a new adjacent buffer, using the word under the cursor as tag. ;OCL{{{ Tags ;OCL}}} ;OCL}}} @fi @if-using ( enter-open-ref ) ;OCL{{{ enter-and-open-tags-buffer Open a new buffer for a tag, the macros prompt for. Using filename-completion will end the input and searches the first tag, beginning with the given string! ;OCL{{{ Tags ;OCL}}} enter-and-open-tags-buffer calls the hooks begin-prompt-macro and end-prompt-macro, so they have to be defined here, if you need them! ;OCL}}} @fi @if-using ( enter-aopen-ref ) ;OCL{{{ enter-and-open-tags-adjacent-buffer Open a new adjacent buffer for a tag, the macros prompt for. Using filename-completion will end the input and searches the first tag, beginning with the given string! ;OCL{{{ Tags ;OCL}}} enter-and-open-tags-adjacent buffer calls the hooks begin-prompt-macro and end-prompt-macro, so they have to be defined here, if you need them! ;OCL}}} @fi ;OCL}}} @fi @if-using ( complete find-go-ref find-ago-ref enter-go-ref enter-ago-ref ) ;OCL{{{ go tags buffer @if-using ( find-go-ref ) ;OCL{{{ find-and-go-tags-buffer Open a new buffer, using the word under the cursor as tag. Tries quit-unchanged-to-other-buffer-ref to reduce the number of buffers. ;OCL{{{ Tags ;OCL}}} ;OCL{{{ quit-unchanged-to-other-buffer ;OCL}}} ;OCL}}} @fi @if-using ( find-ago-ref ) ;OCL{{{ find-and-go-tags-adjacent-buffer Open a new adjacent buffer, using the word under the cursor as tag. Tries quit-unchanged-to-other-buffer-ref to reduce the number of buffers. ;OCL{{{ Tags ;OCL}}} ;OCL{{{ quit-unchanged-to-other-buffer ;OCL}}} ;OCL}}} @fi @if-using ( enter-go-ref ) ;OCL{{{ enter-and-go-tags-buffer Open a new buffer for a tag, the macros prompt for. Using filename-completion will end the input and searches the first tag, beginning with the given string! Tries quit-unchanged-to-other-buffer-ref to reduce the number of buffers. ;OCL{{{ Tags ;OCL}}} ;OCL{{{ quit-unchanged-to-other-buffer ;OCL}}} enter-and-go-tags-buffer calls the hooks begin-prompt-macro and end-prompt-macro, so they have to be defined here, if you need them! ;OCL}}} @fi @if-using ( enter-ago-ref ) ;OCL{{{ enter-and-go-tags-adjacent-buffer Open a new buffer for a tag, the macros prompt for. Using filename-completion will end the input and searches the first tag, beginning with the given string! Tries quit-unchanged-to-other-buffer-ref to reduce the number of buffers. ;OCL{{{ Tags ;OCL}}} ;OCL{{{ quit-unchanged-to-other-buffer ;OCL}}} enter-and-go-tags-adjacent-buffer calls the hooks begin-prompt-macro and end-prompt-macro, so they have to be defined here, if you need them! ;OCL}}} @fi ;OCL}}} @fi @if-using ( complete fe-open-ref fe-aopen-ref fe-go-ref fe-ago-ref) ;OCL{{{ find or enter tags buffer @if-using ( fe-open-ref ) ;OCL{{{ find-or-enter-and-open-tags-buffer Open a new buffer for a tag, using the word under the cursor. If failling, the macros prompts for a tag. Using filename-completion will end the input and searches the first tag, beginning with the given string! ;OCL{{{ Tags ;OCL}}} find-or-enter-and-open-tags-buffer calls the hooks begin-prompt-macro and end-prompt-macro, so they have to be defined here, if you need them! ;OCL}}} @fi @if-using ( fe-aopen-ref ) ;OCL{{{ find-or-enter-and-open-tags-adjacent-buffer Open a new adjacent buffer for a tag, using the word under the cursor. If failling, the macros prompts for a tag. Using filename-completion will end the input and searches the first tag, beginning with the given string! ;OCL{{{ Tags ;OCL}}} find-or-enter-and-open-tags-adjacent-buffer calls the hooks begin-prompt-macro and end-prompt-macro, so they have to be defined here, if you need them! ;OCL}}} @fi @if-using ( fe-go-ref ) ;OCL{{{ find-or-enter-and-go-tags-buffer Open a new buffer for a tag, using the word under the cursor. If failling, the macros prompts for a tag. Using filename-completion will end the input and searches the first tag, beginning with the given string! Tries quit-unchanged-to-other-buffer-ref to reduce the number of buffers. ;OCL{{{ Tags ;OCL}}} ;OCL{{{ quit-unchanged-to-other-buffer ;OCL}}} find-or-enter-and-go-tags-buffer calls the hooks begin-prompt-macro and end-prompt-macro, so they have to be defined here, if you need them! ;OCL}}} @fi @if-using ( fe-ago-ref ) ;OCL{{{ find-or-enter-and-go-tags-adjacent-buffer Open a new adjacent buffer for a tag, using the word under the cursor. If failling, the macros prompts for a tag. Using filename-completion will end the input and searches the first tag, beginning with the given string! Tries quit-unchanged-to-other-buffer-ref to reduce the number of buffers. ;OCL{{{ Tags ;OCL}}} ;OCL{{{ quit-unchanged-to-other-buffer ;OCL}}} find-or-enter-and-go-tags-adjacent-buffer calls the hooks begin-prompt-macro and end-prompt-macro, so they have to be defined here, if you need them! ;OCL}}} @fi ;OCL}}} @fi @fi ;OCL}}} ;OCL{{{ find-tags ;OCL{{{ find-open-tag @if-using ( F-O-T-BUFF F-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) ( deffun (adjacent unique) find-open-tag ( if in-prompt ( return-from-macro ) fi set tags-error 0 find-tag-under-cursor go-tag-mark(adjacent unique false) ) ) @fi ;OCL}}} ;OCL{{{ find-and-open-tags-buffer @if-using ( F-O-T-BUFF ) ( deffun find-and-open-tags-buffer ( find-open-tag(false false) ) ) @fi ;OCL}}} ;OCL{{{ find-and-open-tags-adjacent-buffer @if-using ( F-O-T-ABUFF ) ( deffun find-and-open-tags-adjacent-buffer ( find-open-tag(true false) ) ) @fi ;OCL}}} ;OCL{{{ find-and-go-tags-buffer @if-using ( F-G-T-BUFF ) ( deffun find-and-go-tags-buffer ( find-open-tag(false true) ) ) @fi ;OCL}}} ;OCL{{{ find-and-go-tags-adjacent-buffer @if-using ( F-G-T-ABUFF ) ( deffun find-and-go-tags-adjacent-buffer ( find-open-tag(true true) ) ) @fi ;OCL}}} ;OCL}}} ;OCL{{{ enter-tags ;OCL{{{ enter-open-tag @if-using ( E-O-T-BUFF E-O-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) ( deffun (adjacent unique) enter-open-tag ( if in-prompt ( return-from-macro ) fi set tags-error 0 prompt-for-tag go-tag-mark(adjacent unique tags-extend) ) ) @fi ;OCL}}} ;OCL{{{ enter-and-open-tags-buffer @if-using ( E-O-T-BUFF ) ( deffun enter-and-open-tags-buffer ( enter-open-tag(false false) ) ) @fi ;OCL}}} ;OCL{{{ enter-and-open-tags-adjacent-buffer @if-using ( E-O-T-ABUFF ) ( deffun enter-and-open-tags-adjacent-buffer ( enter-open-tag(true false) ) ) @fi ;OCL}}} ;OCL{{{ enter-and-go-tags-buffer @if-using ( E-G-T-BUFF ) ( deffun enter-and-go-tags-buffer ( enter-open-tag(false true) ) ) @fi ;OCL}}} ;OCL{{{ enter-and-go-tags-adjacent-buffer @if-using ( E-G-T-ABUFF) ( deffun enter-and-go-tags-adjacent-buffer ( enter-open-tag(true true) ) ) @fi ;OCL}}} ;OCL}}} ;OCL{{{ find-or-enter-tags ;OCL{{{ find-or-enter-open-tag @if-using ( FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) ( deffun (adjacent unique) find-or-enter-open-tag ( if in-prompt ( return-from-macro ) fi find-open-tag(adjacent unique) if or(=(tags-error 2) =(tags-error 4) =(tags-error 6)) ( enter-open-tag(adjacent unique) ) fi tags-complain ) ) @fi ;OCL}}} ;OCL{{{ find-or-enter-and-open-tags-buffer @if-using ( FE-O-T-BUFF ) ( deffun find-or-enter-and-open-tags-buffer ( find-or-enter-open-tag(false false) ) ) @fi ;OCL}}} ;OCL{{{ find-or-enter-and-open-tags-adjacent-buffer @if-using ( FE-O-T-ABUFF ) ( deffun find-or-enter-and-open-tags-adjacent-buffer ( find-or-enter-open-tag(true false) ) ) @fi ;OCL}}} ;OCL{{{ find-or-enter-and-go-tags-buffer @if-using ( FE-G-T-BUFF ) ( deffun find-or-enter-and-go-tags-buffer ( find-or-enter-open-tag(false true) ) ) @fi ;OCL}}} ;OCL{{{ find-or-enter-and-go-tags-adjacent-buffer @if-using ( FE-G-T-ABUFF ) ( deffun find-or-enter-and-go-tags-adjacent-buffer ( find-or-enter-open-tag(true true) ) ) @fi ;OCL}}} ;OCL}}} ;OCL}}} ;OCL{{{ tags file actions ;OCL{{{ reference @if-using ( FUN-REFERENCE ) ; 2 ; set-tf-ref in-tf-ref o-tf-ref ao-tf-ref @if-using ( complete set-tf-ref in-tf-ref o-tf-ref ao-tf-ref ) ;OCL{{{ handling tags file @if-using ( set-tf-ref ) ;OCL{{{ set-user-tag Don't use the default tags-file, but define your own. You can control the first tags file by other funtions, setting the history tags-file to the correct filename. This history will be used, if OCL variable tags-user-tags-file is not set to false=0! ;OCL}}} @fi @if-using ( in-tf-ref ) ;OCL{{{ insert-tags-file Like insert-file, but does not prompt for a filename. ;OCL}}} @fi @if-using ( o-tf-ref ) ;OCL{{{ open-buffer-tags-file Like open-buffer, but does not prompt for a filename. If no tags file can be reached, the command will be ignored. ;OCL}}} @fi @if-using ( ao-tf-ref ) ;OCL{{{ open-adjacent-buffer-tags-file Like open-adjacent-buffer, but does not prompt for a filename. If no tags file can be reached, the command will be ignored. ;OCL}}} @fi ;OCL}}} @fi @fi ;OCL}}} ;OCL{{{ set-user-tags-file @if-using ( S-U-T-FILE ) ( deffun set-user-tags-file ( if in-prompt ( return-from-macro ) fi set tags-user-tags-file false set tags-error 11 history-edit tags-file "tags-file do ( begin-prompt-macro prompt-char-counter tags-op () end-prompt-macro if =(tags-op newline-and-indent) ( end-of-line if test-begin-line ( set tags-error 12 ) else ( set tags-user-tags-file true ) fi ) fi insert-ascii tags-op ) while <>(tags-op newline-and-indent) tags-complain ) ) @fi ;OCL}}} ;OCL{{{ tags-file-macs ;OCL{{{ tags-file-action @if-using ( I-T-FILE O-T-FILE O-T-AFILE O-T-FILE O-T-AFILE ) ( deffun ( op new ) tags-file-action ( if in-prompt ( return-from-macro ) fi set tags-error 0 open-tags-file(true) close-tags-file if tags-error ;OCL{{{ maybe use default ( if new ;OCL{{{ use tags ( history-edit file () "tags newline-and-indent ) ;OCL}}} else ;OCL{{{ error ( tags-complain return-from-macro ) ;OCL}}} fi ) ;OCL}}} fi insert-ascii op if in-prompt ( get-history file 0 newline-and-indent ) fi message ( "using " "tags-file: " history file ) ) ) @fi ;OCL}}} ;OCL{{{ insert-tags-file @if-using ( I-T-FILE ) ( deffun insert-tags-file ( tags-file-action(insert-file false) ) ) @fi ;OCL}}} ;OCL{{{ open-buffer-tags-file @if-using ( O-T-FILE O-T-AFILE ) ( deffun open-buffer-tags-file ( tags-file-action(open-buffer true) ) ) @fi ;OCL}}} ;OCL{{{ open-adjacent-buffer-tags-file @if-using ( O-T-AFILE ) ( deffun open-adjacent-buffer-tags-file ( tags-file-action(open-adjacent-buffer true) ) ) @fi ;OCL}}} ;OCL}}} ;OCL}}} ;OCL{{{ search-next-incorrect-tag-entry ;OCL{{{ reference @if-using ( FUN-REFERENCE ) 2 ; find-it-ref ;OCL{{{ search-next-incorrect-tag-entry Search for the next line, which cannot ne used as a tag entry for jumping. ;OCL}}} @fi ;OCL}}} @if-using ( S-N-I-T ) ( deffun search-next-incorrect-tag-entry ( if in-prompt ( return-from-macro ) fi set tags-error 0 tags-basic-magic if not(tags-error) ( if last-message M_FAILED () fi message "Searching search-forward screen-off "\!^ NO_SPACE file-and-tag-expression screen-on newline-and-indent if last-message M_FAILED ( set tags-error -1 ) fi ) fi tags-restore-magic tags-complain ) ) @fi ;OCL}}} ;OCL{{{ tag-completion ;OCL{{{ reference @if-using ( FUN-REFERENCE ) ; 2 ; tag-completion ;OCL{{{ tag-completion Similar to origamis filename-completion. This function looks only at the tag names. You may add your own symbols for completion. These entries may be lines containing only the completion string! This function can not be used inside prompts! ;OCL}}} @fi ;OCL}}} @if-using ( T-COMP ) ( deffun tag-completion ( if in-prompt ( return-from-macro ) fi set tags-extended-set counter test-language None set tags-error 2 if test-char-set space ;OCL{{{ handle word left from cursor as tag start ( backward-character if or ( test-char-set c-tags-word-set and ( tags-extended-set test-char-set c-tags-x-word-set ) ) ( set tags-error 0 find-tag-under-cursor if not(tags-error) ;OCL{{{ search for completion ( open-tags-file(false) if not(tags-error) ( ;OCL{{{ move tag to tags-history history-edit tags-history () get-history search 0 newline-and-indent ;OCL}}} tags-basic-magic ;OCL{{{ search tagstart at beginning of line beginning-of-fold if last-message M_FAILED () fi search-forward get-history tags-history 0 beginning-of-line "^ newline-and-indent ;OCL}}} if last-message M_FAILED ( set tags-error 2 ) else ;OCL{{{ set tags-history to full completion ( set tags-absolut true ;OCL{{{ cut at space from current line. use as first completion history-edit-line tags-history () beginning-of-line while or ( test-char-set c-tags-word-set and ( tags-extended-set test-char-set c-tags-x-word-set ) ) ( forward-character ) delete-to-end-of-line newline-and-indent ;OCL}}} local () ( while true ( ;OCL{{{ search next completion end-of-line search-forward previous-line newline-and-indent ;OCL}}} if last-message M_FAILED ( return-from-macro ) fi set tags-absolut false ;OCL{{{ get completion history-edit-line tags-history () newline-and-indent history-edit tags-history () previous-line local () ( set tags-width 0 while true ( ;OCL{{{ store in tags-height character from old previous-line beginning-of-line set tags-op tags-width while tags-op ( forward-character set tags-op -(tags-op 1) ) set tags-height store-character next-line ;OCL}}} ;OCL{{{ check corresponding char of current beginning-of-line set tags-op tags-width while tags-op ( forward-character set tags-op -(tags-op 1) ) if test-char tags-height ( set tags-width +(tags-width 1) ) else ( return-from-macro ) fi ;OCL}}} ) ) delete-to-end-of-line newline-and-indent ;OCL}}} ) ) ) ;OCL}}} fi tags-restore-magic close-tags-file ) fi ) ;OCL}}} fi ) fi forward-character if not(tags-error) ;OCL{{{ insert completion ( ;OCL{{{ get completion, ocl-argument is set to length screen-off history-edit tags-history () ;OCL{{{ get length of old set tags-width -1 get-history search 0 beginning-of-line while not(test-end-line) ( forward-character set tags-width +(tags-width 1) ) ;OCL}}} ;OCL{{{ cut common previous-line beginning-of-line while tags-width ( forward-character delete-previous-character set tags-width -(tags-width 1) ) set ocl-argument 0 while not(test-end-line) ( forward-character set ocl-argument +(ocl-argument 1) ) ;OCL}}} screen-on newline-and-indent ;OCL}}} if ocl-argument ( get-history tags-history 0 ) else ( set tags-absolut false ) fi if and(not(tags-absolut) test-verbose) ( bell visible-bell ) fi ) ;OCL}}} fi ) ;OCL}}} fi if tags-error ( tags-complain set ocl-argument 0 ) fi ) ) @fi ;OCL}}} ;OCL{{{ abort-hook-add @if-using not(ABORT-HOOK-ADD) @use (ABORT-HOOK-ADD) ( defmac abort-hook-add ( ) ) @fi @if-using ( F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE T-COMP ) ( defmac abort-hook-add-saved ( abort-hook-add ) ) ( undeclare ( abort-hook-add ) ) ( defmac abort-hook-add ( tags-restore-magic if tags-hidden-buffer ( goto-buffer-id tags-hidden-buffer if =(tags-hidden-buffer current-buffer-id) ( set-file-unchanged set tags-hidden-buffer 0 exit-buffer ) fi ) fi abort-hook-add-saved ) ) ( undeclare ( abort-hook-add-saved ) ) @fi ;OCL}}} ;OCL{{{ reference hooks @if-using ( FUN-REFERENCE ) ; 3 ; The libary defines a macro `abort-hook-add' and a OCL tag ABORT-HOOK-ADD. This macro should be added to your abort-macro! If needed, an existing macro `abort-hook-add' will be integrated! The function `set-user-tags-file' can be simulated, by changing the value of history `tags-file' and setting variable `tags-user-tags-file' to non-zero. If `tags-user-tags-file' is zero, the default list is used. @fi ;OCL}}} ;OCL{{{ undeclares ( undeclare ( @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-U-T-FILE I-T-FILE O-T-FILE O-T-AFILE S-N-I-T T-COMP ) tags-error-message @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-N-I-T ) file-and-tag-expression @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-N-I-T T-COMP I-T-FILE O-T-FILE O-T-AFILE ) tags-restore-magic @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-N-I-T T-COMP ) tags-basic-magic @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE T-COMP ) open-tags-file @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) pretty-basic-regexp @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) cut-first-tag-entry @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE T-COMP ) close-tags-file @fi @if-using ( F-O-T-BUFF F-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF T-COMP ) find-tag-under-cursor @fi @if-using ( F-O-T-BUFF F-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF ) find-open-tag @fi @if-using ( E-O-T-BUFF E-O-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) prompt-for-tag @fi @if-using ( E-O-T-BUFF E-O-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) enter-open-tag @fi @if-using ( FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) find-or-enter-open-tag @fi @if-using ( I-T-FILE O-T-FILE O-T-AFILE ) tags-file-action @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE T-COMP ) tags-hidden-buffer @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) tags-reg-type tags-add-start tags-add-end @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF T-COMP ) tags-absolut @fi @if-using ( E-O-T-BUFF E-O-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF ) tags-extend @fi @if-using ( E-O-T-BUFF E-O-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-U-T-FILE T-COMP ) tags-op @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF T-COMP ) tags-width tags-height @fi @if-using ( F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-U-T-FILE I-T-FILE O-T-FILE O-T-AFILE S-N-I-T T-COMP ) tags-extended-set @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF Q-U-G-T-BUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE ) tags-fileno @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE T-COMP ) tags-dummy-buffer @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF I-T-FILE O-T-FILE O-T-AFILE T-COMP ) tags-old-buffer @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-N-I-T T-COMP I-T-FILE O-T-FILE O-T_AFILE) tags-old-regexp-mode @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-N-I-T ) RE1 RE2 OR SPACE NO_SPACE B_SL @fi @if-using ( GO-TAG-MARK F-O-T-BUFF F-O-T-ABUFF E-O-T-BUFF E-O-T-ABUFF Q-U-G-T-BUFF F-G-T-BUFF F-G-T-ABUFF E-G-T-BUFF E-G-T-ABUFF FE-O-T-BUFF FE-O-T-ABUFF FE-G-T-BUFF FE-G-T-ABUFF S-N-I-T ) SPACE-SET @fi ) ) ;OCL}}} ) ) @fi