emacs-eldev / eldev

Elisp development tool
https://emacs-eldev.github.io/eldev/
GNU General Public License v3.0
226 stars 17 forks source link

`eldev emacs` misbehaves if nested Emacs is started in terminal mode #89

Closed lread closed 1 year ago

lread commented 1 year ago

Thanks!

First, thanks for creating eldev, it seems like a really awesome idea and tool.

Context

I am using eldev for the first time. I am trying to replicate an issue I see with https://github.com/bbatsov/adoc-mode. The adoc-mode project is setup for, and recommends eldev.

I am normally a doom emacs user and use evil key bindings. I am not terribly familiar with emacs default key bindings and my confusion might be related to this.

Versions

eldev 1.4.1 Emacs 28.2 Linux Pop!_OS 22.04

What I've tried

I'm playing/learning in the adoc-mode project:

git clone https://github.com/bbatsov/adoc-mode
cd adoc-mode

As a sanity test, I tried eldev test, it seems to work great.

But then, my idea is to run eldev emacs to interactively reproduce my issue with adoc-mode.

When I run eldev emacs, I see:

image

The terminal seems a bit confused? If I type C-x C-f to open a file, I see ^X^F but no prompt for a file. The only command that seems to work for me it C-x C-c.

So I'm wondering:

  1. Have I misunderstood eldev emacs?
  2. Am I missing some config or terminal setting? I do see I have env var TERM=xterm-256color, are there other env vars I should be checking?

Any tips/help you might provide to this eldev noob are appreciated.

doublep commented 1 year ago

Frankly, I never thought about running Emacs in a terminal mode. I can reproduce what you see if I execute eldev emacs -nw, but normally eldev emacs launches a fresh Emacs in a window (as in XWindows) mode for me. I have also tried that in adoc-mode now, worked like I would expect.

If you just type emacs in the command line, does it launch it in terminal mode? It looks like Eldev is kinda unprepared for that. I will look if I can do something about that, but that's not granted because of convoluted stdin/out/err handling in Elisp (Eldev is basically 99% Elisp).

lread commented 1 year ago

Thanks so much for the speedy reply @doublep!

I used to run emacs in UI mode when I was on macOS. I'll figure out how to build emacs with X support on Linux, retry and report back.

lread commented 1 year ago

Ok, I reconfigured my emacs 28.2 build with:

./configure --without-compress-install \
  --with-native-compilation \
  --with-json \
  --with-x \
  --with-xwidgets \
  --with-x-toolkit=gtk3 \
  --without-libgmp

The important bit is --with-x (and maybe --with-x-toolkit but the default might be gtk3 anyway).

And now eldev emacs seems to work! image

Would you like me to PR a note in the eldev docs about eldev emacs requiring an emacs built with X support?

lread commented 1 year ago

FWIW, I don't know how popular using emacs in terminal mode is. Maybe I was an outlier. I've now switched to using emacs in UI mode.

doublep commented 1 year ago

Would you like me to PR a note in the eldev docs about eldev emacs requiring an emacs built with X support?

No, thank you, I'll just add this to documentation myself. Also, in future Eldev will warn about unsupported terminal mode or something, so please don't close the bug yet. (The problem is Eldev itself runs in batch-mode Emacs and it looks like it is impossible to start an "inner" Emacs in terminal mode from that. Or, rather, starting is not a problem, but making it work properly appears to be.)

FWIW, I don't know how popular using emacs in terminal mode is. Maybe I was an outlier. I've now switched to using emacs in UI mode.

No idea, never used it myself other than maybe 3 times on some remote machines without X. No-one ever complained about this yet, but Eldev itself is not that popular, so lack of complaints here doesn't say much.

doublep commented 1 year ago

Closing this as done. As of 1.5 Eldev will simply refuse to start terminal-mode Emacs and quit right away before breaking the terminal, with a hopefully somewhat useful diagnostic message. Would be nice to support that mode instead, of course, but I simply not see how that would be possible (currently).

lread commented 1 year ago

Thanks @doublep, I think that messaging will help confused newbies like me!