Path: csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Luca Boccassi Newsgroups: gnu.bash.bug Subject: Re: [PATCH] Add nofirstword completion option Date: Tue, 12 Jun 2018 18:28:54 +0100 Lines: 77 Approved: bug-bash@gnu.org Message-ID: References: <20180518110611.5099-1-bluca@debian.org> <96bcb197-40d1-aac8-c214-c513a6db805d@case.edu> <1527068652.6997.5.camel@debian.org> <76b1d3fa-4cb1-3e70-d93c-ada07c04dfa2@case.edu> <1527082457.6997.14.camel@debian.org> <4ccfc554-15a9-2ec1-55e1-b2df687f0bee@case.edu> <1527270167.6997.22.camel@debian.org> <3a98f6c5-0f1e-54aa-491c-da7100430ce8@case.edu> <1527605096.6997.27.camel@debian.org> <1527860403.6997.72.camel@debian.org> <1528468856.6554.6.camel@debian.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-XDgExfQTbFrdqIpejZOA" X-Trace: usenet.stanford.edu 1528824548 16205 208.118.235.17 (12 Jun 2018 17:29:08 GMT) X-Complaints-To: action@cs.stanford.edu To: chet.ramey@case.edu, bug-bash@gnu.org Envelope-to: bug-bash@gnu.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:mime-version; bh=oos2+R3J7b78Pc1clJHKuOlRQ9H1Uh+962UowHVdfYA=; b=QUwiM2OEeixy/U5AEiUDpwxe2z2LsqxHCF+X9+1O688G343/Ns9lQns5IUf7tzrENT 3v+jCsTU+y5FAmiWjRHqKiWCmwVsuwcNxyKhoImjp+74orJhXRFp/U1GC7SMKVaVCJim 8cb4J4cMnmQmUXlHSk3wYBAsVeKWfA/Nz/XHUYbbIMtpVQTN0pjCu/FVgVGNweI4Vf+o LLVRCMDh4KlIzxs4QMZhpQ+pD3Xh22CBwMMusC6C4W4+L14f4Rolp6/OAgeCF5lJw4jK JzEd+awEJfA4+JuKNGYTY1MieumGOk99Y+WwWabE/GUMhKC2zHKqSIx5jKM0cAV5kU8B MBoQ== X-Gm-Message-State: APt69E18GeqlKqk7Vbepso6OsfoGrydthIvZZvb7E0/zYV5xHGdRJLkU EHhBRagoe7D8S1351IZVekugdVgJ X-Google-Smtp-Source: ADUXVKIy26Jgx/gp2IinhycnsAJcn2Yoa1hIb8U8iTnaSda+eIwjEUUrH2exsg0xSLMfQPygwMYLQA== X-Received: by 2002:adf:f98a:: with SMTP id f10-v6mr1060280wrr.105.1528824539271; Tue, 12 Jun 2018 10:28:59 -0700 (PDT) In-Reply-To: X-Mailer: Evolution 3.22.6-1+deb9u1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.194 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14233 --=-XDgExfQTbFrdqIpejZOA Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2018-06-08 at 11:03 -0400, Chet Ramey wrote: > On 6/8/18 10:40 AM, Luca Boccassi wrote: >=20 > > Any chance you had a sec to look at the diff? Would love some > > feedback! >=20 > I'm going to try and look at it this weekend. It's been a busy couple > of > months. Hi Chet, I've seen that the change is now in the devel branch, thank you so much! I also like way more the new option name, definitely clearer :-) One difference I noticed with the previous version is that when trying to complete a command when the line starts with an empty space (eg: to avoid the history) the initial word programmable completion doesn't happen. It seems to hit the following branch: else if (s >=3D e && n[0] =3D=3D '\0' && text[0] =3D=3D '\0' && star= t > 0) { foundcs =3D 0; /* empty command name following assignments */ in_command_position =3D was_assignment; } Given was_assignment is 0, then the programmable completion is later not attempted. Since that branch matches an empty command name, should it perhaps call the EMPTYCMD completion? Something like: else if (s >=3D e && n[0] =3D=3D '\0' && text[0] =3D=3D '\0' && star= t > 0) { foundcs =3D 0; /* empty command name following assignments */ in_command_position =3D was_assignment; + if (have_progcomps) + prog_complete_matches =3D programmable_completions (EMPTYCMD, = text, s, e, &foundcs); } Or is there a better solution? Thanks! --=20 Kind regards, Luca Boccassi --=-XDgExfQTbFrdqIpejZOA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEE6g0RLAGYhL9yp9G8SylmgFB4UWIFAlsgAtYACgkQSylmgFB4 UWK3ggf/eEd8qUpfCYOjYgHq5X2xDOjrbKJYIdp/zI6CB9sSg7bkp3bQpiO/xvuz JP70gOFhOTEyDX1hLVUlgevA0z7hmnzPLKnxGoIvKaVlo4icYsgqYRh5wQRTxVwb 9xUm3WjczPUkddg0dC9+GyZ36iFu8MCyyydav7p8o0E+mtMdn95Pg4Kznq2v/H5p bmVY/X9jtWjvoxDVz0vpt1rVRGIi9fN0eL6knWLBhTqEEsaFWzFhM5kS7a+rLfB+ AguTa8r+PryM/FdmLyyeADnViVaw9OejDa77cXa08kap8sdb2OlBYtd0PLaujsOx F8yTnKP0d9QJ36JVkLq6wVzoeuux1Q== =vvVO -----END PGP SIGNATURE----- --=-XDgExfQTbFrdqIpejZOA--