[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: macos: Finder's alias handling
From: |
Jean-Christophe Helary |
Subject: |
Re: macos: Finder's alias handling |
Date: |
Mon, 27 Sep 2021 08:30:43 +0900 |
> On Sep 27, 2021, at 1:31, Daniel Martín <mardani29@yahoo.es> wrote:
>
> Jean-Christophe Helary <lists@traduction-libre.org> writes:
>
>>
>> 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...
>
> Did you try shell-command-to-string? I found it by doing C-h d "shell
> output string".
Yes, but it adds a "..." around the ’...’ string and that doesn't work.
>> 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 !
--
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/
- macos: Finder's alias handling, Jean-Christophe Helary, 2021/09/26
- Re: macos: Finder's alias handling, Daniel Martín, 2021/09/26
- Re: macos: Finder's alias handling,
Jean-Christophe Helary <=
- 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