[TxMt] Problem with latex bundle: new environment based on current word
Anand Patil
anand at soe.ucsc.edu
Mon Mar 5 20:16:34 UTC 2007
Hi all, I just downloaded the update to TextMate and my `new environment
based on current word' seems to have been broken: command { gives
/Library/Application
Support/TextMate/Bundles/Latex.tmbundle/Support/lib/config_helper.rb:1:in
/bin/bash: -c: line 1: unexpected EOF while looking for matching `''
/bin/bash: -c: line 4: syntax error: unexpected end of filerequire'
from /tmp/temp_textmate.xBSaAH:4
It worked before. The new command code is:
#!/usr/bin/env ruby
SUPPORT = ENV['TM_BUNDLE_SUPPORT']
require ENV['TM_SUPPORT_PATH'] + '/lib/dialog'
require SUPPORT + '/lib/config_helper.rb'
@plist = Config.load
shortcuts = @plist['environments']
lshortcuts = @plist['labeled_environments']
if ENV['TM_SCOPE'].match('beamer') then
shortcuts.update(@plist['environments_beamer'])
lshortcuts.update(@plist['labeled_environments_beamer'])
end
name = STDIN.read
cmd = nil
if name == "" then
arr = ["custom…",nil] + (shortcuts.keys+lshortcuts.keys).sort
ind = Dialog.menu(arr)
if ind.nil? || ind == 0 then
name = ""
else
name = arr[ind]
end
end
for key in shortcuts.keys do
if shortcuts[key]['triggers'].index(name) then
cmd = key
setting = :no_label
dict = shortcuts
end
end
for key in lshortcuts.keys do
if lshortcuts[key]['triggers'].index(name) then
cmd = key
setting = :label
dict = lshortcuts
end
end
if !cmd.nil? then
print "\\begin{#{cmd}}"
print "\n" if setting == :no_label
print dict[cmd]["content"] || "\t$0"
print "\n\\end{#{cmd}}"
elsif name == ""
print "\\begin{${1:env}}\n\t$0\n\\end{${1:env}}"
else
print "\\begin{#{name}}\n\t$0\n\\end{#{name}}"
end
Thanks,
Anand Patil
More information about the textmate
mailing list