(sorry if this pops up multiple times - gmail doesn't seem to be
working properly)
I've recently started using Textmate and the Latex bundle. I found
that I wanted to extend the functionality in various ways, including
by adding definitions to the Lanuage file to allow me to highlight
footnotes and emphasised text. Some of the code I wanted to add is:
{ name = 'meta.footnote.latex';
begin = '(\\(footnote|noteToSelf)\{)';
end = '(\})';
captures = { 1 = { name = 'keyword.footnote.latex'; }; };
patterns = ( { include = '$self'; } );
contentName = 'variable.parameter.footnote.latex';
},
{ name = 'meta.emph.latex';
begin = '(\\emph\{)';
end = '(\})';
captures = { 1 = { name = 'keyword.emph.latex'; }; };
patterns = ( { include = '$self'; } );
contentName = 'variable.parameter.emph.latex';
},
I've added that code to a copy of the Language definition. It seems
to work fine (there are probably errors, since I'm a newbie) but it
occurs to me that there may be a better way to do it. As it stands,
if the Latex bundle is updated in the next release, I'll still be
using the older language definition. Is there any way I could have
written my snippit to avoid that problem?
Best wishes,
Nicholas
Hi All,
Did I missed a step or something, but the first "child" in a
@media ... {...} never appears color-coded (See the attached
screenshot for an example)
Thanks,
On Jan 29, 2006, at 3:51 PM, Nicholas Cole wrote:
> Just while you are on updating stuff - the various commands from
> the jurabib package are used by many humanities people. There are
> lots of them, so I just match them by extending the pattern
> matching for \cite to match almost anything with 'cite' in it. I
> haven't yet run into problems with that approach...
Hm, that's an interesting idea, just match any command containing the
word cite as meta.cite.latex ..... I'll have to think about that a
bit though, and ask the other maintainers.
Do you have a list of all these commands?
Of course, adding support for every single latex package out there is
not really feasible...
Looking at http://www.jurabib.homelinux.org/jurabib/jb-com-ref.pdf,
there are not really that many citation options, and most of them are
already supported in the newest version of the bundle (in the
repository). What commands do you find missing? I think it is missing
author and title addons at the moment, but those can be easily added.
footcite support was added two days ago or so, along with the new
completion commands.
Haris
Hi Guys,
First time poster, been using TM for a while though.
I'm trying to write a command that will run, do it's thing, then save the
file. The trick is how to get it to save AFTER the command alters the
file. Is this possible?
Specifically, what I am trying to do is update a `Last Modified:` string
whenever I save a file. That's the easy part, I did it with some python
triggered by cmd-s. Now that the string has been altered, how do I save the
file? It seems possible with applescript, but I can't get it to work.
If anyone has any suggestions about this final step, that would be great. I
know there's something wrong with my applescript, it tends to behave
differently in osascript than in Script Editor, is this because of the
escaped quotes? Something to do with combining triple- and single-quotes?
I've searched everywhere, apple documentation, textmate wiki/mailing list,
and turned up nothing! It seems to me that having a "Save After" option for
Commands would be useful. What do you guys think? Maybe this has been
discussed already.
Thanks for your help,
Jim Bagrow
Here is the command:
Save: Current File
Command:
*************************************************************
#!/usr/bin/env python
import os
import re
import datetime
# get selected text from shell:
path = os.getenv('TM_FILEPATH')
f = open(path, 'r')
text = f.read()
f.close()
string = "Last Modified: "+datetime.date.isoformat( datetime.datetime.today()
)
p = re.compile('Last Modified: \d\d\d\d-\d\d-\d\d')
result = p.sub(string, text)
print result
# how can I save the file at this point, AFTER it's been modified?
# PS: I hate applescript!
cmd = """osascript -e \"
set thePath to do shell script \"echo $TM_FILEPATH\"
tell application \"TextMate\"
activate
save current document in thePath
end tell
\"
"""
os.popen(cmd)
*************************************************************
Input: Entire Document
Output: Replace Document
Activation: Key Equivalent -> "cmd-S"
> Have a look at stakeout: http://michael-mccracken.net/blog/
> blosxom.pl/2004/07/28
> This will allow you to have your script notified when the file is
> saved (but not closed, for which there is mate -w).
good tip -- thanks. yes, with a combination like that i can probably
get close to what i was looking for, but i still think that it would
be a lot cleaner for TM to support this more directly.
> As for receiving AppleScript events from a shell tool, that's not
> really possible AFAIK because the sender needs to have the
> receivers four character code, which is something only “real”
> applications have.
right, which is why i was asking for a non-applescript API.
(i think what i'd *really* like is to have a lua interpreter embedded
in TM, but in the absence of that we should be able to do almost
everything with external programs...)
"All that stuff" is required for Rails to run, but you can remove it
from a TM project (which doesn't delete them from the finder) and not
have to deal with files you don't modify.
luke
> From: Alain Ravet <arav2132(a)biz.tiscali.be>
> Date: January 27, 2006 2:04:02 AM CST
> To: textmate(a)lists.macromates.com
> Subject: [TxMt] Re: Req: exclude directory(ies) from "find in
> project".
> Reply-To: TextMate users <textmate(a)lists.macromates.com>
>
>
> Steve
>
> > Why not just make a project without all that stuff in it and
> just save
> > the project?
>
> Because "all that stuff" is required, of course.
>
> Alain
Thanks to Allen I've managed to add HTML export to my screenwriting
bundle. So now you can export your screenplays in proper Studio
Format! However, thanks to Safari's (and all other browsers) lack of
support for paged-media styles the resulting document does not print
ideally. That being said, it's a very nice result for outputting to
HTML. In fact, it's much better than Final Draft 7! (they don't
declare doctypes... bad final draft). It would be nice to see actual
support of CSS2 paged-media styles... one can only hope.
When exporting a PDF from Safari it adds header information and
footer stuff, as well as a nice .25in margin on every side. I'd like
to change that, if you know how let me know.
I've looked into using HTMLDoc and Prince to export the resulting
HTML document to a pdf by way of bypassing the build-in PDF services
but both of those cost money, something I'd like to avoid. If you
have any tips, let me know.
I've also added support for printing and non-printing comments, as
well as general code clean-up.
Aside from minor changes in regexp rules to account for people's
writing habits, I cannot foresee to many more changes in the bundle
(aside from a better PDF option). So, thanks to all of you who helped
and especially to Allen. You can now say that TextMate has a
(somewhat) full-featured Screenplay-writing bundle that imports
resulting documents *perfectly* into Final Draft. Objective
accomplished.
Download: http://ollieman.net/files/bundles/screenplay.zip
The Diff bundle command 'Selected Files in Project Drawer (HTML)'
references "$TM_BUNDLE_SUPPORT/diff.pl", but the actual file is
"$TM_BUNDLE_SUPPORT/Diff.pl" (note case: d vs. D). If (like in my
case) TM is installed on a case sensitive file system, that command
will not work:
--- Commands/Diff Selected Files.plist (revision 2604)
+++ Commands/Diff Selected Files.plist (working copy)
@@ -11,7 +11,7 @@
exit_show_tool_tip
fi
-perl "$TM_BUNDLE_SUPPORT/diff.pl"
+perl "$TM_BUNDLE_SUPPORT/Diff.pl"
</string>
<key>input</key>
<string>none</string>
Gerd
PS: What are the rules to gain write access to http://macromates.com/
svn?
> I expected to find the header/footer control in Safari 2's File...
> Page Setup..., but eventually caught on to the fact that it is in
> File... Print. Select "Safari" in the third selector and disable
> "Print webpage information in headers and footers". -Jim Tittsler
Good find.
> Not sure what support you seek, but it is possible to give some
> page-break hints with CSS. For example for the TextMate manuals
> print style sheet I force a page break [1] after each chapter. -
> Allen O.
Safari's support for paged-media within CSS2 is limited.
Specifically, it supports both the "auto" and "always" values, but
not "avoid"; which is why I can't get the following rules to work:
@page { size: 8.5in 11in; margin: 1in 1in 1in 1.5in; }
dl, dd { page-break-inside: avoid; }
dt, h2 { page-break-after: avoid; }
h3 { page-break-before: avoid; }
h4 { page-break-after: avoid; }
I've tested these in Safari, Camino, and a Safari Nightly Build.
Hi,
maybe I can get some advice from experienced users. I tried to update
my Latex bundle by following the instructions in the TextMate
manual. svn is installed and I could get connected to macromates.
However, when I enter the following command
svn --username anon --password anon co \
http://macromates.com/svn/Bundles/trunk/Bundles/Latex.tmbundle
I receive the error message
subversion/libsvn_ra_dav/util.c:780: (apr_err=175002)
svn: REPORT request failed on '/svn/Bundles/!svn/vcc/default'
subversion/libsvn_ra_dav/util.c:295: (apr_err=175002)
svn: REPORT of '/svn/Bundles/!svn/vcc/default': 400 Bad Request
(http://macromates.com)
I am lost. What could be going wrong ?
Christof
This is the feature I miss the most (when writing Rails code).
How it works :
1°/ select a directory, and
2°/ mark it as "exclude from 'find in project'"
context: in Rails, the log files and 3rd party code (EdgeRails, plugins,
javascript libs, docs ..) are all in your project tree
=> your code can be less than 10% of the total files/code present in
the project
===> most of the results entries are useless, because out of scope.
Alain
I noticed that the LaTeX bundle provides the same shortcut for two
different commands:
BibDesk Completion
Insert Label From Document
Both are mapped to ⌥⎋. Is this a bug or a feature?
Trevor
Hello
I have this word in completation list "split-path"
if I type "spli" and esc key it does work
if I type "split-" and esc it doesn't
what should I do?
also for color syntax, I'd like "value?" to be recognized
but this doesn't work:
{ name = 'rebol.words';
match = '\b(value\?)\b';
},
thank you!
Will
hello I'm new to TextMate, Hat down to the creators/developers
I'm coming from bbedit..hem..hemm no comment..
I'm trying to build a bundle for the rebol language
and regex is new to me.
Please, help on this
"^""
^" is escape "
all between " and " is a string
this is my code
{ name = 'rebol.string';
begin = '"';
end = '"';
},
which obviously dosn't work for this case.
also any link to great oniguruma tutorial would be great
Thank you and have a great day!
Will Arp
i've written a few scripts to make editing of remote files easier.
then i noticed that TM supports the "external editor
protocol" (http://www.merzwaren.com/external_editor.html), which
sounds like it would make some of my hacks quite a bit cleaner, but
only if i was able to deal with applescript events. i haven't been
able to find tools to make a ruby script (or any other scripting
language) able to receive applescript events (yes, i know how to send
them, although that's still ugly), which means (as far as i can tell)
that i'd need to start mucking with obj-C...
but then it occurred to me that it ought to be easy for TM to support
a more scripter-friendly version of the same protocol, e.g.
mate --notify <path> <file>
would associate the script at <path> with the opened file, so that TM
would make event callbacks, e.g.
<path> saved <file>
<path> closed <file>
<path> reopen <file>
given that you've already got the events-based version of the
protocol implemented, it sounds like this should be pretty
straightforward, and it sure would make my life easier...
(a more general request: please don't make useful TM functionality
only available through applescript. there are a lot of scripting
languages for OS X, and for all but one of them applescript events
are a PITA. anything that can be done by sending applescript events
should also be accessible via mate! thanks.)
This was announced a couple of weeks ago on the Rails mailing list,
but I thought it might be interesting to others in the textmate area
whether for Rails development or for learning purposes.
The textmate_backtracer plugin (download here) for Ruby on Rails lets
you easily jump from your web browser to textmate when a backtrace is
given. Using the txmt:// protocol, the plugin intercepts the
backtrace and inserts the file name and line numbers in a way
textmate understands so that you can get to the source of the problem
(no pun intended) in a single click.
Information available on my blog:
http://inquirylabs.com/blog2005/?p=36
Direct download:
http://inquirylabs.com/downloads/textmate_backtracer.tgz
Duane Johnson
(canadaduane)
http://blog.inquirylabs.com/
Hi everyone,
I use a Mac part-time, and switching between Mac and Windows key
bindings is driving me nuts. I found the article "Key bindings for
switchers" and happily followed along with the instructions. However,
having set up my ~/Library/KeyBindings/DeaultKeyBinding.dict file
exactly as in the article, the new bindings work fine in Mail and
TextEdit but not in TextMate. I have no idea why that would happen -
any ideas?
Here's the contents of my DefaultKeyBinding.dict (copied directly
from the article) for reference:
{
/* home */
"\UF729" = "moveToBeginningOfLine:";
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
/* end */
"\UF72B" = "moveToEndOfLine:";
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
/* page up/down */
"\UF72C" = "pageUp:";
"\UF72D" = "pageDown:";
}
Thanks in advance,
--Brendan
On Jan 24, 2006, at 10:02 AM, Allen wrote:
> Ah okay -- so basically it's the conversion you want help with?
yes.
> I assume it's because you are not familiar with any programming
> language (which I must say, your bundle is pretty impressive if you
> are not -- even if you are, it still is impressive -- do you mind I
> link to the intro screencast in the RSS feed as an example of
> behavioral patterns in TM? I can keep a local cache of the bundle
> if you're concerned about bandwidth).
I'd be glad to host the screencast, if bandwidth becomes a problem,
I'll let you know. And yes, I know exactly zero about programming
languages. The first time I used a regexp was for this bundle.
> I would suggest using htmldoc [1] for the HTML -> PDF conversion.
I'll check it out.
> So what you want is to make a regular expression to match each
> construct in your format, which you already did in the language
> grammar, and then as the replacement string you specify how it
> should be transformed. Here you can use $& to refer to the entire
> match and $1-$n for captures (stuff captured with (…)).
Okay, based on what you posted here before, I added a few things that
were missing and synced these with the language def.
#!/usr/bin/perl -p
s/&/&/g; #ampersands
s/</</g; #reserved for HTML
s/>/&lgt;/g; #reserved for HTML - maybe this is unnecessary?
s/^EXT\..*$/<h2>$&<\/h2>/; #scene heading
s/^INT\..*$/<h2>$&<\/h2>/; #scene heading
s/^I\/E\..*$/<h2>$&<\/h2>/; #scene heading
s/^[A-Z].*\-\s[A-Z].*/<h2>$&<\/h2>/; #arbitrary scene heading ending
with a time
s/^[A-Z].*\-\s*$/<h2>$&<\/h2>/; #arbitrary scene heading NOT ending
with a time
s/^\w.*$/<p>$&<\/p>/; #paragraph
s/\/\/(.*)\/\//<!-- $1 -->/g; #comments
s/\*(.*)\*/<em>$1<\/em>/; #italics
s/^(\t{4})([^\t].*)$/<dl>$1<dt>$2<\/dt>/; #characters
s/^(\t{3})([^\t].*)$/$1<dd class="parenthetical"> $2 <\/dd>/;
#parenthetical
s/^(\t{2})([^\t].*)$/$1<dd>$2<\/dd><\/dl>/; #dialogue
s/^(\t{10})([^\t].*:)$/$1<h3>$2<\/h3>/; #transition (right)
s/^[A-Z].*:\s*/<h4>$&<\/h4>/; # transition (left)
The only one that's not working properly is the last one. It's
baffling to be because it's the same regexp as in the language.
> If you need further help, let me know (as I have no idea what your
> shell/programming skills are).
I have no programming skills other that those I've already
demonstrated. Zip
There are a few steps left in the process that need to be addressed.
Next the HTML marked-up text (as generated by the above script) needs
to be inserted into an actual HTML document with doctype
declarations, CSS etc. And somehow (again, I have no idea how) it
needs to be transfered to a PDF authoring environment (htmldoc or
whatever).
Lastly, thank all of you. It's great to give something to a community
and get so much back.
Hi,
I was trying to find an XML editor for large XML files. I tried to
open a 108 MB (genome data in XML) file in TextMate but it failed.
BBedit opens te file ok. Is there an upper bound to the amount of
data you can edit?
Cheers - francis
PROBLEM:
The feature of all mac apps that I use the most is search.
Specifically find selection & find again. I use that feature to step
through every instance of that selection throughout my code. One
feature that I would love to see is a back button for selections.
Every time you do a search or scroll through your document & select
something, to get back to the last thing you were working on you have
to have set a bookmark & remember which bookmark you were last
looking at, or you have to manually find that place in your code again.
I work on other peoples old janky ASP 'classic' and quickly slapped
together ASP.NET code on a deadline. Anything to help me make quick
work of navigating through the (massive mountain of fetid spaghetti)
code the better.
SOLUTION:
If there was a way for the program to note every time you move the
selection more than 'a little bit' & log that information
sequentially, all you'd have to do to get back to what you were last
looking at would be to hit the back button. bam bam... done, no
thinking.
I know the system is extremely extensible, i'm sure there is some way
for me to 'roll my own' system for doing something similar.
(1) I'd need a command to get the current input location row & column
(2) log that information somewhere
(3) a command to get the last input location from 'wherever' and then
(4) a command to set the input location to 'that location'
??? I think i could figure all this out with applescript and bbedit,
but i'm still rather green when it comes to hard-core UNIX hacking.
Anyone have any suggestions? ??
IDEA: Maybe a quickie version of it would be to undo the last edit,
which would take me back to the last place I was, but then redo my
last action without moving the input location so I don't lost any
work. hmm...
Maybe there's another solution to my problems that i haven't
considered. What does everyone else do?
I have been using TM (1.5 (906)) off and on for a couple of days now
and I noticed this evening that typing had become glacially slow. I
ran the Activity Monitor and noticed that as I type, cocoAspell
(2.0.2) was using about 70% of the processor on a 1.5 GHz PowerBook
G4. I turned off "Check Spelling As You Type" and the problem went
away. I haven't noticed this problem in any other app for which I am
checking spelling as I type. Is this a known issue and/or is there
some way for me to fix it? This is under Mac OS X 10.4.4.
Thank you,
-- Gary
> On 24/01/2006, at 13:34, Allan Odgaard wrote:
>
>> On 24/1/2006, at 5:55, John Johnson wrote:
>>
>>>>> I've managed to hose the binding for my keypad Enter key [...]
>>>> Is this only in TextMate that it's a no-op or system wide? [...]
>>> It is system wide. I'll continue to search the web.
>> My first guess would be that it's the keyboard. You may want to try
>> and clean it and/or try connecting another keyboard (if you have
>> one available).
>
> Curiously, my Enter key doesn't work either. At all. Except it does
> wake the machine up from sleep. But even the keyboard viewer doesn't
> show it being pressed.
Since I've switched to a Mac and started using TextMate I've wanted
to bind the keypad enter key to the TextMate "Next File Tab"
command.
Is this possible with OS/X? The keyboard shortcuts preference
panel doesn't distinguish the "main" return key from the keypad
enter key.
Stu