Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Luca Boccassi Newsgroups: gnu.bash.bug Subject: Re: [PATCH] Fix custom program's completions when initial word is set Date: Mon, 26 Nov 2018 10:36:41 +0000 Lines: 65 Approved: bug-bash@gnu.org Message-ID: References: <20181123124854.4208-1-bluca@debian.org> <20181125100418.GB3300@conan.hallows> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-zMv89DmcPjrVubeU8LxX" X-Trace: usenet.stanford.edu 1543228612 28189 208.118.235.17 (26 Nov 2018 10:36:52 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Tom Ryder 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:cc:date:in-reply-to :references:mime-version; bh=Q9Lk8Ejm+qjvNgymkuTicCRkzMef1O8u3QZRSmAW/ww=; b=r44pXCSer+YOrs2UyAPYSzZbGpFhtHdlhNwMBzS1xSNfScEalabhcoQIoyZ3Yc+nLE fQmLdlu5mXpQKgc3+vvpDmKMTwZz/MBpfqfl7/LkRLHWQl6Rh2QSYaXqvdJj68wTHyYK cLHeXEylIAhulSftNKxF9M5tjxmnjLxhUHp+lVniLa4Fck1lNExnvzkhc+a2uwPoIbwy 42UMyvOXwJFM3bm6Bjt2Oj1R7ZVi6JPCJL3RYRdDKrw74K1Wo+EoSNYFRdZwR2yMaXqT MYcMAVoVE6lUiQmmTuxEGIb2iYdK9emoll/TDQAZdV0pyyJwxQ/3xGk7LGWXk7S5RuG8 RlhQ== X-Gm-Message-State: AA+aEWZflAmYx8wNOgsMiS33YYtj9rggBdEZRI+wEQR6mBIqlpnppGhV M9Byvacs1Yv+Y+ovIJwQ52Y= X-Google-Smtp-Source: AFSGD/WGtT3GEtMgNigBJ6V/0xBmZM8Z7yyLuB/fHDDCOzHah6DUQMq1BmdDEqwXihcmki2w0FsEGA== X-Received: by 2002:adf:91a3:: with SMTP id 32mr21012623wri.99.1543228604538; Mon, 26 Nov 2018 02:36:44 -0800 (PST) In-Reply-To: <20181125100418.GB3300@conan.hallows> 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.221.68 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:14854 --=-zMv89DmcPjrVubeU8LxX Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, 2018-11-25 at 23:04 +1300, Tom Ryder wrote: > On Fri, Nov 23, 2018 at 12:48:54PM +0000, Luca Boccassi wrote: > > The fix is to only override foundcs if both iw_compspec is not null > > and we are not in command position. >=20 > Thank you for this patch. I first ran into the issue with 5.0-beta2=C2=A0 > another way: I noticed that my default completion spec with -D as=C2=A0 > suggested by the Bash manual page was no longer working: >=20 > =C2=A0=C2=A0=C2=A0=C2=A0_completion_loader() > =C2=A0=C2=A0=C2=A0=C2=A0{ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0. "/etc/bash_comple= tion.d/$1.sh" >/dev/null 2>&1 && return > 124 > =C2=A0=C2=A0=C2=A0=C2=A0} > =C2=A0=C2=A0=C2=A0=C2=A0complete -D -F _completion_loader -o bashdefault = -o default >=20 > In 5.0-beta2, after running this code, for any command with no=C2=A0 > completion specs defined in /etc/bash_completion.d, completing an=C2=A0 > argument does nothing. >=20 > Your second patch does not correct that, but it looks like that's=C2=A0 > because a non-zero `foundcs` is coerced to 1 in it, when there are > other=C2=A0 > meaningful values for the integer as the first parameter for=C2=A0 > `pcomp_set_readline_variables(int, int)`. >=20 > The attached patch is my own attempt, which seems to correct my > issues=C2=A0 > as well as the one you raised in this post. Long-time user, first- > time=C2=A0 > poster... Hi, Thanks for the update, yes it looks like your patch is a better solution, I've tested it as well, thanks. --=20 Kind regards, Luca Boccassi --=-zMv89DmcPjrVubeU8LxX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEE6g0RLAGYhL9yp9G8SylmgFB4UWIFAlv7zLkACgkQSylmgFB4 UWLuaQf+Ja5OrOcN+MSk4PMMJUTDY56J1l33aRgYE0RC5dIRtMaF7F77vCmi52jh UHPAYcGYM4PZxsskapFXOgJckJVnQOE8aW/L5k2FuIk3UFV/NJvTYIyvCl3zucls m05sQYrr94K7YbxLsCLQTCWukf6HF7fFpJPNN2n63rCU9ZkoCivyFJGsR0m0nT+b tw1N2qdCtEgwYARaVWZAMLa4CM/3DFTS+6gtogCmoBFn9oGiC6/AzdozA+CHxdac uDoOZVr5K2Hy4D+Yy1l6Go31UxlAuwX21aeRC+v3L8noETlP2huKQhIt93Y4eT+c sYdBZjRYoHkVnexs/qdqOniWARY/jQ== =mEnF -----END PGP SIGNATURE----- --=-zMv89DmcPjrVubeU8LxX--