I have written a command to "Reflow comments" in my Stata do files.
The command is as follows:
#!/usr/bin/env bash
sed -E -e 's_^\s*//(.*)_\1_' | # strip leading // and whitespace
from each line
fmt | # reflow comment text
sed -E -e 's_^(.*)_//\1_' # prefix each line with //
Input is set to "Selected Text" or "Scope", and output is set to
"Replace selected text".
If I invoke the command with the cursor in the middle of the following
comment:
// this is a profoundly silly comment that I'm writing just to test
out how to reflow comments
// something strange happens when I select the text rather than simply
execute it within the comment scope
// i wonder what's going on
// maybe i'll write to the mailing list
I get the desired output:
// this is a profoundly silly comment that I'm writing just to test
out how to
// reflow comments something strange happens when I select the text
rather
// than simply execute it within the comment scope i wonder what's
going on
// maybe i'll write to the mailing list
However, if I instead select the entire block of text, I get the
following mangled result:
// this is a profoundly silly comment that I'm writing just to test
out how to
reflow comments // something strange happens when I select the text
rather than
simply execute it within the comment scope // i wonder what's going
on // maybe
i'll write to the mailing list
Can anyone explain what causes the differing behavior?
Thanks!
Michael Manti
statboy3000(a)gmail.com
Trying out the ActionScript 3 bundle, and I get this error when I try
to build using mxmlc:
Loading configuration file: flex-config.xml
/Library/Application Support/TextMate/Bundles/ActionScript 3.tmbundle/
Support/bin/parse_mxmlc_out.rb:31:in `+': can't convert nil into
String (TypeError) from /Library/Application Support/TextMate/Bundles/
ActionScript 3.tmbundle/Support/bin/parse_mxmlc_out.rb:31 from /
Library/Application Support/TextMate/Bundles/ActionScript 3.tmbundle/
Support/bin/parse_mxmlc_out.rb:24:in `each' from /Library/Application
Support/TextMate/Bundles/ActionScript 3.tmbundle/Support/bin/
parse_mxmlc_out.rb:24
I can't figure out what's causing this. Any suggestions?
Hi!
At time I have no Mac as a laptop and therefore I use emacs when I'm
not in front of my iMac. I just found out that emacs has quite a
simple but cool outline-mode and wanted to ask if it is already ported
to TextMate. Does anybody know?
Niels
On Fri Apr 18, Kai von Fintel wrote:
> 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?
Hi Kai -- This isn't exactly the correct fix, but if you go to Bundles-
>Bundle Editor->Edit Languages... and pick the LaTeX->LaTeX syntax
definition, down about 1/3rd of the way down, you'll find the place
where it is looking for these mathy environments:
align|equation|eqnarray
| multline|aligned|alignat
| split|gather|gathered
soon below that, you'll find
end = '(?x)
(?:\s*) # Optional whitespace
If you change the (?:\s*) to (?:.*?) then you can get a sort of
approximation of the correct syntax coloring.
I really don't quite understand why it works, but the idea was
essentially to allow the { that precedes the \end{gathered} to be
ignored (it wouldn't have counted as whitespace). In the original
formulation, TextMate couldn't find the \end{gathered}, and so just
assumes that the environment ends when the document does.
This isn't actually the right solution, but it at least keeps you from
having the entire body of your document math-colored. The symptom of
why this isn't the right solution is that everything following
\begin{gathered} (including the closing brace of the first argument to
\newenvironment, as well as anything from then on until just before
the line containing \end{gathered}) is math colored.
Ideally, the LaTeX bundle would be able to handle \(re)newenvironment
specially, since each of the two arguments to these commands will
almost always contain a lone \begin or \end, and scope of any
mathification should presumably be restricted to the argument itself.
But I haven't got a clue how to approach this the "right" way.
-Paul
Hi.
I've recently moved from emacs to TextMate and am enjoying the shift.
When i first tested it, the Latex bundle option "Typeset & View"
worked fine. However that was short lived, and a week later i now get
"There was a problem reading the preferences file, continuing with
defaults".
I've noticed other people have experienced this before, and the
previous posts on the subject seem to say that this is a problem with
the python plist parser under Tiger, but that Leopard should be fine.
However i'm using 10.5.2 and the latest version of vanilla TextMate
(freshly downloaded), running on a PPC G4. I have also freshly
installed teTex from macports which works fine both in emacs and from
the command line.
Can anyone suggest where to begin?
Thanks.
Hey all! I have been looking around to see if anyone has made a script or bundle
that enables the functionality of MarkupMaker for TextMate.
http://www.accessify.com/tools-and-wizards/developer-tools/markup-maker/def…
In other words: take selected text, indented by spaces, and convert them to divs.
I did a quick search on the mailing-list and saw that people were talking about
this a while back, but I wasn't sure if anyone had figured this out. :) If not,
I may have to build my own script!
Thanks!
R
When I press Control-H in a Ruby document, I don't get documentation on
what's selected; instead, I get an error message like this:
/usr/local/bin/qri:17: undefined method `require_gem' for main:Object
(NoMethodError)
This just recently started happening (perhaps after updating some gems).
'qri' itself may have been updated, as its date is April 23.
What is 'qri'? It seems to be what's broken; if I just say "qri" in the
Terminal I get the same message.
Meanwhile, 'ri' works just fine in the Terminal.
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>
On 1 May 2008, at 12:20, Allan Odgaard wrote:
> On 30 Apr 2008, at 17:37, Juan Falgueras wrote:
>
>> the original command to get man doc from Tcl commands in Tcl mode
>> was broken (at least in my system -with Developer Tools installed)
>> I have simplify it to a simpler and working script borrow from the
>> Shell script mode one:
>
> Is there any reason to actually keep this, instead of just removing
> it and relying on the command from the Shell Script bundle?
>
> I can imagine for Tcl you’d want to provide the manual section, but
> doesn’t seem like your command does that.
Here the reason is that Tcl has its man entries in the "n" volumen and
thereafter you must issue a command like:
man n regexp
- Juan Falgueras
I am looking at an upgrade for someone. All the files are ASP. I
dragged the folder over TextMate and realized that ASP Bundle is not
there.
What nobody on a Mac is editing ASP in TextMate? I don't get it!
;-)
--
Brad Tittle
Senior Systems Analyst
Trainnow.net
206-780-9555