From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: Adding with-editor to Emacs? Date: Sun, 03 Sep 2023 16:36:17 +0200 Message-ID: <87zg23tjby.fsf@ledu-giraud.fr> References: <85msy98sni.fsf@elpa.gnu.org> <87r0nidkmt.fsf@bernoul.li> <83bkelc1p1.fsf@gnu.org> <87fs3xwzxm.fsf@bernoul.li> <837cp9bur7.fsf@gnu.org> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11815"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Jonas Bernoulli , stefankangas@gmail.com, emacs-devel@gnu.org, rms@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 03 16:37:29 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qcoEC-0002nu-7z for ged-emacs-devel@m.gmane-mx.org; Sun, 03 Sep 2023 16:37:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcoDD-0004b8-BP; Sun, 03 Sep 2023 10:36:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcoDB-0004XU-Dc for emacs-devel@gnu.org; Sun, 03 Sep 2023 10:36:25 -0400 Original-Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcoD8-00023d-IG; Sun, 03 Sep 2023 10:36:24 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=Cf1CmQQ8 ue3SVWMHGCizMZzos9e01isnV6+HF1FTpf8=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=BIXe+GyLwmY04CsxzhNjm6bVT8YDZE AUpLlFv2WTvp41bMjadJ7aPUu9fNEA/ngO0jVvTtwRwH1LeccsNX28Bw== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=Cf1CmQQ8ue3SVWMH GCizMZzos9e01isnV6+HF1FTpf8=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=vzFXcHdexpdTJSfK5iKRpKdduM+s/5U1/L5jE3 LIa1MUb1SxFlFOW9t7snIe+UTqeq8w/OFm5LKdpGMCwxb/DDEcV2jBV+REVh6nmmOzYEqL 49gQoFq7WSliMjK8hotBc8tp+vfvyVwpethwpwNaO/Sz3zyMht3fO/R+u9HCr0DPMgId9s 8eDZbrEEsnyQRH0MXWKI2Mtg7Q/02Tz15dX301ubAzTlkedzj5OgO+kgV722HAxOLMb5pZ ODfkaB6pYd/cybuGGN8c/8QReJ6t0cW5L1YiNfXaA4ykybJxzpJt3zRdaXaG+RkIfdNzt6 cGdnT33afdw7jZYjA/JimOWw== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id e8f27c95 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 3 Sep 2023 16:36:18 +0200 (CEST) In-Reply-To: <837cp9bur7.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 01 Sep 2023 21:42:20 +0300") Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:309976 Archived-At: Eli Zaretskii writes: >> From: Jonas Bernoulli >> Cc: emacs-devel@gnu.org, rms@gnu.org >> Date: Fri, 01 Sep 2023 19:44:53 +0200 >> >> Eli Zaretskii writes: >> >> > I'm probably missing something because if all we want is to allow >> > child processes to use the current Emacs session as their editor, we >> > just need to inject some environment variables into >> > process-environment when running those child processes, and start the >> > server. >> >> That's the core of what with-editor does. Additionally >> >> - It tries hard to find the correct emacsclient to use. > > See below: I don't think I understand why this has to be "hard". > >> - It implements a "sleeping editor". This is a shell script, which >> outputs a request on stdout and then waits to be told to return. >> With-editor use a process filter too look for that output and when >> it sees it, it responds in a similar fashion to server.el. This >> is useful because makes it possible to do this over Tramp. (I >> believe this could also be done using regular emacsclient+server.el, >> but that is difficult to setup and a security risk if not done >> correctly. > > If we want a better/safer client-server connections for remote hosts, > it should be handled in Tramp, I think. > >> - It provides some convenience functionality to use this from various >> shells running inside Emacs. > > Can you provide details? The above is too terse for me to understand > the functionality. Just my one 2 cents datapoint: I have this line in my init.el (add-hook 'eshell-mode-hook 'with-editor-export-editor) and now, I can do a standard Unix "crontab -e" or "vipw" to edit those special files from a remote eshell (be it via sudo, ssh whatever). -- Manuel Giraud