[TxMt] Re: Storing variables on a window by window basis

Steve King sking at arbor.net
Thu Feb 24 18:14:36 UTC 2011


On 2011-02-24 11:03, Sean Dunn wrote:
> I'm trying to store information from the output a bundle command
> against the current file.  The idea is that this could then be
> retrieved by another bundle command run latter.
>
> This information doesn't need to be persistently stored, it's only
> used during editing so if I can I'd prefer not to litter the file
> system with these small files.
>
> Ideally, I'd like to do something like:
>
> $MY_VAR = "some value or other"
>
> Any of how to do this or a flat answer of you can't at the current
> time would be gratefully received.

I know you said you didn't need it to be persistent, but I can't really 
think of a way to do it without involving the file system. Bundle 
commands are run in separate subshells, so there's no way to use 
environment variables to communicate from one to the another.

Try looking at using filesystem extended attributes; do 'man xattr'. 
These are metadata associated with individual files -- persistent, but 
it's not a separate file somewhere.  It's a similar idea to the old 
resource forks that MacOS used to use, but better standardized across 
Unix filesystems. TextMate already uses extended attributes to keep the 
caret location persistent across sessions, so at least there's 
precedent. :-)

macduff:~/tmp/bugsdir$ ls -l bugs
-rw-r--r--@ 1 sking  staff  202 Feb 24 11:57 bugs

macduff:~/tmp/bugsdir$ xattr -l bugs
com.macromates.caret: {
     column = 22;
     line = 0;
}



-- 
Steve King
Sr. Software Engineer
Arbor Networks
+1 734 821 1461
www.arbornetworks.com <http://www.arbornetworks.com/>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3874 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.macromates.com/textmate/attachments/20110224/386bf367/attachment.p7s>


More information about the textmate mailing list