From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Complete './pre-inst-env guix ...' Date: Wed, 10 Jun 2015 10:31:08 +0300 Message-ID: <87bngodnpf.fsf_-_@gmail.com> References: <87mw0czhvi.fsf@gmail.com> <87pp57zg2b.fsf@gnu.org> <8738224m5j.fsf@gmail.com> <87fv62m2i3.fsf@gnu.org> 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]:56925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2aTl-00066G-RR for guix-devel@gnu.org; Wed, 10 Jun 2015 03:31:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2aTg-0003vN-7M for guix-devel@gnu.org; Wed, 10 Jun 2015 03:31:17 -0400 In-Reply-To: <87fv62m2i3.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 08 Jun 2015 21:19:48 +0200") 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: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org Ludovic Court=C3=A8s (2015-06-08 22:19 +0300) wrote: > PS: I wonder if something could also be done for =E2=80=9C./pre-inst-env = guix=E2=80=9D... IIUC there is no simple way to configure pcomplete for that. Here is an invasive hack I came up with: --8<---------------cut here---------------start------------->8--- (defvar al/pcomplete-skipped-commands '("sudo" "pre-inst-env") "List of special commands for `al/pcomplete-reduce-args-maybe'.") (defun al/pcomplete-reduce-args-maybe (&rest _) "Change some global variables to complete a special command properly. If a command from `al/pcomplete-skipped-commands' is being completed, skip it and perform completion as if the next argument was the current command." (when pcomplete-args (let ((cmd (file-name-nondirectory (car pcomplete-args)))) (when (member cmd al/pcomplete-skipped-commands) (setq pcomplete-args (cdr pcomplete-args) pcomplete-last (1- pcomplete-last)))))) (advice-add 'pcomplete-parse-arguments :after #'al/pcomplete-reduce-args-maybe) --8<---------------cut here---------------end--------------->8--- --=20 Alex