1

I have the following in .bashrc.

export ALTERNATE_EDITOR=""
export EDITOR="emacsclient -t"

When I run, for example

emacsclient something.tex &

when running X, in a Konsole terminal (Konsole is the KDE X term client), the file opens up inside the Konsole terminal displaying the file (as though I had called -nw), when it should start up an emacs X frame. Also, the file is not normally editable. I cannot type, and when enter it behaves like I am still in the terminal, except the cursor jumps around on the screen when I try to type, and echo $TERM still gives xterm. Also, I'm seeing stuff like Auto-saving...done at the bottom of the terminal. Checking the processes gives

$ ps aux | grep emacs
faheem   31260  0.0  0.0  12516   800 pts/2    S    17:40   0:00 emacsclient something.tex
faheem   31269  0.2  0.1 230896 27408 ?        Ss   17:40   0:01 emacs --daemon

After further investigation, it seems the backgrouding &. Is causing the problem. Leaving it out causes emacs to open in -nw mode. But I want a full X emacs frame. Why is it not doing that?

I see the -c option says

-c, --create-frame
          create a new frame instead of trying to use the current Emacs frame

and this does create a emacs X frame, but if there is no existing frame, why doesn't it create one instead of opening in the terminal?

2

Use the -c option to force opening a new graphical frame.

  • So I discovered. See my most recent edit. But why doesn't it do this by default? – Faheem Mitha Nov 15 '14 at 12:45
  • You're free to read server.el and scratch your head why it's behaving that way by default. If you find something that feels bug-like, you can use M-x report-emacs-bug to discuss it on the debbugs mailing list. – wasamasa Nov 15 '14 at 12:46
  • Well, presumably it has some reason for behaving this way. I just wonder what it is. – Faheem Mitha Nov 15 '14 at 13:03
  • @FaheemMitha well, if you don't have a graphical frame opened and you invoked the command in a smart terminal, the safe assumption is that you want to edit the file right there. If you do have a graphical frame open, I think the client will default to using that. – Malabarba Nov 15 '14 at 15:09
  • @Malabarba that isn't consistent with the behavior of the emacs command itself. emacs creates a frame. why doesn't emacsclient? By the principle of least surprise, it should, imo. – Faheem Mitha Nov 15 '14 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.