Hi,
Some weeks ago I wrote this ruby script that works inside a TextMate command to build a list of references declared in Latex files and let the user select the reference he wants to insert in the text:
----------------------- #!/usr/bin/env ruby -wKU
SUPPORT = ENV['TM_SUPPORT_PATH'] DIALOG = SUPPORT + '/bin/tm_dialog'
require SUPPORT + '/lib/escape' require SUPPORT + '/lib/plist' require 'pathname' require 'find'
refs = []
Find.find(ENV['TM_PROJECT_DIRECTORY']) do |f| file_name = File.basename(f) if /.(tex)$/ =~ file_name File.open(file_name,"r") do |infile| infile.each_line do |line| if line =~ /.*\label{.*/ line = line.gsub(/.*\label{(.*)}.*/, '\1').chomp refs << { 'title' => line, 'code' => "\ref{#{line}}" } end end end end end abort if refs.empty?
plist = { "menuItems" => refs }.to_plist res = PropertyList::load(`#{e_sh DIALOG} -up #{e_sh plist}`) abort unless res.has_key? "selectedMenuItem"
print %(#{res["selectedMenuItem"]['code']}) -----------------------
Since the last updates (both of TextMate and its bundles), the script does not work anymore.
When I invoke it, it gives me back the following error.
----------------------- tm_dialog: you have updated the tm_dialog tool to v7 but the Dialog plug-in running is still at v4. tm_dialog: either checkout the PlugIns folder from the repository or remove your checkout of the Support folder. tm_dialog: if you did checkout the PlugIns folder, you need to relaunch TextMate to load the new plug-in. /tmp/temp_textmate.ZcyesN:32:in `load': Cannot parse a NULL or zero- length data (PropertyListError) from /tmp/temp_textmate.ZcyesN:32 -----------------------
I'm a TextMate newbe, thus I'm not sure, but from the error message it seems like I need to update the Dialog.tmplugin file. How can I fix this ?
Cheers, Leonardo