17 votes
Accepted

start emacsclient with focus from command line

You might be able to use the server-switch-hook and raise the frame. Something like: (add-hook 'server-switch-hook #'raise-frame) If that leaves you without focus on the new frame you might try ...
glucas's user avatar
  • 20.6k
16 votes

Emacs not responding to keyboard input

I had the same issue for years. It actually seems (at least in my case) to be an IBus issue (IBus allows to input multiple languages). When the keyboard stops responding in Emacs, typing that command ...
mikael-s's user avatar
  • 401
15 votes
Accepted

Emacsclient: One single emacs process all the time from start up & never close & better hide GUI

I do this by starting an emacs daemon when I login. Where you put this command depends on your desktop manager. I use i3, which is configured to run a script on login that includes the following: ...
Tyler's user avatar
  • 22.3k
15 votes
Accepted

less psql, more emacs

Emacs has in-built support for many databases, including Postgres. M-x sql-postgres RET
offby1's user avatar
  • 310
14 votes

Setting up emacsclient on MS windows

I am not so sure about the advice in the emacswiki page. What you want to do is to the following: Launch an emacs client connected to the running emacs server. If the emacs server is not running, ...
Angelo's user avatar
  • 301
12 votes

Run emacs GUI from emacsclient

If "start emacs gui in a similar fashion" is hoping to create a gui frame backed by the same daemon, then alias ec="emacsclient --create-frame" will instantiate another emacs frame backed by the ...
dgtized's user avatar
  • 4,199
9 votes
Accepted

How to install GNU Emacs on Windows 10 Pro?

Some third-party Windows package managers offer a straightforward installation of GNU Emacs on Windows 7+. Notes: Chocolatey requires an administrative shell access, whereas Scoop does not and makes ...
andselisk's user avatar
  • 208
9 votes
Accepted

Why emacsclient say to quit with C-x 5 0?

This is explained in the manual here: C-hig (emacs)emacsclient Options RET The new graphical or text terminal frames created by the ‘-c’ or ‘-t’ options are considered “client frames”. Any new ...
phils's user avatar
  • 51.1k
9 votes

Emacs client can't find server in terminal

Make sure you are using the same version of emacs and emacsclient. When my system emacsclient is used instead of my custom build emacs, I'm getting a similar error: $ /usr/bin/emacsclient --version ...
Toon Claes's user avatar
8 votes

What is the difference between standalone version of emacs and the one that runs inside terminal?

Some packages managers provides two different Emacs, emacs and emacs-nox. The core is the same and behave in a very similar way. The nox version (no X means without X11 support) and should be ...
smonff's user avatar
  • 1,589
8 votes
Accepted

What is the use for server-edit (C-x #)

emacsclient waits for emacs server. When you do server-edit, the server notifies emacsclient to terminate. It all depends on what you are going to do. In chrome I use the 'edit with emacs' extension, ...
dmg's user avatar
  • 659
8 votes
Accepted

How to open a file in another window by clicking on a file in my window manager?

Run this in terminal (copy-paste it, then press Enter): cat - <<EOFEOF > ~/.local/share/applications/my_emacsclient.desktop [Desktop Entry] Name=my Emacsclient Exec=/usr/bin/emacsclient --...
Microsoft Linux TM's user avatar
8 votes
Accepted

How to get the PATH from the SHELL

No, you don’t want to use -i because you’re not launching an interactive shell. That is, this shell will not be connected to a terminal that the user can type in. It is instead going to be connected ...
db48x's user avatar
  • 18.1k
7 votes
Accepted

print unquoted output to stdout from emacsclient

It seems that emacsclient is the wrong way to do what I want. I thought I could not use emacs --batch because I wanted to get "live" info from my running emacs instance. The missing piece of the ...
Colin Fraizer's user avatar
7 votes

less psql, more emacs

In addition to offby1's answer (which is what you were asking for) also take note of: https://www.emacswiki.org/emacs/CategorySql which covers sql-mode and sql-interactive-mode in general. https://...
phils's user avatar
  • 51.1k
7 votes
Accepted

Why are emacsclient and emacs separate programs?

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,...
Harald Hanche-Olsen's user avatar
6 votes

Enable smerge-mode for already opened file

This is what I have in my init file : (defun smerge-try-smerge () (save-excursion (goto-char (point-min)) (when (re-search-forward "^<<<<<<< " nil t) (require '...
YoungFrog's user avatar
  • 3,526
6 votes

emacsclient of 24.4 does not work on Yosemite

May well be due to you're using the wrong emacsclient. I had the same (i.e., can't find socket and/or -error Unknown&_command:&_THEFILENAME Turned out I used /usr/bin/emacsclient, whereas my ...
plijnzaad's user avatar
  • 161
6 votes

Emacs as server (daemon) struggles

Closing The Client Keep in mind that when you are running an emacs daemon, the frame in which you are actually editing is simply a client of the server. The file is not buffered in the client, it is ...
mwood's user avatar
  • 101
6 votes
Accepted

Determine graphical display on startup for emacs server/client

The hook on after-make-frame-functions runs after the frame is created but before it's selected (if it ever becomes selected). So you're asking whether the currently selected frame is on a graphical ...
Gilles 'SO- stop being evil''s user avatar
6 votes
Accepted

How to check for emacs being initialized in daemon mode?

I think daemonp is what you're looking for. From its docstring: Return non-nil if the current emacs process is a daemon. If the daemon was given a name argument, return that name.
Kyle Meyer's user avatar
  • 7,024
6 votes
Accepted

Closing emacsclient after quitting calc?

You could use hook calc-end-hook to hook delete-frame. emacsclient -t --eval '(progn (add-hook (quote calc-end-hook) (lambda () (delete-frame))) (calc nil t))'
Marco Wahl's user avatar
  • 2,876
6 votes

Access contents of buffers from outside

It is possible to read and write the contents of a buffer with the combination of an emacs server and an emacsclient. (If you want you can run the server as daemon.) Demo: Start emacs. M-x server-...
Tobias's user avatar
  • 33.2k
6 votes
Accepted

emacsclient GUI has small fonts

The things that I did on the @DoMiNeLa10's advice: Set (add-to-list 'default-frame-alist '(font . "SF Mono-14")) instead of (set-face-attribute 'default nil :font "SF Mono-14") (set-frame-font "...
j3k's user avatar
  • 111
6 votes

Font and frame configuration in daemon mode

To do its job, this code apparently needs to run once after the first frame has been created. How can I achieve that? The standard hooks for this are listed under (info "(elisp) Standard Hooks&...
Basil's user avatar
  • 12.4k
6 votes
Accepted

How to suppress `When done with a buffer, type C-x #` warning message?

The only way to avoid that message with Emacs earlier than 28.1 is to invoke emacsclient with the -n (--nowait) option. Starting with Emacs 28.1 (basically, current upstream at the time of writing), ...
NickD's user avatar
  • 29.8k
5 votes
Accepted

emacsclient directly start eshell command command line

Surprisingly (at least to me), the -f flag means different things to emacs and emacsclient. To emacs, it means: -f FUNCTION --funcall=FUNCTION Call Lisp function FUNCTION. If it is an ...
Tyler's user avatar
  • 22.3k
5 votes
Accepted

How to collapse undo history?

Edit: emacs-29.1 adds a with-undo-amagamate macro see commit. Here is an with-undo-amalgamate macro that uses Emacs-26 change-groups feature. This is atomic-change-group with the following changes: ...
ideasman42's user avatar
  • 8,796
5 votes
Accepted

What is the difference between standalone version of emacs and the one that runs inside terminal?

They differ by the calling environment. Small dictionary: Emacs frame - what ordinary people call window. Emacs window - a place in Emacs where you see some buffer(start emacs, and run C-x 2 to see ...
MatthewRock's user avatar
  • 1,483
5 votes

Call emacsclient from a program called by Emacs

The solution is to run texdoc within an asynchronous process. The best way to do that is probably to use start-file-process instead of shell-command-to-string (which is a handy function for quick&...
Stefan's user avatar
  • 26.4k

Only top scored, non community-wiki answers of a minimum length are eligible