Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open file in emacs from google chrome on mac os #426

Open
panaak opened this issue Aug 25, 2018 · 2 comments
Open

Cannot open file in emacs from google chrome on mac os #426

panaak opened this issue Aug 25, 2018 · 2 comments

Comments

@panaak
Copy link

panaak commented Aug 25, 2018

hi,

i don't know what i'm doing wrong, but i can't force google chrome to open a file in emacs client.

$EDITOR=/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --create-frame --no-wait

the link in the exception page looks ok:

emacs://open?url=file://filename&line=nnn

still upon clicking there is no frame opened. i guess i should set something up in chrome or zsh or ...?

any ideas?

@RobinDaugherty
Copy link
Member

It looks like you need to install a URL handler for the scheme on macOS. I found an example, but it hasn't been updated in 9 years and doesn't seem to work. It should be pretty easy for this support to be added to the emacs project.

If you do find a solution, please update this issue and I'll make sure it gets included in the wiki.

@panaak
Copy link
Author

panaak commented Aug 30, 2018

better_errors with emacsclient on mac os howto

  1. create emacsclient.app

    i used platypus as described here: https://east.fm/posts/open-with-emacsclient/index.html

    the ruby script i used is a modified version of a script for the Firefox integration

    #!/usr/bin/env ruby
    
    chunk = ARGV.join
    
    head, line  = chunk.split("&line=")
    trash, file = head.split("file://")
    file = file.gsub!("%2F", "/")
    
    args = `ps aux | grep Emac[s]` == "" ? "c" : ""
    
    # puts "Running file #{file} ##{line} with args #{args}"
    `/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n#{args} +#{line} "#{file}"`

    or here: emacsclient macos gist

    copy the app to /Applications folder

  2. register emacs scheme

    when you created the emacsclient.app the author is changed to the current user and so is the 'identifier' of the app.

    that is for user 'joe' the LSHandlerRoleAll key should be com.joe.emacsclient like this:

    defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{LSHandlerURLScheme=emacs;LSHandlerRoleAll=org.joe.emacsclient;}'

    so change it accordingly and run it in Terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants