alexmurray / emacs-snap

GNU Emacs in a snap
https://snapcraft.io/emacs
71 stars 13 forks source link

emacsclient is not working #16

Closed bbatsov closed 3 years ago

bbatsov commented 3 years ago

After writing an article on installing Emacs via snap (https://emacsredux.com/blog/2020/07/18/installing-emacs-via-snap/), some readers pointed me to this problem https://emacs.stackexchange.com/q/59656/18414

alexmurray commented 3 years ago

Thanks for the heads up, I'll take a look tomorrow. 👍

bbatsov commented 3 years ago

Thanks!

alexmurray commented 3 years ago

I expect this has something to do with either zsh not doing the right thing with environment variables (https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1640514) - or ssh not doing the right thing with them (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=964580).

On a clean, Ubuntu 20.04 install using bash, I am unable to replicate this:

sudo snap install --classic emacs
emacs --daemon
# this works fine
emacsclient -t -q .bashrc

If we try with zsh:

sudo apt install zsh
# logout and log back in via:
ssh -Y4t server zsh --login -i
server% /snap/bin/emacs --daemon
# this also works fine
server% /snap/bin/emacsclient -t -q .bashrc
alexmurray commented 3 years ago

I pinged the downstream discussion to see if they can join in here to help debug this further https://emacs.stackexchange.com/questions/59656/emacsclient-unable-to-connect-to-daemon-under-snap-installation-of-emacs#comment93658_59656

bbatsov commented 3 years ago

Thanks for the swift response!

avatar-lavventura commented 3 years ago

Hello @alexmurray . I didn't know the current snap was https://github.com/alexmurray/emacs-snap.

When I was facing the error, I believe I I have used following ppa link :-( => sudo add-apt-repository ppa:kelleyk/emacs due to this documentation (https://linuxhint.com/ubuntu_emacs_installation/), which is actually a pretty new documentation. I have also followed this guide https://askubuntu.com/a/1238505/660555 .



$ uname -a
Linux 4.15.0-111-generic #112-Ubuntu SMP Thu Jul 9 20:32:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:    18.04
Codename:   bionic

$ sudo apt install snapd
$ sudo snap install emacs --classic
emacs 26.3 from Alex Murray (alexmurray) installed
$ sudo ln -svf /snap/bin/emacs /usr/bin/emacs
/usr/bin/emacs => /snap/bin/emacs
avatar-lavventura commented 3 years ago

When I added following lines into .emacs. Any paste operation(C-w) becomes very slow, I am not sure it is related to network issue or emacs itself.

(xclip-mode 1) 
(custom-set-variables '(x-select-enable-clipboard t))
alexmurray commented 3 years ago

@avatar-lavventura So it sounds like the snap version of emacsclient is working now? Can this issue be closed? If you are having other problems which are specific to the snap version of emacs, please feel free to open another issue and we can try and resolve that too.

avatar-lavventura commented 3 years ago

@alexmurray Yes snap version of emasclient is working without any problem, and issue can be closed.

=> Thanks for reaching out to help.

alexmurray commented 3 years ago

Excellent - I will close this issue then.

nealmcb commented 2 years ago

In my case the problem was that I hard-coded the location of the executable. Rather than /usr/bin/emacsclient, I now find it at /snap/emacs/1161/usr/bin/emacsclient.

alexmurray commented 2 years ago

@nealmcb instead you should use the path /snap/bin/emacsclient - this ensures the snap launches with the correct environment setup etc.