From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13059 invoked from network); 27 Jun 2020 09:05:37 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 27 Jun 2020 09:05:37 -0000 Received: (qmail 2504 invoked by alias); 27 Jun 2020 09:05:28 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: Sender: zsh-workers@zsh.org X-Seq: 46146 Received: (qmail 16230 invoked by uid 1010); 27 Jun 2020 09:05:28 -0000 X-Qmail-Scanner-Diagnostics: from sender4-of-o56.zoho.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25850. spamassassin: 3.4.4. Clear:RC:0(136.143.188.56):SA:0(-2.0/5.0):. Processed in 0.828744 secs); 27 Jun 2020 09:05:28 -0000 X-Envelope-From: mk@mkoskar.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf.zoho.com designates 136.143.188.56 as permitted sender) ARC-Seal: i=1; a=rsa-sha256; t=1593248686; cv=none; d=zohomail.com; s=zohoarc; b=bf/Vqnwdv9AiRggdQ8HKKuzt9F1AkubaAJF6qv1cgkDzUL5qKdO00D0G3ET+0KBGxWrBMAcXShtnpz4pPZDcXAWQhxzix59EeAWwxjbe0KvtinezOPekEJ7TYirQPubJgtnjr5bzCstiEKIbFhW2WvmcwBEyQ+LpwEbaO94fnis= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593248686; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=CTtdY2Onhc0OT/7pg/UuM6P5P4AKiq36lMIqrn1Ka20=; b=AT4CpwJzbhmhy22e0oDa8KGNuMxrLf2s+ZdxgGxBmFtPWHPxjSfRfvj7FruMCjodmiO9MMecI+kF/pl+vH6LpfvIIlArEkfpR7X27LFR8sT4U191cf+Q3NLF6ba8EJUO/LzS9X+Ew0RDBaz+VAK+5FAlP1OKa2hAAzAoO4cXM0U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=mkoskar.com; spf=pass smtp.mailfrom=mk@mkoskar.com; dmarc=pass header.from= header.from= Date: Sat, 27 Jun 2020 11:04:36 +0200 From: Miroslav =?utf-8?B?S2/FoWvDoXI=?= To: Daniel Shahaf Cc: zsh-workers@zsh.org Message-ID: <20200627090436.nus5tsql3awqpqew@mkoskar.com> Subject: Re: _git: Improve handling of aliases References: <7f7706bd28646cf47d77a0e1b5f89cff40ed9ffe.1592995874.git.mk@mkoskar.com> <20200624115630.GA25495@tarpaulin.shahaf.local2> <20200626101704.lhzsaqrdov5rhbr7@mkoskar.com> <20200626170003.49d91fff@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20200626170003.49d91fff@tarpaulin.shahaf.local2> X-ZohoMailClient: External Hi Daniel, bellow to things not addressed in my recent patchset. On Jun 26, Daniel Shahaf wrote: > Sure. Alternatively, we could continue to retrieve all aliases but > cache that list between calls (see _store_cache; there are examples in > _subversion). I see, good to know. It seems fast enough to me as is so *shrug*. > Well, yes and no. The arguments to shell aliases seem to be handled > similarly to arguments to =C2=ABeval=C2=BB: joined by spaces and then pas= sed to > system(3). That means it's valid to pass the entire string in a single > shell word, or to translate any of the spaces in the desired result > string into word breaks at the shell input level, just like =C2=ABeval he= llo > world=C2=BB and =C2=ABeval 'hello world'=C2=BB are equivalent. > > So, how about completing this the same way =C2=ABeval -- =C2=BB is c= ompleted? > Currently ${_comps[eval]} is _precommand, which just calls _normal, but > that's incomplete=C2=B9. If we write the code to do something along the > lines of =C2=ABwords=3D(eval -- =E2=80=A6); CURRENT=3D=E2=80=A6; _normal= =C2=BB, it'll automatically > grow support for completing both variants once such support is added to > =C2=ABeval=C2=BB's completion.=C2=B2 > > =C2=B9 For example, =C2=ABeval 'git -c' =C2=BB completes files rathe= r than > configuration options, because it takes 'git -c' rather than just 'git' > to be the command word. > > =C2=B2 That'd be something along the lines of =C2=ABwords=3D( ${=3D:-"${w= ords}"} )=C2=BB, > I guess? Plus adjusting $CURRENT, etc.. Right, I understand your points generally. I see the similarity to eval, even though there is an important distinction I think: (git alias) test =3D !echo hello $ git test \; world hello ; world So git executes aliases more akin to: sh -c 'echo hello "$@"' arg0 \; world As for doing 'words=3D(eval ...); _normal', it doesn't work for complex commands e.g., eval cd dir '&&' ls -. I understand you would like to have that work in future and I agree what would be cool and would certainly help here. With my limited knowledge of zsh internals and complexity of completion I'll leave this to others :). While proposed split on simple command separators might seem crude it actually works quite fine. > As above, I'd prefer to delegate to =C2=ABeval=C2=BB's completion. Alter= natively, > my previous point about supporting comments stands. Ahhh, so that's (Z+C+) instead of (z), forgot about that. Well it's not like a common case to use comments there, mind you it's a bit weird to even use them in gitconfig, managed to make an example: test =3D !echo hello \n \ "#" let this be a commented line \n \ echo world Ok, I'll wait for your comments on the patchset I've sent before and this too and then either incorporate (Z+C+) with other changes or sent it separately. Regards, Miro