On Mon, 14 Apr 2014, Ivan Andrus wrote: > On Apr 14, 2014, at 12:36 PM, Ken Mankoff wrote: > >> On 2014-04-14 at 13:42, Charles Berry wrote: >> >>> For this to work as you fantasize, you would need to enable the Finder >>> application to modify the part of the *.org file that encodes the >>> alias when you change the location of the aliased file just as the >>> Finder does to the alias when the location of the aliased file is >>> modified in the Finder. >> >> I don't think so. I'm not sure how BibDesk handles it, but my BibTeX >> file is not modified when I move the PDF that is linked to an entry via >> that 1200 character field that encodes the alias. Clearly BibDesk does >> something neat to encode and decode that field, but once created, the OS >> nor Finder know anything about that line or the file containing it. I >> don't think Finder would need to know about a string in an Org file >> either. > > We can look at a BibDesk file to see how it works. It adds a special field like: > > Bdsk-File-1 = {YnBsaXN0MDDUA...AAAAAAAAAAAAAAAMO} > > We guess that this base64 encoded, so we decode it (M-x > base64-decode-region) This then gives us a binary plist (it starts with > bplist) which we can turn into a readable form with M-: plutil -convert > xml1 -o - - RET Or copy it and run pbpaste | base64 -D | plutil -p - in the shell. > > This gives an xml representation of what BibDesk stores. BibDesk has an archive of entries typically stored at ~/Library/Caches/Metadata/edu.ucsd.cs.mmccrack.bibdesk/*.bdskcache and the 'NS.data' element of Bdsk-File-1 seems to point to one element. The *.bdskcache file has a bplist and I guess the 'FileAlias' component is what points to the pdf or whatever. The relevant source for the alias itself seems to be here: http://sourceforge.net/p/bibdesk/svn/19370/tree//trunk/bibdesk/BDSKAlias.m but I do not do objective C nor CoreFoundation.h, which I think is where the alias stuff lives now. I think it would be necessary for one to have a good handle on the stuff in CoreFoundation.h to make sense of this. > It’s an > archived object of some kind, but I don’t know about OS X aliases to > know what is the important part--I presume the NS.data portion. It > probably wouldn’t be too hard to borrow the code from BibDesk and extend > Emacs to do the same thing, or write an external script. I’m not sure > whether it would be possible to do it without touching C/Obj-C. I would > be interested in using such a thing (in BibDesk .bib files actually), > though probably not in writing it. :-) > One approach that sidesteps having to know the CoreFoundation.h stuff is to use the BibDesk AppleScript capabilities. There is a model for this at http://www.jonathansick.ca/adsbibdesk/ written in python, FWIW. HTH, Chuck