all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* macos: Finder's alias handling
@ 2021-09-26 15:42 Jean-Christophe Helary
  2021-09-26 16:31 ` Daniel Martín
  0 siblings, 1 reply; 8+ messages in thread
From: Jean-Christophe Helary @ 2021-09-26 15:42 UTC (permalink / raw)
  To: Emacs developers

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/




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-09-27 13:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-26 15:42 macos: Finder's alias handling Jean-Christophe Helary
2021-09-26 16:31 ` Daniel Martín
2021-09-26 23:30   ` Jean-Christophe Helary
2021-09-27 10:19     ` Alan Third
2021-09-27 12:27       ` Jean-Christophe Helary
2021-09-27 12:43         ` Alan Third
2021-09-27 13:36           ` Jean-Christophe Helary
2021-09-27 10:34     ` Jean-Christophe Helary

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.