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

Not working with the Emacs Mac Port? #30

Closed
ylluminarious opened this issue Mar 6, 2018 · 23 comments
Closed

Not working with the Emacs Mac Port? #30

ylluminarious opened this issue Mar 6, 2018 · 23 comments

Comments

@ylluminarious
Copy link

As per the discussion at #8, I tried this with the Emacs Mac Port and it seems that nothing happens. There is a little gear icon in the menu bar for a moment, but then nothing happens and the gear icon disappears. Is there a log file somewhere which could give a clue as to what's going wrong?

@zachcurry
Copy link
Owner

@ylluminarious Thank you for creating an issue for this!

We are two weeks into this project and it is still very immature . It does just enough to work in some environments.

I'm going to try to release v1.1 in the next week. It should fix a majority of the issues we've seen thus far as well as add some helpful runtime error messages and debugging/verification upon install. I'll add an issue for this soon so we can talk about what should be included in the release. I'll put the changes in a new branch we can test against.

In the meantime, the best way to debug would be to

$ cd ~/.emacs_anywhere/bin
$ ./run

@ylluminarious
Copy link
Author

@zachcurry Great, thanks for the info!

@meereeum
Copy link

meereeum commented Mar 8, 2018

similarly, emacs-mac works when run directly from repo, but seemingly not via shortcut (sometimes does nothing, sometimes shows gear but does nothing, sometimes pastes from clipboard without opening emacs ?). nonetheless, v exciting!

@mrcnski
Copy link

mrcnski commented Mar 9, 2018

Seconding @meereeum. I am able to run using ./run as mentioned above, but when using a shortcut it pastes from clipboard.

@zachcurry
Copy link
Owner

@ylluminarious, @meereeum, @m-cat, I have a new PR up that does some checks on install and may provide some helpful debugging. Also, I have removed some code that modified the PATH variable when run via the shortcut. Perhaps this change will resolve your issue(s)!

@mrcnski
Copy link

mrcnski commented Mar 9, 2018

Thanks @zachcurry! Unfortunately, it still doesn't work for me. Output from installation:

~/repos/emacs-anywhere master
❯ curl -fsSL https://raw.github.com/zachcurry/emacs-anywhere/release_1.1/install | bash
dependency check passed: emacsclient
dependency check passed: git
Uninstalling existing installation...
Reinstalling Emacs Anywhere...
Cloning into '/Users/marcin/.emacs_anywhere'...
remote: Counting objects: 95, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 95 (delta 0), reused 5 (delta 0), pack-reused 85
Unpacking objects: 100% (95/95), done.
Copying /Users/marcin/.emacs_anywhere/Emacs Anywhere.workflow to /Users/marcin/Library/Services...
Emacs Anywhere has been installed!

It still pastes from the clipboard when run via shortcut.

I really hope we can resolve this, can't wait to use it :)

@zachcurry
Copy link
Owner

@m-cat Thanks! I'm going to get the bottom of this as quickly as I can.

@meereeum
Copy link

fwiw, i got a fork of vim-anywhere working with spacemacs+{osx,debian} .. just export EDITOR_EVERYWHERE='/usr/bin/emacsclient --alternate-editor="" -c' (for example). @zachcurry might be useful for debugging this project!

https://github.com/meereeum/vim-anywhere

[ this comment written in spacemacs ]

@zachcurry
Copy link
Owner

Siiick @meereeum ! I posted my intention of adding environment configuration to the project in another thread since we've had issues with Automator invoking shell scripts with unprepared PATH variables. As well as allowing the user to configure the degree to which the tool automates their task (i.e. copying text upon invocation).

I like the way you've set up this var. It looks like I could take the same approach and just concatenate the the eval option with the elisp onto the end! Thanks!

I had a quick glance at one of the commits and I can see that vim-anywhere uses a temp file instead of a new buffer. I'm already needing to use a temp file for the Linux implementation to workaround bugs in the Linux support for GNU Emacs. I wonder if I should just give up the ghost and use temp files instead 🤔

@meereeum let me know if you have the extra time, or desire to work on this project and I'll add you as collaborator.

@zachcurry
Copy link
Owner

zachcurry commented Mar 11, 2018

@ylluminarious @m-cat @meereeum I'm 90% sure this will fix your issue(s) since the problem seems to be getting Emacs to launch...

Get the latest from master

curl -fsSL https://raw.github.com/zachcurry/emacs-anywhere/master/install | bash

Add the second line below the comment in ~/.emacs_anywhere/config and set the path and options to suit your situation.

# Your configs go here
export EA_EDITOR="/path/to/your/emacsclient -a '' -c"

@mrcnski
Copy link

mrcnski commented Mar 12, 2018

I'm afraid it still doesn't work for me. I put the following in config:

export EA_EDITOR="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -a '' -c"

But I'm still seeing the behavior of pasting from clipboard. If I run /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -a '' -c in the terminal, however, Emacs starts as expected.

@zachcurry
Copy link
Owner

@m-cat If the keyboard shortcut was set properly in System Preferences I can't imagine what the problem could be. Does your version of emacs support the -e option? The only thing the app does is tack a -e option onto your config.

The last thing I can suggest is to make sure you don't have any zombie Emacs processes running and to start the server like this emacs --daemon. In fact, you may just want to restart your machine to make sure before you run emacs as a daemon. Beyond this and checking the README again I'm out of ideas.

Oh wait! You could try to debug it with this ~/.emacs_anywhere/bin/run. Let me know what you find. If it complains about an alternate editor, I sometimes get that when my server isn't running.

Good luck!

@mrcnski
Copy link

mrcnski commented Mar 12, 2018

Thanks for the reply. Going through your comment in order:

If the keyboard shortcut was set properly in System Preferences I can't imagine what the problem could be.

I tried several different shortcuts so I don't think this is it. And if I understand it correctly, since the clipboard is pasted, then the shortcut must work, but emacs_anywhere fails to start for some reason. Is that right?

Does your version of emacs support the -e option?

How do I check this?

In fact, you may just want to restart your machine to make sure before you run emacs as a daemon.

This didn't work, even on a fresh restart with no apps running. :(

You could try to debug it with this ~/.emacs_anywhere/bin/run.

This starts Emacs in the terminal and displays nil when I quit:

❯ ~/.emacs_anywhere/bin/run
nil

Thanks again for the help -- I've done a lot of tweaking to my system before so it's possible this just won't work for me.

@zachcurry
Copy link
Owner

This is a bummer @m-cat! Perhaps later down the road we’ll have something that just works for everybody. I’ll keep this in mind and ping you when I’ve got something that might work. Thanks for being so patient 👍

@mrcnski
Copy link

mrcnski commented Mar 29, 2018

Update: looks like it's working for me now. Thanks @zachcurry, this is awesome!

For anyone with the same problem: I don't know exactly what fixed my issue, but here's something you can try. I used the app KnockKnock to find a bunch of stuff I didn't want running on my system (i.e. launchd items) and then disabled or removed them manually. I also uninstalled a bunch of old apps (using AppCleaner). Again, no idea if that was what fixed my issue.

@ylluminarious
Copy link
Author

@zachcurry @m-cat I haven't been following the conversation very closely, but I appreciate the work that has been done here. Thank you guys!

As per @m-cat's above comment, I decided to try this out again, but I receive the following error in a system popup whenever I run Emacs Anywhere via the keyboard shortcut:

The action “Run Shell Script” encountered an error: “emacsclient: invalid option -- c
Try `emacsclient --help' for more information”

Anybody have a clue as to what may be going wrong?

@mrcnski
Copy link

mrcnski commented Mar 29, 2018

@ylluminarious what is your Emacs version?

Also, did you set EA_EDITOR in ~/.emacs_anywhere/config? For example, I set mine to

export EA_EDITOR="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -a '' -c"

(I installed Emacs as an app from https://emacsformacosx.com/). You may be running an out of date emacsclient.

@ylluminarious
Copy link
Author

@m-cat I'm running:

GNU Emacs 25.3.3 (x86_64-apple-darwin13.4.0, Carbon Version 157 AppKit 1265.21)
 of 2017-09-28

Also note that this is the Emacs Mac Port by Yamamoto Mitsuharu. I added the same code to my ~/.emacs_anywhere/config, but no dice.

@zachcurry
Copy link
Owner

@m-cat @ylluminarious Emacs Anywhere has been completely reimplemented! Have a look at the README. Configuring the editor is done differently now, so read that part closely. A bunch of people have used this version and I’ve had zero bug tickets. Besides, the new version has some cool features 😎

If you have any questions, I’m here.

@mrcnski
Copy link

mrcnski commented Mar 29, 2018

Configuring the editor is done differently now, so read that part closely.

I'm actually a bit confused by that part. I see there is a new command and lots of new variables but where do I put these? My init.el file?

@zachcurry
Copy link
Owner

@m-cat you can define the path to the editor by placing this statement in your ~/.bash_profile

export EA_EDITOR='path/to/emacsclient -a "" -c'

Advanced usage via elisp will allow you to configure your frame to do whatever you want based on the values you find in the variables. If you check out the "Examples" section of the README you will see how you can use a function and the hook provided to achieve this, but it's just an optional way to extend the behavior of an Emacs Anywhere session. If you use init.el for your configuration then put your code there. I use Spacemacs, so my code is in my .spacemacs file. As long as the code is run when the server starts it will work.

I hope that helps. If you read something in the README that doesn't make sense or, if you run into trouble I'll be here.

@ylluminarious
Copy link
Author

@zachcurry Awesome! That does the trick and I can actually use Emacs Anywhere now. I'll definitely have to consider customizing it and seeing what I can do to configure everything :)

Thank you!

@zachcurry
Copy link
Owner

@ylluminarious my pleasure! Thanks for hanging in there 😄

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

4 participants