In my Ruby script which is called somewhat indirectly, I tried saying
`CocoaDialog blahblah` but it didn't work; evidently the indirectness means
that I'm not inheriting some path trickery from TM. So I changed it to this:
`#{ENV['TM_SUPPORT_PATH']}/bin/CocoaDialog.app/Contents/MacOS/CocoaDialog
blahblah`
That works. But is there a better way? Thx - m.
--
matt neuburg, phd = matt(a)tidbits.com, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
Hi--
This might already be doable in TM, and I just don't know it, but I
thought it might be worth mentioning in case it's new:
- Tear-off tabs. It would be great if, when working on a set of files
in tabs, I could just drag one over to the side, to have it in a new
window. Stacking in tabs works great in most cases, but occasionally,
it's necessary to see two files side-by-side.
- Many others have said this; I'll echo it: Split screen in
horizontal, vertical, and both directions (ala Emacs), both to
navigate the same file or different files in each pane.
- Advance to next tab bindings uses the ` key. Right now, Cmd+Option+-
> is the binding, and Cmd+` advances to next window. It would be
great if the default binding for advance to next tab was Cmd+Option+`
just to clear a few gray cells for other use :)
Just a few thoughts.
Hi,
imagine I have two documents open for Ruby or R. I wrote some scripts
and I know that these scripts are running for a while.
I select one doc and press APPLE+R and I switch to the other one and I
press APPLE+R. Fine. I see two HTML output windows working.
But just in the moment I switched to the second doc to execute it, the
first script finished its job. Thus my script from the second doc will
be shown in the same HTML window for the first document. And I had no
chance to read the result or error message.
How can I get rid of it. I thought maybe by naming the HTML windows
differently. But what will be the best way? Add a the starting time or
the name of my doc window?
But this leads to the problem that I want to have one HTML window for
one script. I do not want several HTML windows hanging around, I do
not know which belongs to which.
Is that possible in some way?
Many thanks in advance,
--Hans
hi all,
I found the "Hyperlink helper bundle" a very useful tool for creating
wikipedia and other links.
For some time now, however, running "Lookup Word / Selection on
Wikipedia and link" has lead to this error:
env: ruby\rrequire: No such file or directory
Has this function been rolled into another bundle or support dropped?
thanks for your help,
tim
FYI, the code is
#!/usr/bin/env ruby
require "#{ENV['TM_SUPPORT_PATH']}/lib/progress.rb"
require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes.rb"
require "#{ENV['TM_SUPPORT_PATH']}/lib/ui.rb"
require "#{ENV['TM_SUPPORT_PATH']}/lib/escape"
require 'cgi'
require 'open-uri'
require 'erb'
def cap_all_words(string)
return string.split(" ").map{|w| w.capitalize}.join(" ")
end
def follow_redirect(page)
pagename = page.match(/var\swgPageName\s\=\s\"(.*?)
\";/).to_a[1].gsub(/\\'/,'%27')
url = %{http://en.wikipedia.org/wiki/#{pagename}}
content = open(url).read
return url, content, pagename
end #follow_redirect
def select_link(links)
linklist = links.map { |p| p[0] }
item = TextMate::UI.request_item :title => "Multiple
Definitions", :prompt => "Please select a definition", :items =>
linklist
TextMate.exit_discard if item.nil?
return links[linklist.index(item)]
end # select_link
def check_for_search(page)
TextMate.exit_show_tool_tip "No definition found" if page.match(/
<title>([^<>]*)<\/title>/i).to_a[1].include? "Search"
return page
end # check_for_search
def check_for_multiple_results(page,phrase,pagename)
if page.match(/(<\/b>\scan\sbe:<\/p>)|(<\/b>\smay\srefer\sto:<\/p>)/
i) then
open("http://en.wikipedia.org/wiki/Special:Export/#{pagename}") {|
body|
links = []
body.read.scan(/\[\[([^|\]]*)[|]?[^\]]*\]\]/) { |link|
links.push(link) }
choice = select_link(links)
TextMate.exit_discard if choice.nil?
TextMate.exit_replace_text(%{<a href="http://en.wikipedia.org/wiki/#
{CGI.escape(choice[0]).gsub('+','_')}" title="Wikipedia Entry:
#{choice[0]}">#{phrase}</a>})
}
end
end #check_for_multiple_results
def check_for_disambiguation(page,phrase,pagename)
# if page.match(/#{phrase}[\s]?\(disambiguation\)/i) then
if page.include? "(disambiguation)"
# findlink = page.match(/\"(\/wiki\/#{pagename}_%28disambiguation
%29)\"/i)
# open("http://en.wikipedia.org#{findlink[1]}") {|body|
open("http://en.wikipedia.org/wiki/Special:Export/#{pagename}_
%28disambiguation%29") {|body|
content = body.read
links = []
content.scan(/\[\[([^|\]]*)[|]?[^\]]*\]\]/) { |link|
links.push(link) }
choice = select_link(links)
TextMate.exit_discard if choice.nil?
TextMate.exit_replace_text(%{<a href="http://en.wikipedia.org/wiki/#
{CGI.escape(choice[0]).gsub('+','_')}" title="Wikipedia Entry:
#{choice[0]}">#{phrase}</a>})
}
end
end #check_for_disambiguation
def getWikiDef(phrase)
TextMate.call_with_progress(:title => "Contacting
Wikipedia", :message => "Looking for definition of #{phrase}") do
escapedUrl = "http://en.wikipedia.org/wiki/Special:Search?
search=#{CGI.escape(phrase).gsub(/\\'/,'%27')}"
@response = open( escapedUrl,
"User-Agent" => "TextMate 1.5.5")
content = @response.read
if content.scan(/Redirected\sfrom/)
url, content, pagename = follow_redirect(content)
# confirmed = TextMate::UI.request_confirmation :button1 =>
"Accept", :button2 => "Cancel", :title => "Redirected to \"#{pagename}
\"", :prompt => "Accept Redirection?"
# TextMate.exit_discard unless confirmed
else
url = @response.base_uri
pagename = phrase
end
check_for_search(content)
check_for_multiple_results(content,phrase,pagename)
check_for_disambiguation(content,phrase,pagename)
title = "Wikipedia Entry: " + pagename.gsub(/_/, ' ')
return url, title, phrase
end
end
url, title, input = getWikiDef(STDIN.read)
print ERB.new(ENV['TM_LINK_FORMAT']).result
Hi,
I experience a problem with keybindings and the LaTeX bundle.
Specifically, the command "Insert Environment Based on Current Word"
does not get activated if I hit the corresponding key sequence (but I
can still activate it from the menu).
Other commands (such as "Insert Command Based on Current Word") work
perfectly, however.
I checked my Mac OS X keyboard preferences, and the corresponding key
sequence does not appear in the keybindings there. Perhaps someone had
this problem before, and can enlighten me about this issue.
Thanks in advance
Nicolas
I don't understand why every time I paste something (from external
programs or even textmate itself) it always indents it of at least one
level.
Is it done on purpose?
Any way to disable this?
Hi,
I'm trying to make RubyAMP (not hosted at macromates.com) work.
I installed rb-appscript using "sudo gem install rb-appscript", but
when I try to run with TextMate and require it in a script, it shows
me an error "LoadError: no such file to load ― appscript".
In irb, I could get "true" to require 'appscript'
irb(main):003:0> require 'rubygems'
=> true
irb(main):004:0> require 'appscript'
=> true
My ruby script is as simple as:
p require('rubygems')
p require('appscript')
and if I run Command-R, it fails to load appscript.
The script
require 'rubygems'
puts Gem.path
returns
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8
/Library/Ruby/Gems/1.8
My ruby version is: ruby 1.8.6 (2007-09-24 patchlevel 111) [i686-
darwin9.2.0]
gem version is 1.1.1
The gem is installed at `/usr/local/lib/ruby/gems/1.8/gems/rb-
appscript-0.5.1`.
I'm running Mac OS X 10.5.2 on an Intel-based MacBook.
Looks like I need to add a gem path to TextMate(?)
Any help would be appreciated.
Takaaki
--
Takaaki Kato
http://samuraicoder.net
Dear community,
I am newly trying out Textmate, which I intend to use primarily with
LaTeX, with the hopes of possibly switching permanently from my
current text editor, TexShop. But I cannot get either the forward or
backward search function of pdfsync to operate with Skim, my
preferred viewer.
I have already done the following:
1) Selected Skim as my viewer in the Textmate preferences.
2) Selected "View in Skim" from the LaTeX preferences in Textmate.
3) Synced (from inside Skim preferences) with Textmate.
4) Put the pdfsync.sty file in \user\texmf\tex\latex
5) Inserted the \usepackage{pdfsync} in my document.
6) Attempted forward search with "shift-command-click" and backward
search with "Show in Viewer (pdfsync)".
Interestingly, the .pdfsync file, which is full of numbers that
describe the document geometry, is created in the current
directory... my understanding is these numbers are what is used to
locate one's position in forward and backward search. But the
functionality is certainly missing.
(Note: I am trying to run all these programs on a PowerPC-based
Powerbook G4.)
Any assistance in resolving this issue would be GREATLY appreciated.
I have scoured the internet and discussion groups in search of an
answer, but I cannot seem to fix this error.
Thanks in advance,
Yaniv
The minimal test case below shows that something in the parsing of the
newenvironment command is throwing off the syntax coloring by the
LaTeX bundle, at least on my system (TM 1.5.7 1464 on Leopard). The
text in the document is incorrectly parsed as being in a math
environment.
\documentclass{article}
\usepackage{amsmath}
\newenvironment{choice}
{\left\lbrace\begin{gathered}}
{\end{gathered}\right\rbrace}
\begin{document}
Text incorrectly parsed as being in a math environment.
\end{document}
-----
Any ideas of how to fix the parsing?
--
Kai von Fintel
fintel(a)gmail.com
If I have a single file open, is there an easy way to create a new
project with an existing file + the current file? I was hoping to
find a menu item, or key combination that will give a file dialog to
select new file(s) that would be added to a new project that includes
the current file.
--
Kevin Horton
Ottawa, Canada