[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: macos: Finder's alias handling

From: Alan Third
Subject: Re: macos: Finder's alias handling
Date: Mon, 27 Sep 2021 11:19:43 +0100

On Mon, Sep 27, 2021 at 08:30:43AM +0900, Jean-Christophe Helary wrote:
> > On Sep 27, 2021, at 1:31, Daniel Martín <mardani29@yahoo.es> wrote:
> > 
> > Jean-Christophe Helary <lists@traduction-libre.org> writes:
> > 
> >> 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?
> > 
> > If you see, macOS aliases always start with the same byte pattern, so
> > you could modify magic-mode-alist and add a specific mapping between the
> > regular expression that extracts that byte pattern and a new major mode
> > that you create (macos-alias-mode, for example).  This new major mode
> > will ask osascript for the real path of the alias and then show its
> > contents in the buffer, either on demand or automatically.  That's how
> > Emacs handle other binary file types like images or PDFs.
> > 
> > This approach would work when visiting Finder aliases in general, not
> > only from Dired.
> Excellent ! Thank you !

Potentially we could also add a function that would resolve them
directly using NSFoundation, rather than parsing the files with a
regex. The regex may be better if we want to support terminal only
builds, though.

(It's also unclear to me whether NSUrl resolves the final path or
not... I think it must but the documentation doesn't mention it
Alan Third

reply via email to

[Prev in Thread] Current Thread [Next in Thread]