Hi,
so I'm posting this last message to share the "final"
version of the Label Table command; of course it is
very rudimentary and would need additional work, but
for me it does exactly what I need, so maybe it can
be useful for others too. I hope Haris or Allan like
it and add something like it to the Latex Bundle in
the future (who knows what's in the mind of masters
anyway).
I guess it is not possible to attach files from the web
gmane interface, so I am posting the command inside
the text. After all it takes 2 minutes to join back the long
sed commands into one line, copy and paste into the
bundle editor... Input: entire document, Output: HTML
file, scope: you choose.
The command creates an HTML window listing all the \label-s
of the topmost open window (only one file at the time, sorry).
Each label in the window is clickable, and clicking inserts text
at the insertion point in the open TextMate window.
If the label name starts with "eq", then \eqref{label_name}
is inserted; otherwise, only \ref{label_name}.
Best way to use the command: launch it the first time, the
HTML window opens; resize and put the window in a handy
position; then never close it, when you need it just issue the
command again (the window is refreshed and jumps over the
other windows).
Thanks to Allan for help.
Enjoy and improve,
Piero
TEXT OF THE COMMAND:
# parse the file for \labels (plus two lines following them)
sed -n -e "/\\label/{=;N;N;G;p;}" |
# separate labels from each other, the html way
sed '/^$/d' |
sed 's/^\([0-9]*\)$/\<p\>\<\/p\>\1/' |
sed 's/\(.\)$/\1\<br\>/' |
# the following two sed commands must be on one line each!
# do not insert spaces when joining lines
# insert active javascript links: for equations (we want \eqref here)...
sed 's/\\label{eq\(.*\)}/\<a href=\"javascript:TextMate.system
(\"\/usr\/bin\/osascript \&\>\/dev\/null -e @tell app \\\"
TextMate\\\" to insert \\\"\\\\\\\\eqref{eq\1}\\\"
@ \&\", null);\"\>\\label{eq\1}\<\/a>/' |
# ... and for the rest (sections, theorems etc.: we need \ref)
sed 's/\\label{\([^e][^q].*\)}/\<a href=\"javascript:TextMate.system
(\"\/usr\/bin\/osascript \&\>\/dev\/null -e @tell app \\\"
TextMate\\\" to insert \\\"\\\\\\\\ref{\1}\\\"
@ \&\", null);\"\>\\label{\1}\<\/a>/' |
# I used @ instead of ' for escaping reasons - put the quotes back
tr "@" "'"
In a previous version of textmate the following code for a template
worked to create a TM_PACKAGE variable
TM_PACKAGE=`sed <<<$TM_NEW_FILE_DIRECTORY -n 's#.*classes/\
(.*\)#\1#p'|tr / .` \
basically it takes the new file directory like this
/Users/ketan/Documents/client/project/development/classes/client/
project
And It turns the "/" to "." and removes everything before the classes
so the end result would be
client.project
Any ideas on how to do this ? I am not very good with sed.
Ketan
So this is the .tmCommand file containing the
Label Table command. Please see the preceding
post for description.
The number of messages I sent in the last two days
takes me dangerously close to the status of a
spammer, but I'll keep shut in the future, I promise
(yeah right)
Piero
Hi,
one never really escapes the escape tunnel.
I have a new problem with escapes.
>From the command line I can ask
TextMate to insert a backslash:
osascript -s 'tell app "TextMate" to insert "\"'
I want to do the same from a javascript
contained in an a href link. But I can not find the
correct way to escape things. Allan's suggestion
works perfectly with ordinary text; the following
html code:
<a href="javascript:TextMate.system("/usr/bin/osascript &>
/dev/null -e 'tell app \"TextMate\" to insert
\"TEXTTOINSERT\"' &", null);">
TEXTOFLINK</a><br>
produces a link TEXTOFLINK and when I click on it,
TEXTTOINSERT is inserted into TextMate. But if
TEXTTOINSERT contains a backslash, it is ignored.
A pity since I want to insert a tex command...
What should I write instead of TEXTTOINSERT to
get, say, "\eqref" to be inserted? Yes, I am escape-blind.
Thanks for any help,
Piero
PS hm... no one seems to like my new idea for label
completion. I'll keep it for personal use :)
With this text:
mainNavL1
Doing Control + right arrow will move the cursor first to the
beginning of the word, then to the left of the capital N, then left
of the capital L, and after that pressing the keystroke no longer
advances the cursor -- it gets "stuck" there.
It seems that the numeral ("1" here) causes the problem. If you
start with the cursor to the right of the entire word and use Control
+ left arrow the problem does not occur.
eo
Thanks everyone!
Jacob's note stepped me through the RoR screencast's actions*
Alan's note lead me to the TextMate screencast which starts to unlock
TextMate's bundle and snippet secrets*
And Tom pointed out that I was seeing snippets in use, not really completion.
If these answers lead to a new question its: does TextMate have all its
features when run in Panther (OS X 10.3)? And if not, what am I missing?
Scrutinizing the text insertion screencast I noticed *my version (1.5.3)
is missing the "Automation" menu. Ah-ha!
I find no mention of system requirements or Panther versus Tiger
capabilities in the docs (aside from a couple minor ones). Is there a
version feature comparison matrix somewhere? Maybe that's just for when
you have an entire martketing department!
So, thanks for all the help,
Ivy
I was on vacation for 2 weeks and didn't feel like going through the
60+ TM emails ;) Thanks for the link, creating my own macro solved
the issue.
I hope that in the future, modifications on behaviors such as this
one (that clearly effect every day use) are given a little more time/
thought before being implemented, or at least get documented in a
more "in your face" way, so that I don't have to be worried about
what's going to happen every time TM gets updated ;)
Yann
On Sep 24, 2006, at 11:37 PM, textmate-request(a)lists.macromates.com
wrote:
> What, you didn't get the memo? ;)
>
> http://comox.textdrive.com/pipermail/textmate/2006-August/012725.html
>
> Haris
Folks,
I'm watching Putting Flickr on Rails
(http://www.rubyonrails.com/screencasts) and see the presenter using
TextMate with completion for a new HTML file. Great! How do I "turn it
on"?
Just want to set it and use it. I open a new doc, "application.rhml" in my
rails tree in folder, "layout" and type "doctype" and hit "esc"...nothing
happens - no, I take that back. Textmate beeps at me.
I don't want to become a textmate expert or wade through a lot of
documentation. Is it a bundle setting? A keystroke sequence? Bad karma?
I've gotten pretty good at BBedit in my day, so I'm not daunted by
configuration, but I don't want to (re-)learn unix or vm or whatever to
understand this.
And searching the list archine (http://macromates.com/community) isn't
quickly, concisely yeilding the answer (in the first two pages of results
for "how to use completion".
Please answer this probably incredibly simple question, or point me to the
tutuorial, thread, post or URL where the answer is found.
Thanks,
Ivy
Since I have never used BibDesk in conjunction with TextMate before,
we can rule out #3 and I use option #2 only if #1 doesn't work or
turn up the option I like.
I'm definitely talking about #1, although I was a bit confused
myself, to be honest.
So here are some more details:
(1) I have set the variable TM_LATEX_BIB (there are spaces in the
path, not sure whether that is important).
(2) I type \cite{ and start with the first few letters of a citation
(e. g. King for KingSmithVanderbilt:blablabla). The scope is
text.tex.latex, meta.citation.latex and
constant.other.reference.citation.latex. Sounds alright to me,
although you are clearly the expert here.
(3) I hit escape and nothing happens, no autocompletion or toggling
through my options. Instead, I get OS X' alarm bell.
(4) I hit option + escape and everything works just fine. So TextMate
definitely finds my bibliography file …
If there is anything I can do for regression, just let me know.
Max
PS I will be on a conference Monday through Thursday, so I won't
reply as quickly as I usually do.
Until yesterday, when I entered ":" after a class/id property name like:
.class {
property_name:
As soon as I hit the ":" I'd get ": ;" with a space after the ":"
ready to type the value. Now, suddenly I get no space anymore...
Which is prety annoying because I finally got used to the space being
there automatically... Worse even: when I go to work tomorrow, my
version of TM there is probably going to insert that space and I'm
going to go nuts switching between the 2 versions everyday... :'(
I looked at CSS bundle prefs for PropertyName: { smartTypingPairs =
( ( ':', ';' ) ); } but I don't see where the space came from before
and I didn't change anything there anyway... I don't really care
either if I get the space automatically or not, but it took me a
while to get used to it when TM first started to do that (I kept on
inserting an extra space for like 2 weeks...) so what bothers me is
that behavior changed... again... and I have no idea why.
Happened to anyone else before?
I did remove all the customized bundles and restarted TM fresh, but
the auto insertion of the space is still gone...
Thanks for any help!