Path: csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Luca Boccassi Newsgroups: gnu.bash.bug Subject: Re: [PATCH] Add nofirstword completion option Date: Fri, 08 Jun 2018 15:40:56 +0100 Lines: 107 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> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-bbE4RCaqqblFw/Ab3gTq" X-Trace: usenet.stanford.edu 1528468870 32384 208.118.235.17 (8 Jun 2018 14:41:10 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=JmNUi7YOaPAxptyqoj/4VV5Ah79UMKZ39IAOpinf7bU=; b=Btjc0FKG/QNinUy8l0hV44vobGpxzZrhzFRBOrTQyAXkOXBnyzMpWcCEPO4KdPXS6w NiiGYn4vdvOI2i6XVM6nVtynQdX7qizvUFH3suZ+YD8spsv8y9MNntT9fgvCbEOCmwal db9ELkvfo+GWu9YdpzhNkkJdSlLeQXPfmdulx0Hi+WmWZpsdLczNag6Qsx4F7vKVgthe QhYnx4Oxde2tStCKJAH8dIj55zrksJU1vyjzTo0pozRhMF7OE+t3uipYi3hGvrDQen0d DWS1DYHJTkc/lBoOk5TZaNQHTlJ6r6OgXz43oC1nTMouu26X1o9GKAxVTIFIgMFOAv9F SrTQ== X-Gm-Message-State: APt69E3+VtKZ84HdIpta8hXh4suip+nNHwJMVJWWxHmklPIDfPah5+it DOKqDrP9QF38r18UoyaSXhY= X-Google-Smtp-Source: ADUXVKJENszMiEP9FhajSaZ7MDZ2JXU4km/o4PMa+RjOuqKPlJK+leowg9pqVu4zFQdGA2nSKAL8IA== X-Received: by 2002:adf:c3c2:: with SMTP id d2-v6mr5343612wrg.68.1528468858817; Fri, 08 Jun 2018 07:40:58 -0700 (PDT) In-Reply-To: <1527860403.6997.72.camel@debian.org> 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.196 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:14225 --=-bbE4RCaqqblFw/Ab3gTq Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2018-06-01 at 14:40 +0100, Luca Boccassi wrote: > On Tue, 2018-05-29 at 15:44 +0100, Luca Boccassi wrote: > > On Fri, 2018-05-25 at 14:40 -0400, Chet Ramey wrote: > > > On 5/25/18 1:42 PM, Luca Boccassi wrote: > > >=20 > > > > > There is already logic that determines whether the shell is > > > > > trying to > > > > > complete a command word (in_command_position). The existing > > > > > code > > > > > does > > > > > not attempt programmable completion if in_command_position =3D=3D > > > > > 1. > > > > > The > > > > > additional functionality would: > > > > >=20 > > > > > 1. Add an option to the complete builtin to specify how to > > > > > complete > > > > > =C2=A0=C2=A0=C2=A0command names, and store it in a specially-name= d compspec, > > > > > like > > > > > =C2=A0=C2=A0=C2=A0completion for empty lines does. > > > > >=20 > > > > > 2. Add code to invoke that completion, if it exists and > > > > > programmable > > > > > =C2=A0=C2=A0=C2=A0completion is active, before attempting bash's = default > > > > > completion, > > > > > =C2=A0=C2=A0=C2=A0if in_command_position =3D=3D 1. > > > > >=20 > > > > > Chet > > > >=20 > > > > Hi, > > > >=20 > > > > Thanks for the guidance! Unfortunately I'm still not quite > > > > there > > > > yet - > > > > inlined are the changes based on my understanding of the above. > > > > It > > > > implements a "usercmd/-U" option similar to the existing -E for > > > > empty > > > > line. > > > >=20 > > > > But at the moment all it does is to allow (via "complete -U -F > > > > foo") to > > > > complete when nothing is typed in, which seemed to be possible > > > > already > > > > with -E. If some characters are already typed in, it will still > > > > do > > > > the > > > > default completion to commands in the PATH. > > > >=20 > > > > What have I missed? > > >=20 > > > You should make sure you don't add your code in the section with > > > the > > > rest > > > of the programmable completions, since that block is not entered > > > if > > > in_command_position !=3D 0. > >=20 > > Thanks for the suggestion, it works perfectly now! > >=20 > > Inlined is the latest revision, with added documentation. Let me > > know > > if you'd like me to change anything. >=20 > Hello Chet, >=20 > Just noticed other devs sent patches as attachments rather than > inline, > so just in case that's a more convenient form to review I'm including > the diff as an attachment. >=20 > Thanks! Hi Chet, Any chance you had a sec to look at the diff? Would love some feedback! Thanks! --=20 Kind regards, Luca Boccassi --=-bbE4RCaqqblFw/Ab3gTq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEE6g0RLAGYhL9yp9G8SylmgFB4UWIFAlsalXgACgkQSylmgFB4 UWItyQf/fz8lDRblLTmdK6AeqIU+0XPrEcowFu1kQHHTVU8aaM5ovMEKArhRk6O9 x07Gpi/lwmLDeDS8NyRrmZMu6KryEqzDxaGXA2hewZdiefPaZqtzkNEq8eBBShWa 3v3vYkAimXat0X1QJDDL5w+H2lv7eWAX+Ooh6olNbCO7HxPfMhhN7kLIrsB0xw9y NHhNkQRG0mxtSTE+bTk0XmtWggt8hb3GhFAL0s8JCf56N/qecdSshe4mlwvqU6gV n47MvkAiU7eMSusy+fn8f1l/7WjjqNyd3NZHYRL8GNWn7XfSHPrNmQkOPRrfO2sJ LSRl2giBAwFydg/2Zx1TRx2iV7HWPA== =yFbC -----END PGP SIGNATURE----- --=-bbE4RCaqqblFw/Ab3gTq--