[TxMt] Lucky Linking Trio

Allan Odgaard throw-away-1 at macromates.com
Sun Sep 24 05:37:49 UTC 2006

On 24/9/2006, at 5:47, Brett Terpstra wrote:

> These are my three variations of the "Lucky Linking" idea, where  
> the command
> searches Google with the selected text and returns the "I'm feeling  
> lucky"
> result as a link.

Thanks -- these commands are great! And the use of progress  
indicators/dialogs is very nice polish!

> I have modified all three commands so that they require no extra  
> support
> files, but they do require some standard libraries that I made  
> assumptions
> that everyone would have.  If I'm wrong, let me know.

They work for me :) Likely it would be good to put it into a support  
library of its own, so that we can offer the same functionality for  
Markdown, Textile, etc. w/o having to duplicate the full commands.

> The Get Title from URL variation is just an improvement on  
> iamrice.org's
> version.  The regex is a little more flexible, and it returns a  
> link with a
> title attribute.

I was thinking: we have ^Q to “Reformat Paragraph” which we loosely  
interpret also as “fix-up code” e.g. to reformat method signatures  
etc. in Objective-C.

I’ve been wanting to extend this to have ^Q on an <img> tag insert/ 
update the width/height attributes with the current image size.

Following that line of logic, we could let ^Q insert the title  
attribute for anchor tags (instead of the dedicated command).

It does change the semantic (from taking an URL and producing an  
anchor tag, to instead work on an existing anchor tag), but I think  
the advantage of a) less key strokes to remember (more consistency)  
and b) being able to go in and “fix” existing anchors, makes this a  
desirable change.


> [...] The Wikipedia version goes a few steps further and scrapes  
> the pages with a
> quick regex to determine if it's a final destination or another  
> search page
> (or disambiguation page).

I haven’t looked into this myself, but it might not be necessary to  
do screen scraping: http://en.wikipedia.org/wiki/User:Yurik/Query_API

> [...] I am no good at either programming or regular  
> expressions ;-).  I do my best
> to fool people.  But I am eager to learn from my mistakes, so if  
> you do take
> the time to look at these, please give me as much feedback as you  
> can.  I'll
> lap it up like a puppy.

Regardless of how they were made, the commands function great :) And  
I definitely want to integrate this new functionality in the default  
markup bundles.

More information about the textmate mailing list