[TxMt] Re: sbenhaim - tm-ctags author - an extension to this bundle

Dave Baldwin dave.baldwin at 3dlabs.com
Thu Jun 17 10:48:50 UTC 2010


Must be one of those truisms - as some as you post some code you find a bug!

The line:
> 		File.open(historyFile, "w") {|f| f.puts history.join("\n")}

should be:

		File.open(historyFile, "w") {|f| f.puts history.join}

Dave.


On 17 Jun 2010, at 10:43, Dave Baldwin wrote:

> Hi,
> 
> I have added a command to allow you to retrace your steps so you can easily get back to where you came from.  You may want to include it.
> 
> The modified goto method and two new methods in tm_ctags.rb are:
> 
>  def historyFile
> 	File.join(ENV['TM_PROJECT_DIRECTORY'] || ENV['TM_CTAGS_EXT_LIB'], ".etag_history")
>  end
> 
>  def goto( hit )
> 	# Record where we are before we jump.
> 	File.open(historyFile, "a") {|f| f.puts ENV['TM_FILEPATH'] + '%%' + ENV['TM_LINE_NUMBER']}
>    TextMate.go_to :file => File.join(hit['f'], hit['path']), :line => hit['line']
>  end
> 
>  def goback
> 	history = File.readlines(historyFile) if File.exists?(historyFile)
> 	goto = history.pop if history
> 	
> 	if goto && goto =~ /(.*)%%(.*)/
> 		File.open(historyFile, "w") {|f| f.puts history.join("\n")}
> 		TextMate.go_to :file => $1, :line => $2 
> 	end
>  end
> 
> 
> and the only change to tmctags.rb is to extend the action case to include a new one:
> when 'goback'
> 	TM_Ctags::goback
>  	exit
> 
> I added a new command to call this function and tied it to ^[
> 
> Dave.
> 
> 
> 
> 
> 
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate




More information about the textmate mailing list