emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Ivan Andrus <darthandrus@gmail.com>
Cc: emacs-orgmode@gnu.org, Ken Mankoff <mankoff@gmail.com>
Subject: Re: Fwd: Mac OS Alias file links
Date: Mon, 14 Apr 2014 17:21:59 -0700	[thread overview]
Message-ID: <alpine.OSX.2.00.1404141655130.6237@charles-berrys-macbook.local> (raw)
In-Reply-To: <AA689F40-7205-470B-B04C-6CEE0F481803@gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2829 bytes --]

On Mon, 14 Apr 2014, Ivan Andrus wrote:

> On Apr 14, 2014, at 12:36 PM, Ken Mankoff <mankoff@gmail.com> 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

  reply	other threads:[~2014-04-15  0:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08  7:03 Mac OS Alias file links Ken Mankoff
2014-04-13 22:39 ` Fwd: " Ken Mankoff
2014-04-14  9:22   ` Bastien
2014-04-14 11:32     ` Ken Mankoff
2014-04-14 12:42       ` Nick Dokos
2014-04-14 13:17         ` Ken Mankoff
2014-04-14 16:26       ` Achim Gratz
2014-04-14 16:48         ` Ken Mankoff
2014-04-14 17:42           ` Charles Berry
2014-04-14 18:36             ` Ken Mankoff
2014-04-14 23:19               ` Ivan Andrus
2014-04-15  0:21                 ` Charles C. Berry [this message]
2014-04-15  1:58                   ` Ken Mankoff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.OSX.2.00.1404141655130.6237@charles-berrys-macbook.local \
    --to=ccberry@ucsd.edu \
    --cc=darthandrus@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mankoff@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).