On Mar 5, 2005, at 5:38 AM, Tom Lazar wrote:
> /Volumes/Data/Applications/TextMate.app/Contents/SharedSupport/
> Bundles/Subversion.tmbundle/Tools/format_status.rb:49: undefined
> method `[]' for nil (NameError)
This is an old thinko on my part, now fixed (thanks for catching it!).
Please svn update to the latest format_status.rb and give it another
shot.
Chris
Hi,
I made a script that opens the source of the frontmost Safari document
in TextMate, with syntax-coloring.
I used a similar one for BBEdit a long time ago. (or was it only 5
months? ;)
With Applescript, it always look quite easy when you start, then you
end up spending hours to get it to work properly.
AS is as easy to read as it's hard to write. But it works!
You can see I'm a little AS challenged, so advices are welcome.
Basically, it takes the source and the title of the frontmost Safari
window (warns you if there is none, or if it's blank),
remove "http://" and replace any "/" in the title with ":", makes a
file in /tmp with the title as name (adding ".html" if it's not already
there) and opens it in TM.
Should I put it on the wiki or in the repository?
Hope this can be useful to someone.
--
Fred
Download it here: http://osxgeek.org/tm/Source2TM.zip or copy/paste it
Script Editor.
========================================================================
=
tell application "Safari"
if not (exists document 1) then
display dialog "You need to open a web location first!" buttons
{"OK"} default button 1
return
end if
set mySource to the source of front document as text
if (length of mySource is 0) then
display dialog "You need to open a web location first!" buttons
{"OK"} default button 1
return
end if
set myName to name of front document as text
end tell
try
tell application "TextMate" to activate
set myName to replace_chars(myName, "http://", "")
set myName to replace_chars(myName, "/", ":")
if (myName ends with ".html") or (myName ends with ".htm") then
set myPath to "/tmp/" & myName
else
set myPath to "/tmp/" & myName & ".html"
end if
do shell script "rm -f " & quoted form of myPath
do shell script "echo " & quoted form of mySource & " >> " & quoted
form of myPath
do shell script "open -a TextMate " & quoted form of myPath
end try
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
========================================================================
=
I just got this from Schubert:
I have fixed a bug that could cause it to crash when the
initialization of the PDF document fails in the most recent
version. If you still have documents that cause a crash please
forward them to me.
It was released 2nd of March, so I'd encourage people to update, and if
you experience a crash, send him the PDF causing the problem.
I regularly post code onto blogs and would love to get what I see in
TextMate (highlighting and such) to be represented with HTML. I there
a method in place for doing this?
Thank you,
--==<< R i c h a r d B r o n o s k y >>==--
Hi
I am just trying out TextMate and have been impressed, however
I am a bit confused by the folding. The main problem comes when I click
on the arrow for a fold opening (down arrow), it simply folds to the
next fold closing
(up arrow). If a new fold opening occured in the middle then it
ignores this.
From looking at the lists and so on I think this might have something
to do
with indentation, however I am using latex, which it is not natural to
indent.
best wishes
Edmund
------------------------------------------------------------------------
------------
Problems worthy
Edmund Harriss
of attack Queen Mary, University of
London
prove their worth edmund.harriss(a)mathematicians.org.uk
by hitting back. http://www.mathematicians.org.uk/eoh
Piet Hein 1905-1996
------------------------------------------------------------------------
------------
There has been some talk here and on the bundle dev list about
character sets and entities in HTML documents. Here is some information
that might be useful.
First of all, there is no need to use entities in HTML documents for
such things as é è ê ë etc., as it only makes them harder to read, to
edit and to parse. When using utf-8, the entire utf-8 range CAN be used
directly. As far as I know, the only entities needed are:
& > <
In order to not confuse the parser. No, all this only works if the
document is sent by the server as UTF-8. Someone wrote on the dev-list
that he makes sure this is the case by putting a meta-tag in the
document (using http-equiv).
Unfortunately, most popular web-servers (well, at least Apache ;-))
doesn't look at the document to see if you included such a tag, and
will always add a char-set header to the HTTP response. This defaults
to iso-8859-1 and _overrides_ the one specified in the document
meta-tag. Maybe this is not in line with the standard, but it is
nevertheless what happens in practice.
So we need to make the server send the content as utf-8 instead. With
Apache we have several alternatives:
1) Enable MultiViews using (in .htaccess) Options +MultiViews and
rename the document to name.html.utf8 or name.php.utf8 etc. MultiViews
also allow for content-type and language negotiation so you can refer
to a picture with 'name' and have several versions on disk 'name.jpeg',
'name.png' etc. The same goes for omitting the .php and .html
extensions. Note that some web-servers may be setup to prevent you from
enabling MultiViews like this.
2) Set the default charset for all text/html and text/plain content.
This will of course also include php, ruby and cgi in general. You can
do this by putting: AddDefaultCharset utf-8 in your .htaccess file.
This is probably the easiest way.
3) Set the charset to utf-8 for some file-extensions only. This hardly
seem useful, and could probably be of more use by setting the charset
to something ELSE than utf-8 for certain files, e.g. name.txt or
similar. The syntax is (in the .htaccess file): AddCharset <charset>
<extensions...>, e.g. AddCharset iso-8859-1 .txt .text.
Note that there doesn't seem to be any way to add charsets to specific
mime-types, but only extensions. Of the methods above I recommend 2,
although enabling MultiViews is generally a Good Thing™, in my opinion.
--
Sune :: http://cyanite.org/
"And now there is merely silence, silence,
silence, saying all we did not know."
I've run into a rather annoying bug, seem that if I create a project
by dragging a folder of files onto TextMate, I can't group files, has
anyone else had problem with this?
If I create a project from within TextMate and then add files one at a
time to it, I can group them.
any ideas?
--
--------------------------------------------
saul rosenbaum
www.visualchutzpah.com