From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Felix Dietrich Newsgroups: gmane.emacs.help Subject: Re: Using emacsclient -t as $EDITOR from within Emacs Date: Fri, 06 Sep 2013 01:36:39 +0200 Organization: solani.org Message-ID: <87ob86hmd4.fsf@sperrhaken.name> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1378424491 13444 80.91.229.3 (5 Sep 2013 23:41:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Sep 2013 23:41:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 06 01:41:33 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VHjB6-0002nQ-NH for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Sep 2013 01:41:32 +0200 Original-Received: from localhost ([::1]:34252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHjB6-0006b3-5d for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Sep 2013 19:41:32 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Original-X-Trace: solani.org 1378424200 15802 eJwNy8EBwCAIA8CViiGhjCMo+4/Q3v8ImTpclHM4dfJJNDYTxnsikFsX7H4nZatuL1dOWcUfPxmwERY= (5 Sep 2013 23:36:40 GMT) Original-X-Complaints-To: abuse@news.solani.org Original-NNTP-Posting-Date: Thu, 5 Sep 2013 23:36:40 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-User-ID: eJwFwQkBwDAIA0BL5UmKHZqBfwm7Q9ComwQTi/36wdONObcUsw1CprOjxIQfY62zrxlQPRPhHopXh9T7AU8QFR4= Cancel-Lock: sha1:QpVg1IDlNtg3U43h27H9sOHVAVY= sha1:VNpQ6MwwzeUQZ1yc/jVMBa6crbg= X-NNTP-Posting-Host: eJwFwQERACAIA8BKIIxhHfDWP4L/iPJaZqESgjRW6puNbYdi0t/Ja8cfNwSGDTncBmjsDw2hECY= Original-Xref: usenet.stanford.edu gnu.emacs.help:201006 X-Mailman-Approved-At: Thu, 05 Sep 2013 19:41:23 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:93275 Archived-At: Nikolai Weibull 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