[TxMt] drag command for inserting links to local files

Rob McBroom textmate at skurfer.com
Fri May 11 19:15:11 UTC 2007


On May 11, 2007, at 5:06 AM, Allan Odgaard wrote:

> Anyway, for this bundle item I have two comments:
>
> 1) it doesn’t find my fully qualified domain name, so we need:
>     a) a note about how the user can set it up!?!
>     b) a fallback variable or so for the domain name

Ah, I suppose that on most systems, the FQDN won't be stored  
*anywhere* - not even in the wrong place. Instead, you'll see  
something like "Allan's-PowerBook-G4". Dammit, I thought TextMate  
users were nerds. ;) If we can't count on the local system, perhaps  
the command could look for a user defined variable and if it's not  
set, go to an external service to get a name (similar to the "Get  
Remote IP" script in Quicksilver's Extra Scripts plug-in). I don't  
see how we could have a hard-coded fallback that would be appropriate  
for everyone (unless we made it something awful like  
`set.TM_WEBSERVER.to.your.systems.fully.qaulified.domain.name.com`),  
which is a combination of both a and b.

> 2) would be nice if it allowed to copy files not in ~/Sites or / 
> Library/WebServer/Documents to be copied to some “temporary” folder  
> of either location. That way, we can drag arbitrary files to the  
> letter, not just those already located in the right location.

So you're saying any file dropped into a text.mail scope would be  
copied to the temporary location (and a link inserted)? I might like  
that better. I'll have to think about it. Some questions:

   * If the temporary location doesn't exist, should the command  
create it or is that inappropriate?

   * How would it decide whether to use ~/Sites or /Library/WebServer/ 
Documents? Perhaps we could check for TM_DOCUMENTROOT and fall back  
to /Library/WebServer/Documents if it's not set. This would also be  
nice for people like Allan who use another system as the web server  
because the path could be anywhere (as long as it's always mounted,  
which it sounds like it is in Allan's case).

   * Should we use `ln` instead of copying (mostly to prevent the  
command from waiting on the copy operation, but also for disk space)?  
Ideally, this is how it should work in my mind:

     * If the file is on the same filesystem as the DocumentRoot,  
create a hard link
     * If the file is on a remote system and the DocumentRoot is on  
the local disk, create a symbolic link
     * If the DocumentRoot is on a remote system, copy the file  
regardless of where it comes from (this could make the command very  
slow)

     Sound about right?

---
Rob McBroom
<http://www.skurfer.com/>
I didn't "switch" to Apple... my OS did.






More information about the textmate mailing list