From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Fwd: Mac OS Alias file links Date: Mon, 14 Apr 2014 17:21:59 -0700 Message-ID: References: <87ioqcfepi.fsf@bzg.ath.cx> <8738hfswq4.fsf@Rainer.invalid> Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-321695513-1397521319=:6237" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZr8d-00006L-5k for emacs-orgmode@gnu.org; Mon, 14 Apr 2014 20:22:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WZr8T-0006uJ-Il for emacs-orgmode@gnu.org; Mon, 14 Apr 2014 20:22:11 -0400 Received: from iport-acv2-out.ucsd.edu ([132.239.0.174]:7836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZr8T-0006uB-5b for emacs-orgmode@gnu.org; Mon, 14 Apr 2014 20:22:01 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Ivan Andrus Cc: emacs-orgmode@gnu.org, Ken Mankoff This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-321695513-1397521319=:6237 Content-Type: TEXT/PLAIN; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8BIT 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 --0-321695513-1397521319=:6237--