From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 2/2] emacs: Add shell completions for "guix" command. Date: Mon, 08 Jun 2015 21:19:48 +0200 Message-ID: <87fv62m2i3.fsf@gnu.org> References: <87mw0czhvi.fsf@gmail.com> <87pp57zg2b.fsf@gnu.org> <8738224m5j.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z22aR-0007a4-TT for guix-devel@gnu.org; Mon, 08 Jun 2015 15:19:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z22aM-0005JU-Ul for guix-devel@gnu.org; Mon, 08 Jun 2015 15:19:55 -0400 In-Reply-To: <8738224m5j.fsf@gmail.com> (Alex Kost's message of "Mon, 08 Jun 2015 11:52:40 +0300") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Alex Kost Cc: guix-devel@gnu.org Alex Kost skribis: > Ludovic Court=C3=A8s (2015-06-07 18:36 +0300) wrote: [...] >> However it=E2=80=99s important to fall back to file name completions for= things >> that are not handled, so that at least it is not worse than without the >> pcomplete code. > > Yes, it is the current behaviour (I mean the file names completion). Perfect. >>> Completing may lag a bit from time to time. It happens because shell >>> commands (like =E2=80=98guix ... --help=E2=80=99) are called when neces= sary to find >>> options, packages, etc. But the found entries are "memoized" so next >>> time the same entries will be completed much faster. >> >> I wonder if =E2=80=98guix-pcomplete-run-guix=E2=80=99 couldn=E2=80=99t r= un the command in a REPL >> instead of spawning a process. That is, when completing =E2=80=98guix b= uild=E2=80=99, >> it would evaluate something like: >> >> (with-output-to-string >> (lambda () >> (catch 'quit >> (lambda () >> ((@ (guix scripts build) guix-build) "--help")) >> (const #t)))) >> >> How does that sound? > > It was the initial deliberate decision to separate completions code from > interacting with "guix repl", to make completing independent. I imagine > that a user wouldn't like to see that some "Guix REPL has been started" > just because he presses TAB after =E2=80=98guix pa=E2=80=99 in his shell = buffer. Well, > at least I wouldn't use such strange completions. > > I think lags made by spawning the guix processes are bearable and not > repeatable (I mean the next time =E2=80=98guix pa=E2=80=99 is comple= ted > immediately), so I would not like to change the code to use a REPL if > you don't mind :-) > > (Perhaps in the future there will be added some option (e.g., a boolean > `guix-pcomplete-use-repl' variable) to choose what a user prefers) Right, it makes sense to have that module independent of the rest. I just tried and it feels faster than the Bash completion anyway. :-) Thank you! Ludo=E2=80=99. PS: I wonder if something could also be done for =E2=80=9C./pre-inst-env gu= ix=E2=80=9D...