help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using emacsclient -t as $EDITOR from within Emacs


From: Felix Dietrich
Subject: Re: Using emacsclient -t as $EDITOR from within Emacs
Date: Fri, 06 Sep 2013 01:36:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Nikolai Weibull <address@hidden> writes:
> Invoking emacsclient -t from shell-command gives me
>
> emacsclient: could not get terminal name
>
> It seems that ttyname (fileno (stdio)) fails, which doesn’t seem
> unreasonable, I suppose, but I was wondering how I should get around
> this.  I want to be able to execute commands that invoke $EDITOR,
> which I’ve set to a shell script that invokes emacsclient -t, from
> within Emacs (for example, from Dired) that’s running as a server and
> so far I’m only either failing with errors or locking up my terminal.

If you can leave off the parameter '-t' emacsclient will simply open the
file on the emacs-server.  You can than edit the file in you current
emacs window in you text-shell, or you could if your terminal wouldn't
lock.  Adding an ampersand '&' to the COMMAND string passed to
`shell-command' will run it asynchronously so that you will be able to
continue editing while your command is running in the background, which
it will, because it is you trying to interactively edit a file.

When working with a file opened by emacsclient type 'C-x #' in the
file's buffer to indicate to emacs that you are done editing.  Emacs
will than ask you whether you want to save the changes and notify the
waiting emacsclient that you are done; emacsclient will now exit.
Alternatively use '--no-wait' to make emacsclient exit immediately after
opening the file on the server.

--
Felix Dietrich



reply via email to

[Prev in Thread] Current Thread [Next in Thread]