From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.help Subject: Re: How to reliably edit a file from within Emacs Lisp and return a string? Date: Fri, 23 Aug 2019 16:14:02 +0200 Message-ID: References: <20190822213103.GA26548@protected.rcdrun.com> <20190822224604.GA10900@protected.rcdrun.com> <83o90gb9u7.fsf@gnu.org> <20190823140145.GA28153@protected.rcdrun.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="124511"; mail-complaints-to="usenet@blaine.gmane.org" Cc: help-gnu-emacs@gnu.org To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 23 16:14:36 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i1AKp-000WGT-Jn for geh-help-gnu-emacs@m.gmane.org; Fri, 23 Aug 2019 16:14:35 +0200 Original-Received: from localhost ([::1]:56548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i1AKo-000800-2c for geh-help-gnu-emacs@m.gmane.org; Fri, 23 Aug 2019 10:14:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47195) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i1AKO-0007w9-W4 for help-gnu-emacs@gnu.org; Fri, 23 Aug 2019 10:14:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i1AKN-0005aA-1x for help-gnu-emacs@gnu.org; Fri, 23 Aug 2019 10:14:08 -0400 Original-Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:55357) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i1AKM-0005Z9-Rj; Fri, 23 Aug 2019 10:14:06 -0400 Original-Received: by mail-wm1-x333.google.com with SMTP id f72so9049787wmf.5; Fri, 23 Aug 2019 07:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:in-reply-to:message-id:mime-version:content-transfer-encoding; bh=Je2LKImt+O5nZir6C8eRLSPjgklYnfkyl5Fn89T4aOg=; b=C+YC3ASNbpHxLbxIvBrsaU5a29vkg8990kXtMY0O0ECd+rijwZYEfjHReedgYrCKwm jsLm3sQ0ercTE9WR+Vy0Dj7NPYYKm2w11neCXliwrYZQ0lfFPWBQRsPxSO5Z5oRmQHFT K/6KDksiKsKPLg1jgcb62m2IiJ+25gu531tkDecg7NXOSP7rGJgH4Mi5iDlulnM0xEWE z6TI4HwcS4jgIIU3av5gi+x7jOvT9LJYkwJhFwYWQnjA9ui8B2adCFObKdObmibDtVxJ Fq4T+8it3raIsKZL6iUan61v0tdl/YE0yVcA9WaPJ39aj+mBwjZ4a2VTesz/KLoHABFe lRtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=Je2LKImt+O5nZir6C8eRLSPjgklYnfkyl5Fn89T4aOg=; b=jryQQbllAso4wNA2D4dVhyf0G+06stVPXtxzLQchow+KYLjx3ABzgGJkHyTY4Ft2KA B+ryLxa/p7wfzEw3rnrgHoftZxHU4QXEYlGil6Ma/6Ntx/NPR8o0rvgMSbPlx8bcxVDN pR7FhxhW6vrZFUzQNrN4OhqlpnVrAwTQWBjqQdey4/5hy46QahPzKKBCZ2Jqiw6of+1f YcQ4lNBbDHUGQUyXnNKxvYPcCKzt0jy6JvazyTT5hpQ2SESbh8290e5/IDuSQFL2asBQ hfklMo10CPcY3Eh1K8XTZOtGt1ngCOQO61FquSSlmj9FV4u5v029yvLGTGkbtm8UbLMC hiVA== X-Gm-Message-State: APjAAAVgYhEkEF7QM7czk7/fdelSVNguygrTt9nhAUMm5IjPprIfvrjU eW+nSNY5kffaGChFtmsZ4o3jsQQ2xmY= X-Google-Smtp-Source: APXvYqzuICvqilIesDJ9MpPQr8HEl9wbqdr/8EkFh0tabe2AjPYSWEeY5ZCOcRlmzWNHd0xd/jnL1g== X-Received: by 2002:a1c:a6cd:: with SMTP id p196mr5429701wme.111.1566569644807; Fri, 23 Aug 2019 07:14:04 -0700 (PDT) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id d69sm2388417wmd.4.2019.08.23.07.14.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2019 07:14:03 -0700 (PDT) Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: <20190823140145.GA28153@protected.rcdrun.com> (Jean Louis's message of "Fri, 23 Aug 2019 16:01:45 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::333 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.org gmane.emacs.help:121353 Archived-At: >>>>> On Fri, 23 Aug 2019 16:01:45 +0200, Jean Louis sai= d: Jean> I would be happy if I can do something like: Jean> (defun emacsclient-edit (file) Jean> (shell-command (format "emacsclient %s " file)) Jean> (file-to-string file)) Jean> But that does not work within Emacs itself. Would that work, I wo= uld be fine. Jean> It is somehow strange that I can run emacsclient from outside Jean> Emacs and edit file and know that emacsclient finished its job, Jean> and read the string from file, and that I cannot do the same from Jean> Emacs. I=CA=BCd investigate the 'with-editor' package, which lets you use emacsclient to talk back to the emacs it=CA=BCs run from. Robert