reddit / emacs

Emacsclient and org-capture in i3wm closes unexpectedly

jakub37 · 2022-02-28 19:35
**tl;dr: Org-capture window closes in i3wm for no reason, how to debug or identify the problem?** Hi! A beginner user, I use emacs-client `26.3` and Emacs `27.2` with org-capture on Ubuntu 20.4 running i3wm. (Could version mismatch be the problem?) I append text of an org-capture template to an org file. I probably misconfigured something and have these problems: 1. Launching a new window of org-capture from i3wm (triggered by a keystroke) works, but the window closes unexpectedly after some 10-50 seconds, often before I finish writing a note in the template and the work is lost. But if I type fast enough and complete C-c C-c before crash then all is good. **What would be the log file I should look into? What could cause this?** In my I3wm I have the following command to open the org-capture window: bindsym $mod+y exec "emacsclient -e '(make-orgcapture-frame)'&" 2. Invoking the same command which opened org-capture window from i3wm keystroke does not work in the terminal. The error I get is: ~ emacsclient -e '(make-orgcapture-frame)' emacsclient: can't find socket; have you started the server? To start the server in Emacs, type "M-x server-start". Meanwhile Mx server-start in my Emacs (Spacemacs) gives me: Warning (server): Unable to start the Emacs server. There is an existing Emacs server, named "server". To start the server in this Emacs process, stop the existing server or call ‘M-x server-force-delete’ to forcibly disconnect it. 3. Invoking **Mx org-capture** in a running Emacs window runs great, the windows does not die. But this method is slower for my use case where I surf the web/watch tutorial and open the Emacs window only occasionally to take a note. I also take screenshots with Mx org-download-screenshot which forces me to have my (ideally popup) Emacs window in the same i3wm workspace as the content being captured to a screenshot. I would appreciate your help a lot. I am a Neovim user here taking babysteps in Emacs journey, and it has been amazing tool with org-mode for my language and programming learning with Anki integration. (approach described by one generous person [here](https://yiufung.net/post/anki-org/)) Thank you. Jakub
grimscythe_ · 2022-02-28 21:04
I'm sorry, but how do you run emacs-client and emacs in two different versions?!?!? Didn't even know it was possible. What distro are you on? How do you even do that? Edit: Oh and get them both on the same version. The client doesn't know about the running Emacs server because it looks at a socket on a version of Emacs that is likely on a different path.
jeffk · 2022-03-03 01:04
I had some thing similar happen with awesome wm. Certain key combinations would close the emacs daemon and client. It seemed to be related to the longstanding gtk bug, On openSUSE, starting emacs client with `EMACS_TOOLKIT="x11"` equivalent to building with `-with-x-toolkit=lucid` worked.