[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Complete './pre-inst-env guix ...'
From: |
Alex Kost |
Subject: |
Complete './pre-inst-env guix ...' |
Date: |
Wed, 10 Jun 2015 10:31:08 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Ludovic Courtès (2015-06-08 22:19 +0300) wrote:
> PS: I wonder if something could also be done for “./pre-inst-env guix”...
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---
--
Alex
- [PATCH 2/2] emacs: Add shell completions for "guix" command., Alex Kost, 2015/06/06
- Re: [PATCH 2/2] emacs: Add shell completions for "guix" command., Ludovic Courtès, 2015/06/07
- Re: [PATCH 2/2] emacs: Add shell completions for "guix" command., Ludovic Courtès, 2015/06/07
- Re: [PATCH 2/2] emacs: Add shell completions for "guix" command., Alex Kost, 2015/06/08
- Re: [PATCH 2/2] emacs: Add shell completions for "guix" command., Ludovic Courtès, 2015/06/08
- Complete './pre-inst-env guix ...',
Alex Kost <=
- Re: Complete './pre-inst-env guix ...', Ludovic Courtès, 2015/06/10
- Re: Complete './pre-inst-env guix ...', Alex Kost, 2015/06/11
- Re: Complete './pre-inst-env guix ...', Ludovic Courtès, 2015/06/14
- Re: Complete './pre-inst-env guix ...', Alex Kost, 2015/06/15
- Re: Complete './pre-inst-env guix ...', Ludovic Courtès, 2015/06/15
- Re: Complete './pre-inst-env guix ...', Alex Kost, 2015/06/16