Hi,
I'd link to run a shell command in a bundle and capture the output in
the html window. So I thought scriptmate.rb seems to be a good way to
go, but I am a bit clueless. Running this from the command line gives
me an error.
--------------------------------------------------
#!/usr/bin/env ruby
ENV['TM_SUPPORT_PATH']="/Applications/TextMate.app/Contents/SharedSupport/Support"
$:.unshift ENV['TM_SUPPORT_PATH'] + "/lib"
require 'scriptmate'
cmd_mate("ls")
--------------------------------------------------
nil
/Applications/TextMate.app/Contents/SharedSupport/Support/lib/scriptmate.rb:92:in `waitpid': no implicit conversion from nil to integer (TypeError)
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/scriptmate.rb:92:in `emit_html'
from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/scriptmate.rb:16:in `cmd_mate'
from ./parse_texrun.rb:42
And scriptmate.rb looks a bit strange to me:
....
def emit_html
emit_header()
stdout, stderr, stack_dump, pid = @command.run
....
is trying to get 4 parameters from @command.run, but UserCommand#run
only returns 3. A related question: is it possible to get a pid from
popen3?
Patrick
> Looking at the diff, the b was previously a <, so the intent was to
> convert \< to \b (because of a change in the regexp library), but
> accidentally all <’s where converted to b’s.
>
> I have now reverted this part of r976, better late than never :)
Excellent! My first bug report and fix! Most exciting. Please
forgive my enthusiasm; I only came to programming in a serious way
about a year ago. I was 'inspired' to do so by a custom program my
company rolled out that was so astonishingly awful that I felt that I
had to demonstrate that better could be done. So, a year later, with
20+ newly purchased yet well worn O'Reilly titles on my shelf, it's
nice to be able to start contributing back to projects I like.
In addition, I have found another small problem with the Python
bundle - it has to do with the way it scopes 'meta.item-
access.python' sections.
In particular, it gets confused by the end ], and does not recognize
it as 'punctuation.definition.arguments.end.python', although it
recognizes the lead [ correctly as
'punctuation.definition.arguments.start.python'. For instance, put
the following in TextMate as Python, and note the scopes/coloring of
the []'s.
pairing_name = findNextWord(packet[row])[0]
The regexes responsible are below, along with my explanation of the
problem and proposed fix:
{ name = 'meta.item-access.python';
begin = '(?=[A-Za-z_][A-Za-z0-9_]*(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*\s*\[)';
end = '(\])';
patterns = (
{ begin = '(?=[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*\s*
\[)';
end = '(?=\s*\[)';
patterns = ( { include = '#dotted_name'; } );
},
{ begin = '(\[)';
end = '(?=\])';
beginCaptures = { 1 = { name =
'punctuation.definition.arguments.begin.python'; }; };
endCaptures = { 1 = { name =
'punctuation.definition.arguments.end.python'; }; };
patterns = ( { include = '$base'; } );
contentName = 'meta.item-access.arguments.python';
},
The problem is that the 'meta.item-access.python' begin regex tags a
LOCATION, specifically the location of the beginning of the first
legit Python dotted name followed by a [, thus correctly allowing the
[ itself to be matched within by
'punctuation.definition.arguments.begin.python'. However, the
'meta.item-access.python' end regex tags not the LOCATION of the
end ], but the end ] itself, thus preventing
'punctuation.definition.arguments.end.python' from selecting the
end ] as it should. In addition, the regex for
'punctuation.definition.arguments.end.python', instead of selecting
the end ], selects the LOCATION followed by an end ], which gives it
no characters in its scope!
My proposed fix swaps the two; both the start and end 'meta.item-
access.python' regexes select for LOCATION, and both
'punctuation.definition.arguments.begin.python' and
'punctuation.definition.arguments.end.python' select for the actual
CHARACTERS [ and ]. The code is below, and I have tested that it
properly scopes the Python constructs now.
{ name = 'meta.item-access.python';
begin = '(?=[A-Za-z_][A-Za-z0-9_]*(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*\s*\[)';
end = '(?<=\])';
patterns = (
{ begin = '(?=[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*\s*
\[)';
end = '(?=\s*\[)';
patterns = ( { include = '#dotted_name'; } );
},
{ begin = '(\[)';
end = '(\])';
beginCaptures = { 1 = { name =
'punctuation.definition.arguments.begin.python'; }; };
endCaptures = { 1 = { name =
'punctuation.definition.arguments.end.python'; }; };
patterns = ( { include = '$base'; } );
contentName = 'meta.item-access.arguments.python';
},
);
},
Hope this is helpful - I am (slowly!) looking through the rest of the
Python language definition to see if there are any other glitches I
can spot. Cheers,
Nick
When connecting to a blog over SSL, various blogging commands (e.g., Fetch Post) will include "warning: peer certificate won't be verified in this SSL session" in their output. Net::HTTP generates this warning when its verify_mode hasn't been set. It then defaults to OpenSSL::SSL::VERIFY_NONE. My patch sets it explicitly to avoid the warning.
I don't work with column editing much at all, but I do instinctively
use "select, drag, option key" to copy text. But most of the time my
clicking option gets me into column select mode.
Is there a way to remap the "select column" off of option so it'll
just drag-and-copy for me?
Thanks.
Hi,
Any tips on how to change the format of a line of Ruby based on it's
content?
In particular I was wanting to try deemphasize logging lines (i.e. starting
with "logger.*") by setting the text font to a gray. Any ideas/tips would
be great. Couldn't seem to see when it would be possible to do this in the
bundle manager.
Tks
Greg
TextMate has a syntax element called "Embedded Source", which is used
for things like the lstlisting environment in LaTeX or JavaScript
code embedded in HTML. The default background color for this element
is a light blue, which is almost identical to the light blue used for
selected text. Because of the similarity, I always get confused and
think I've inadvertently selected some embedded source. I'm wondering
why there is such a similarity between these colors. Was it
deliberate (and if so, what was the reason?) or was this an oversight?
Trevor
Hey folks -
I'm trying to get up-and-running with TextMate, which I will be using
primarily for LaTeX-ing, and I'm having some troubles. I've been
using LaTeX installed via MacPorts/DarwinPorts for a few months now,
so I'd prefer to get TM working with that if possible rather than
abandoning it for MacTex (unless there is really and truly a good
reason to do so).
The main problem I'm having is that when I call the "Insert Label/
Citation Based on Current Word" command, TM spits out "The tex
binaries cannot be located!" I assume this means that I have not
properly told TM where to find my LaTeX installation, but I can't
figure out how to do so. I tried creating a PATH environment
variable equal to the output of "echo $PATH" in Terminal, but I don't
think it helped. Sorry... either I'm doing something dumb or I'm
just not unix-y enough to understand what's going on here.
Any suggestions?
Thanks very much!
Best
- Chris MacMinn
Hi - I was looking over the Python language definition, and I came
upon a regex that I don't understand - or, it might be a bug. The
regex is in the FoldingStartMarker:
<key>foldingStartMarker</key>
<string>^\s*(def|class)\s+([.a-zA-Z0-9_ b]+)\s*(\((.*)\))?\s*:|\{\s*
$|\(\s*$|\[\s*$|^\s*"""(?=.)(?!.*""")</string>
The key mysterious part is right in the first character class, which
I believe is designed to pick out the name of the class/def in question:
[.a-zA-Z0-9_ b]+
Okay, I get it up until the ' b' part. Essentially, the name of a
class or def is a series of characters that are in a-z, A-Z, 0-9, or
are '_' or '.' . What's the point of the ' b' part? Was this meant
to be '\b', signifying a word boundary? Or is there some deeper
meaning to space b that I don't understand? Please forgive if this
is not an appropriate place for this question; I am rather new (well,
completely and totally new) to the use of mailing lists.
Brilliant program, btw - it takes time to appreciate it.
Nick
Hi,
Is there a way to highlight all occurances (e.g. in yellow say) of a
particular piece of text? Say a variable name for example?
Ideally also is there a way to, once such a variable is highlighted
through-out the file, you can change it in one place and it automatically
changes it in real time in other places in the file (I know I had this in
Jbuilder).
Tks
Greg