7

I'm trying to use emacs (23.2.1) in daemon mode. I started it as emacs --daemon and that works just fine. But whenever I try emacsclient -t somefile I first get a line of garbage (e.g., `1;25C2;'), then the file is displayed (with emacs's mode line), but I can't do anything. It hangs; cursor movement keys don't work; C-x # doesn't work; the only thing I can do is open another console and kill the process.

If I start emacs normally (by clicking on a launcher on the panel, or just running emacs) with (server-start) in the config, emacsclient file works just fine (i.e., loads the file in the graphical emacs instance). If I start emacs normally but use emacsclient -t file, I get the same problem with it hanging.

I'm using Debian 6/Xfce, kernel 2.6.32-5-686. $TERM is xterm, maybe that needs to be changed to something else? Is there anything else that's a likely culprit? I don't want to post my entire emacs config here because it's extensive, but if you really want to look through it it's here on github.

Thanks

9
  • Works For Me™. Does it work for you if you start Emacs with emacs -q (to skip your .emacs)? If not, what about emacs -Q (skips all installed packages)? What terminal emulator are you running emacsclient -t in, and does using another emulator make a difference? I suspect Emacs is sending an escape sequence that expects a response and not getting it, but the important data is the character before the 1, which doesn't get displayed. Run strace -o emacs.strace -s9999 emacs --daemon and post the resulting emacs.strace somewhere (it may be huge). Commented Apr 21, 2011 at 7:32
  • @Gilles: The emulator is whatever default ships with Debian 6/Xfce4, simply called "Terminal Emulator". In that, emacs -q --daemon doesn't fix it, but emacs -Q --daemon does. In LXTerminal, the -q option works fine; with just emacs --daemon in LXTerminal, emacsclient -t doesn't actually hang (I can still C-x # to exit) but it doesn't give me a cursor or allow me to actually do anything. Working on the strace thing now.
    – Wolf
    Commented Apr 21, 2011 at 11:59
  • @Gilles: ironhaq.tumblr.com/post/4803854323/…
    – Wolf
    Commented Apr 21, 2011 at 12:07
  • @Wolf: The trace is missing the good bits. My fault, can you do it again with strace -f -o emacs.strace -s9999 emacs --daemon? Also, to find out what this mysterious “Terminal Emulator” is, please run ps $PPID in it. Also, since the bug is apparently triggered by an installed package, run dpkg -S /etc/emacs*/site-start.d to get the list. Commented Apr 21, 2011 at 21:52
  • 1
    @Gilles: Thanks for all your help! I just wish I knew what we did to fix it.
    – Wolf
    Commented Apr 22, 2011 at 19:35

1 Answer 1

1

Looking at man emacsclient, I see that -t is the same as -nw and --tty, and they all do: open a new Emacs frame on the current terminal. If you just drop the -t, or replace it with -c, --create-frame create a new frame instead of trying to use the current Emacs frame it should work. I have (server-start) in my 'emacs, and my $EDITOR is set to "emacsclient", and it works for me. (Ubuntu 11.10, Gnu Emacs 23.2.1)

2
  • 4
    The original poster obviously wants the -t functionality. Commented Oct 1, 2011 at 22:42
  • having (server-start) in .emacs file wouldn't let to start multiple emacs daemon(s) each time an emacsclient opens a file?
    – alper
    Commented Feb 27, 2021 at 17:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .