[TxMt] drag command for inserting links to local files

Rob McBroom textmate at skurfer.com
Wed Sep 26 21:06:56 UTC 2007


After a long delay (been busy with work stuff), I've taken some time  
to work on this Drag Command according to suggestions.

To refresh your memory, this command lets you drag a file into an e- 
mail message and have a link to the file on your web server inserted  
(instead of sending it as an attachment).

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

> On 9. May 2007, at 22:54, Rob McBroom wrote:
>
>> I created this a while back, but I had forgotten about it until a  
>> recent discussion of Drag Commands.
>
> 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

You can now set TM_FQDN to your machine's fully qualified domain name  
to override whatever `hostname` and `domainname` return. There is a  
comment about this in the command's source.

>  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.

The command now handles files in either `/Library/WebServer/Documents/ 
` or `~/Sites/` correctly, but I didn't implement the "copy from any  
location part" because of the following concerns.

1. The temporary location would need to be created if it didn't  
exist. I don't know about you, but I would be irritated if a bundle  
item created new directories without asking. Perhaps the temp  
folder's name could be set in a TM_ variable and if it doesn't exist,  
the command does nothing? Or outputs some warning text?

2. Would the temporary location be a sub-directory of `/Library/ 
WebServer/Documents/` or `~/Sites/`? Or would the proposed TM_  
variable from #1 just contain the whole path?

3. The copy operation could take a long time. (I'm guessing too long  
in some cases.) This could be solved by hard-linking instead of  
copying, but that only works if the operation involves a single  
filesystem. Is it possible to insert the link text and let the copy  
operation continue in the background (on the assumption that by the  
time you send your message and someone reads it, the file will be  
there)?

> I think currently it should be limited to text.mail.

Done.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mail Link.tmDragCommand
Type: application/octet-stream
Size: 1212 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20070926/92782fcf/attachment.tmDragCommand>
-------------- next part --------------

---
Rob
<http://www.skurfer.com/>




More information about the textmate mailing list