Dear All,
Is there anyway to "tie" actions in other applications to actions in
Textmate? For example, I'd like the opening of a new file in Textmate
(by the file menu or input manager) to also initiate my timer program
(through an applescript, probably).
Is this possible?
Thanks,
Zvi Biener
Thanks everybody.
It looks like for the time being I'll just make a bundle command to
start the timer, and have to launch it myself. If you develop
something for this, Cliff, do let me know!
Best,
Zvi
> On May 23, 2007, at 1:57 PM, Brooks Seymore wrote:
>
>> Could this also be done through a Bundle Command, with the new
>> document created and the timer launched by running the command?
>>
>> B.
>
> Yeah, you can trigger a Applescript when you run a bundle command
> or even include run it from the script used when creating a file
> from a template so creating a new file would start the timer, but
> then you wouldn't be able to log time if you were just editing
> existing files.
>
> I haven't had time to look into it for myself, but does anyone else
> know if you can just use launchd to watch a TextMate related file
> for changes, say, the TextMates preferences for example? If the
> file is modified you can assume you're working with TM & then start
> your timer? I know launchd can monitor paths, but I don't know if
> TM alters its prefs file on disk when its running or just when it
> shuts down or what. If so it'd maybe work to use launchd to watch
> the prefs file and run a script. The script could even maybe use
>
> defaults read com.macromates.textmate NSRecentDocumentRecords
>
> to examine what documents were last opened / saved and mess with
> your timer accordingly, though you'd have to translate them from
> alias references (or whatever the heck the prefs file stores) to
> paths somehow. Thats beyond me at the moment.
>
> I'm just tossing out ideas...
>
> - Cliff
> De: Jacob Rus <jacobolus(a)gmail.com>
>
>
> Juan Falgueras wrote:
>
>> ....but, why it doesn't colour when you give it selections? ehmmm
>> I usually need to cut functions, etc...
>> but anyway the Brad Choate solution is much much better than the
>> enscript one. Thanks
>> Is there some trick for make B. Choate script to colour portions
>> of text?
>>
>
> You're going to have to explain what you're having trouble with. I
> have no trouble turning selections to html with that command...
>
Yes. If you select a slice of your source code like...
-------
int main(){
TpNumero numero;
if (LeerCadena(numero)){
cout << "La cadena es correcta: " << numero << endl;
ImprimeDisplay(numero);
}
return 0;
}
--------
you get:
---------
<pre class="textmate-source"><span class="source source_c++">
<span class="storage storage_type
......
</span></pre>
--------
without the definitions of styles.. and the the rendering of this
html is uncoloured...
You need to select ALL the source text to get the full html with
colour styles, etc.
If you do so, the generated html starts with all the necessary styles:
-------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>displayNum.cpp</title>
<style type="text/css">
/* Stylesheet generated from TextMate theme
*
* VERDE
*
*
*/
/* Mostly to improve view within the TextMate HTML viewer */
body {
margin: 0;
padding: 0;
}
pre.textmate-source {
margin: 0;
padding: 0 0 0 2px;
font-family: ProFont, monospace;
........
---------------
Hi
I used to need pretty print my C++ code for students and I have found
the next simple script solves my problem in a cute way, since it
shows me the formatted code in a separate window (output "Show as
HTML") and then I can easily copy the source (Cmd-Opt-U) or the
styled text (copying directly from the output window):
----- input "Selected text" or "Document"
echo "<PRE>"
enscript --language=html -Ecpp -e -B --color \
--header="$TM_FILENAME|$E|pag. $% de $=" --title="$TM_FILENAME" \
-o- 2>/dev/null | \
perl -ne 'next if (1../<PRE>/i); last if (m|</PRE>|..1); print'
echo "</PRE>"
------ output "Show as HTML"
--- Save nothing, source.c
I would like to generalize it for it to be used with other source
code, not only C, what should be the better way? to have a table
mapping modes with enscript input modes... ?
Any help will be welcome.
--
Juan F.
Thanks Dougal, it is very impressive, really.
...but, why it doesn't colour when you give it selections? ehmmm
I usually need to cut functions, etc...
but anyway the Brad Choate solution is much much better than the
enscript one. Thanks
Is there some trick for make B. Choate script to colour portions of
text?
Thanks!
> De: Dougal <dougal(a)gmail.com>
> Fecha: 22 de mayo de 2007 01:59:38 GMT+02:00
> Para: "TextMate users" <textmate(a)lists.macromates.com>
> Asunto: Re: [TxMt] html pretty print
> Responder a: TextMate users <textmate(a)lists.macromates.com>
>
> Have you tried "Create HTML from Document / Selection" in the
> TextMate bundle?
>
> On 5/21/07, Juan Falgueras < jfalgueras(a)uma.es> wrote:
>
> Hi
>
> I used to need pretty print my C++ code for students and I have found
> the next simple script solves my problem in a cute way, since it
> shows me the formatted code in a separate window (output "Show as
> HTML") and then I can easily copy the source (Cmd-Opt-U) or the
> styled text (copying directly from the output window):
>
> ----- input "Selected text" or "Document"
> echo "<PRE>"
>
> enscript --language=html -Ecpp -e -B --color \
> --header="$TM_FILENAME|$E|pag. $% de $=" --title="$TM_FILENAME" \
> -o- 2>/dev/null | \
> perl -ne 'next if (1../<PRE>/i); last if (m|</PRE>|..1); print'
>
> echo "</PRE>"
> ------ output "Show as HTML"
> --- Save nothing, source.c
>
>
> I would like to generalize it for it to be used with other source
> code, not only C, what should be the better way? to have a table
> mapping modes with enscript input modes... ?
>
> Any help will be welcome.
>
>
> --
> Juan F.
I am having trouble figuring out the spreadsheet bundle. Suppose I have the
following table:
|name |foo |bar |total |
|mike | 1 | 2 | |
How do I calculate the total?
>From the screencasts, I think I should have this line:
% A3 := SUM(A1:A2)
Then what do I need to do to get the cell to display the value?
Mike
I recently added support for .rcss files to my Ruby on Rails project, those
being the equivalent of .rhtml, but for stylesheets. I've been trying to make a
grammar that gives me all the nice ERB autocompletion and syntax coloring that
exists for .rhtml files, but seem to be running into issues with the scope
selectors.
My grammar, based on th HTML (Rails) one is here: http://pastie.textmate.org/63540
Using that, I get proper syntax coloring for embedded Ruby if I use it at the
root level, but I still don't get autocomplete. And inside a CSS selector, I
can't get anything.
The output I'm getting: http://pastie.textmate.org/63543
Is there a way to specify conditional scope within a grammar? It seems like once
it hits the CSS selector, it doesn't recognize ERB anymore.