24
votes
Accepted
How do I use emacsclient to connect to a remote emacs instance?
You cannot use emacsclient to connect to an Emacs instance running on a remote computer. This client-server concept is related to (local) processes, not network nodes. However, you can use various ...
24
votes
Accepted
How can I use my local Emacs client as the $EDITOR for remote machines I access over TRAMP?
[NOTE] this answer was heavily edited to follow the updates of with-editor developments. Most comments likely won't make much sense anymore. There are some new comments which do make sense.
Magit ...
20
votes
Accepted
Using daemon mode in Gnome 3
I'm using Ubuntu, so the location of the desktop file may be different but I think the contents should be similar.
$ cat ~/.local/share/applications/emacsclient.desktop
#!/usr/bin/env xdg-open
[...
15
votes
How to collapse undo history?
Interestingly enough, there appears to be no built-in function to do that.
The following code works by inserting a unique marker on the buffer-undo-list at the beginning of a collapsible block, and ...
15
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 ...
14
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:
...
14
votes
Accepted
less psql, more emacs
Emacs has in-built support for many databases, including Postgres.
M-x sql-postgres RET
13
votes
Accepted
How do I use emacsclient as EDITOR or VISUAL?
Set VISUAL to emacsclient -c (or some other variation without -n).
The option -n causes emacsclient to return as soon as it's contacted the running Emacs instance to tell it to edit the file. The ...
12
votes
How do I use emacsclient to connect to a remote emacs instance?
Probably not what you asked for but assuming you have ssh setup with X-forwarding, you could start emacsclient on the server and forward it to remote DISPLAY. (Disclaimer: code typed directly into ...
11
votes
Accepted
Is there any way to run a hook function only once?
I'm guessing that you are not really looking for a way to "execute the hook only once". I'm guessing that you are looking for a way to execute that particular function only once, whenever the hook is ...
10
votes
How to open a file with emacsclient from Thunar?
Thunar implements Freedesktop's desktop entry specification, so a .desktop entry is the answer you are looking for. Try saving this to $XDG_DATA_HOME/applications/emacs.desktop or $HOME/.local/share/...
10
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 ...
10
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, ...
9
votes
Accepted
How to prevent emacsclient starting a new frame every time?
Your included option of -c is causing this. Per the man page,
-c, --create-frame create a new frame instead of trying to use the current Emacs frame.
Remove this option from your command and ...
9
votes
emacsclient to access remote emacs server
I think one of the things unclear from the FAQ is the necessity that both server and client be resolveable from each other. You can see this thread from 2009. Eventually, back then I did get it to ...
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 ...
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 ...
8
votes
How do I use emacsclient to connect to a remote emacs instance?
This may be not what you want but just in case see if it can help you some way.
I usually work inside a virtual machine bootstrapped with Vagrant, I have my ~/.emacs.d directory synced between my ...
8
votes
Inserting org-style links from external program
Nothing in your function tells Emacs where to insert the text, you need to tell it where to go.
If you’d like Emacs to place this link in a buffer named BUFFER-NAME
(which you know will be open), you ...
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 ...
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, ...
8
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
...
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 ...
7
votes
Accepted
Open a frame for the first time (using `emacsclient -c`) showing other buffer than *scratch*
Check the manual for initial-buffer-choice
If non-nil, this variable is a string that specifies a file or directory for Emacs to display after starting up, instead of the startup screen. If its ...
7
votes
Accepted
Running code on emacsclient connect
It looks like you can run functions each time a new frame is created with after-make-frame-functions (see this question for a bit more information).
The code would look something like
(defun set-my-...
7
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 --...
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://...
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,...
6
votes
Emacsdaemon and Emacsclient on Mac
I really don't mind Emacs.app always running, but the fact that I couldn't close the window without accidentally killing the Emacs server was annoying. And even if you try really hard to kill the last ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
emacsclient × 297frames × 39
emacs-daemon × 39
server × 36
daemon × 25
terminal-emacs × 24
microsoft-windows × 15
buffers × 14
init-file × 13
osx × 13
org-mode × 10
spacemacs × 10
window × 10
x11 × 7
command-line-arguments × 7
linux × 6
bash × 6
key-bindings × 5
auctex × 5
debugging × 5
org-capture × 5
doom × 5
gui-emacs × 5
magit × 4
python × 4