From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Reuben Thomas Newsgroups: gmane.emacs.bugs Subject: bug#25082: [PATCH] Add support to emacsclient for command-lline options in ALTERNATE_EDITOR/--alternate-editor Date: Fri, 9 Dec 2016 13:44:41 +0000 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1142b638c4ef8a054339f443 X-Trace: blaine.gmane.org 1481291126 31184 195.159.176.226 (9 Dec 2016 13:45:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 9 Dec 2016 13:45:26 +0000 (UTC) Cc: 25082@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 09 14:45:18 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cFLUB-0006Si-6U for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Dec 2016 14:45:15 +0100 Original-Received: from localhost ([::1]:46842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cFLUD-00007S-Db for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Dec 2016 08:45:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cFLU1-0008DA-Fu for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2016 08:45:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cFLTy-0003lO-SU for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2016 08:45:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48190) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cFLTy-0003lE-O8 for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2016 08:45:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cFLTy-0000Ws-EY for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2016 08:45:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Reuben Thomas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Dec 2016 13:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25082 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 25082-submit@debbugs.gnu.org id=B25082.14812910901999 (code B ref 25082); Fri, 09 Dec 2016 13:45:02 +0000 Original-Received: (at 25082) by debbugs.gnu.org; 9 Dec 2016 13:44:50 +0000 Original-Received: from localhost ([127.0.0.1]:35356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cFLTm-0000WB-D6 for submit@debbugs.gnu.org; Fri, 09 Dec 2016 08:44:50 -0500 Original-Received: from mail-lf0-f41.google.com ([209.85.215.41]:34954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cFLTk-0000Vw-CB for 25082@debbugs.gnu.org; Fri, 09 Dec 2016 08:44:49 -0500 Original-Received: by mail-lf0-f41.google.com with SMTP id b14so273741lfg.2 for <25082@debbugs.gnu.org>; Fri, 09 Dec 2016 05:44:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tr0vUUK8Zau4OmX7vyssRA7CGPUWDMUiLvChxZdnKos=; b=gUZAqSQtuYQIUSiILXQfIPKJqhPYD3nISRirQjdPQfaoJDx6v/bJCLf15NO/WT2yvV 4l+3+6e1n1pwfkPxfyjbC1mkFHyNasmXXjpopTsvr53+H1ulwyjfvnQfK6c+AJTgHAQP eV8z9jowyNu4fONR5IxkQZoZbCIMny+pTeDC4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tr0vUUK8Zau4OmX7vyssRA7CGPUWDMUiLvChxZdnKos=; b=ez/67q4g6xBajHlxiqBkRYYC3yiltVyZ0io2EmR7T8cfIZIa+oYsa7IT4rH22iAbbj rYzjdfH2XxfJ53GCcCuB/avRvDtpgIPbb1jUiTCPBuplHzK2KHamvs0cuVctFDZvtot8 Si1O2bKc/ihJb0dZu/el/NPhdsLAguxhnTzwW1g2FFWCaxpu9AF8xwsLeLcpCQ58y2at EelO5DE7a0rgX4SvklqSF29hoVgfENWGUtGE8rf2NhllITSkl9XNJ0D0V1KgU38hONcV ioz54xalF8rKICpTYcd2GrORvnNqenpXtC0Z1adiB8j/DCauzvR5AV5f9O7c2Z35l5DB /nnw== X-Gm-Message-State: AKaTC02CAdbPtitbflqzSqsWuHENqg2d4y10sMjDGtS2FSrwEbo+sTBdVLTh21j3mmq1Yl6wBkS3jN3mngSNS4cg X-Received: by 10.46.0.87 with SMTP id 84mr32834770lja.1.1481291082287; Fri, 09 Dec 2016 05:44:42 -0800 (PST) Original-Received: by 10.25.190.2 with HTTP; Fri, 9 Dec 2016 05:44:41 -0800 (PST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:126770 Archived-At: --001a1142b638c4ef8a054339f443 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 8 December 2016 at 23:10, Glenn Morris wrote: > Reuben Thomas wrote: > > > The attached patch adds support to emacsclient for command-line options > > when specifying the alternate editor, so that for example one can now > say: > > > > ALTERNATE_EDITOR=3D"emacs -Q -nw" > > Obvious question: what happens if eg one wants to specify an absolute > file name for the alternate editor, and it contains spaces? > With my current implementation, that wouldn't work. I guess this would be most likely to be a problem on Windows? > implemented the feature when I found that it didn't work as I expected; > > other similar environment variables with which users may be familiar, > such > > as EDITOR and VISUAL, already work like this. > > Do you have a citation for that being how eg EDITOR is intended to work? > =E2=80=8BNo. The documentation in environ(7) just says: EDITOR/VISUAL The user's preferred utility to edit text files. However, I can't find a program that interprets it as a literal filename. For example, Debian's sensible-editor editor-wrapper script does exactly what I just did. If I set export EDITOR=3D'"spacey editor"' it complains it can't find a program called: "spacey If I do export EDITOR=3D"emacsclient -c" it works nicely. So it doesn't parse quotes specially. However, that's not cross-platform. I would not be averse to adding more sophisticated parsing (as I don't think that would confuse users), but I'd rather not have to write a lot more error-prone C to achieve that. I had a look in gnulib but couldn't find anything. If there's some code I could lift from bash or something, that'd be ideal. --=20 http://rrt.sc3d.org --001a1142b638c4ef8a054339f443 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On = 8 December 2016 at 23:10, Glenn Morris <rgm@gnu.org> wrote:
Reuben Thomas wrote= :

> The attached patch adds support to emacsclient for command-line option= s
> when specifying the alternate editor, so that for example one can now = say:
>
> ALTERNATE_EDITOR=3D"emacs -Q -nw"

Obvious question: what happens if eg one wants to specify an absolut= e
file name for the alternate editor, and it contains spaces?

With my current implementation, that wouldn't work. I guess this would= be most likely to be a problem on Windows?

> im= plemented the feature when I found that it didn't work as I expected; > other similar environment variables with which users may be familiar, = such
> as EDITOR and VISUAL, already work like this.

Do you have a citation for that being how eg EDITOR is intended to w= ork?

=E2=80=8BNo. The documentation in environ(7) just says:

=C2=A0 =C2= =A0 =C2=A0 =C2=A0EDITOR/VISUAL
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 The user's preferred utility to = edit text files.

However, I can't find a progr= am that interprets it as a literal filename.

For example, Debian's sensible-editor editor-= wrapper script does exactly what I just did. If I set

export EDITOR=3D'"spacey editor"= '

it complains it can= 't find a program called: "spacey

If I do

export EDITOR=3D"emacsclient -c"

it works nicely. So it doesn't parse quotes specia= lly. However, that's not cross-platform.

I would not be averse to adding more sophisticated par= sing (as I don't think that would confuse users), but I'd rather no= t have to write a lot more error-prone C to achieve that.

I had a look in gnulib but couldn't = find anything. If there's some code I could lift from bash or something= , that'd be ideal.

--
--001a1142b638c4ef8a054339f443--