3

I really like the client-server structure of emacs. However, I feel uncomfortable to run 'emacsclient' to attach to running emacs server. Is there any specific reason that emacs seperated emacsclient from emacs binary? Is it possible to integrate them without hacky-dirty shell aliasing?

8
  • 5
    I don't understand this question. Emacsclient is a tiny program with a very simple job to do. Emacs, on the other hand, is a big, complicated program. One could probably teach it to act like emacsclient, but that would defeat the entire purpose, would it not? Feb 18, 2019 at 12:41
  • 2
    How are you proposing that such integration would work for the end user? You seem to have some particular expectations, but I can't figure out what they would be.
    – phils
    Feb 18, 2019 at 13:28
  • 1
    @HaraldHanche-Olsen a lot of programs, especially in the context of distributed systems have only one binary, that assumes different roles, depending on how it is called. For example, consul, jenkins, selenium and lots and lots more act this way. Essentially, you'd expect that whenever you run emacs it'd act like emacsclient, while you'd need to run something like emacs -hub to start the server. My guess is that it's too much work to prevent all extra loading in emacs to turn it into emacsclient.
    – wvxvw
    Feb 18, 2019 at 15:04
  • @HaraldHanche-Olsen can you rewrite your comment as an answer?
    – user12563
    Feb 18, 2019 at 16:58
  • 1
    Why do you feel uncomfortable running emacsclient? Also, Emacs doesn't have to be used in a client-server structure. The way it is designed you can use it as multiple independent programs, or multiple clients connected to a server.
    – Tyler
    Feb 18, 2019 at 20:25

1 Answer 1

7

Emacs is a big, complicated program. It must know how to handle large text files, and to interact with users in a graphical user interface or in a text terminal. It can display graphics. On my machine, it loads 34 libraries just in order to start. The binary is 15 megabytes. Many people, myself included, only start emacs once in a rare while, and hardly ever quit the program, except when the computer needs to be rebooted for some other reason.

Emacsclient, on the other hand, is a small, simple program. On my computer, it is 37 kilobytes, about 0.2% the size of the full emacs, and it loads a single library. As a result, it will load and execute with no perceptible delay. This is because it has a very simple task to perform: Namely, to talk to the running emacs instance and tell it what file the user wishes to edit and how, optionally waiting for the user to finish editing the file. Thus, it makes perfect sense for emacsclient to be its own program.

In any case, it does not enlarge the emacs distribution by much. For emacs is much more than just the emacs executable! It is also a large number of elisp files – 1466 of them on my system right now, plus various documentation files and other data. Hence, throwing in an extra executable like emacsclient does not make the whole package noticably more complex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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