[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
macos: Finder's alias handling
From: |
Jean-Christophe Helary |
Subject: |
macos: Finder's alias handling |
Date: |
Mon, 27 Sep 2021 00:42:55 +0900 |
Finder's aliases are binary files that macOS recognizes as something akin to
Unix soft links, but they're really very different, except that in dired, they
don't look different, they just look like normal files, but opening them just
displays a binary blob instead of following the link.
It's probably a problem that has already found a solution, and I'm trying to
reinvent a wheel...
So, what I am trying to do is:
1) when I open such a file by mistake, I run a function that uses Applescript's
ability to find the target file and I "find-file" that target in Emacs
That would go like this:
(shell-command (format "osascript -e \"tell application \\\"Finder\\\" to
return quoted form of POSIX path of (original item of file (POSIX file
\\\"%s\\\") as alias)\"" "/path/to/my/alias"))
This produces something like:
’/path/to/the/target/file’
but in *Shell Command Output*, so that I can't just to (find-file
(shell-command...)).
There is probably a way to use the contents of *Shell Command Output* and
insert that as an argument to find-file, but I don't find that very elegant,
and I'm probably missing something in the shell-command because I can't see how
I can use the output as a direct argument to find-file...
2) now, I'd like to generalize that so that Emacs automatically triggers that
code when entering such a file. So I guess that would encompass dired and the
likes, "find-file" and similar commands, etc. Is that even possible? I guess
the answer is yes, but at what cost in terms of performance? And how would I go
about that?
--
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/
- macos: Finder's alias handling,
Jean-Christophe Helary <=
- Re: macos: Finder's alias handling, Daniel Martín, 2021/09/26
- Re: macos: Finder's alias handling, Jean-Christophe Helary, 2021/09/26
- Re: macos: Finder's alias handling, Jean-Christophe Helary, 2021/09/27
- Re: macos: Finder's alias handling, Alan Third, 2021/09/27
- Re: macos: Finder's alias handling, Jean-Christophe Helary, 2021/09/27
- Re: macos: Finder's alias handling, Alan Third, 2021/09/27
- Re: macos: Finder's alias handling, Jean-Christophe Helary, 2021/09/27