From: Jean-Christophe Helary <lists@traduction-libre.org>
To: "Daniel Martín" <mardani29@yahoo.es>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: macos: Finder's alias handling
Date: Mon, 27 Sep 2021 08:30:43 +0900 [thread overview]
Message-ID: <C7FCC9B6-33FF-420B-BE50-34B7CD653950@traduction-libre.org> (raw)
In-Reply-To: <m1mtnz8fig.fsf@yahoo.es>
> 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/
next prev parent reply other threads:[~2021-09-26 23:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C7FCC9B6-33FF-420B-BE50-34B7CD653950@traduction-libre.org \
--to=lists@traduction-libre.org \
--cc=emacs-devel@gnu.org \
--cc=mardani29@yahoo.es \
/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.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).