emacs-devel
[Top][All Lists]
Advanced

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

New URL Scheme


From: Perry Smith
Subject: New URL Scheme
Date: Sat, 15 Oct 2022 14:26:00 -0500

TL; DR

When I do “open file:/some/path/to/file.txt” on macOS, if file.txt has been set 
up right, it opens in Emacs.  How does that happen?  What is the earliest point 
I can hook into if I want to create a new scheme?

Long Version:

When a Ruby on Rails app throws an exception in development mode, it creates an 
error page in the browser.  On the page is the exception stack which is a list 
of files with line numbers for the stack traceback.  There are add ons that 
will reformat that list.  In the past, for example, the add on would put 
‘txtmt’ (as I recall) scheme in front and TextMate was rigged up to accept that 
when macOS sent it.  If it isn’t obvious yet, I am on macOS and build emacs 
using the —with-ns configure option.

I’ve edited nextstep/templates/Info.plist.in so it now has:
```xml
        <key>CFBundleURLTypes</key>
        <array>
                <dict>
                        <key>CFBundleURLName</key>
                        <string>Email Address URL</string>
                        <key>CFBundleURLSchemes</key>
                        <array>
                                <string>mailto</string>
                        </array>
                </dict>
                <dict>
                        <key>CFBundleTypeRole</key>
                        <string>Editor</string>
                        <key>CFBundleURLName</key>
                        <string>Emacs Local Address URL</string>
                        <key>CFBundleURLSchemes</key>
                        <array>
                                <string>emacs</string>
                        </array>
                </dict>
        </array>
```
I’m thinking that I can teach the add on to prepend “emacs:” as the scheme.  I 
think this will be better than using “file:” as the scheme since that may or 
may not be sent to Emacs — depending upon how Info is set up for the particular 
file.

Currently, I can now say “open emacs:/some/path/to/file.txt” and Emacs is 
brought to the front so it is being triggered but the file isn’t loaded.  I’m 
assuming some piece of code is looking at the “emacs” scheme and going “Nope!  
Not me!” and doing nothing.   Lot of assumptions where but my question is, 
where is the piece of code that is being given the URL and deciding to do 
nothing?

Thank you for your time,
Perry
p.s. I am subscribed to this list do not receive emails so please CC me.  I 
will also track down any replies in the archive.

Attachment: signature.asc
Description: Message signed with OpenPGP


reply via email to

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