unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Add shell completions for 'guix refresh --type'.
@ 2015-10-28 18:55 Alex Kost
  2015-10-29 19:24 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Kost @ 2015-10-28 18:55 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 41 bytes --]

This is for completions in "M-x shell".


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-emacs-Add-shell-completions-for-guix-refresh-type.patch --]
[-- Type: text/x-patch, Size: 1631 bytes --]

From 5c2294db69811395650db151d14d548495002cfb Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Wed, 28 Oct 2015 20:48:45 +0300
Subject: [PATCH] emacs: Add shell completions for 'guix refresh --type'.

* emacs/guix-pcomplete.el (guix-pcomplete-refresh-updaters): New function.
  (guix-pcomplete-complete-option-arg): Complete '-t/--type' option for
  'guix refresh' command.
---
 emacs/guix-pcomplete.el | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/emacs/guix-pcomplete.el b/emacs/guix-pcomplete.el
index 98f8efd..3074dc8 100644
--- a/emacs/guix-pcomplete.el
+++ b/emacs/guix-pcomplete.el
@@ -128,6 +128,13 @@ subcommands, actions, etc. for this guix COMMAND."
    guix-help-parse-regexp-group
    "graph" "--list-types"))
 
+(guix-memoized-defun guix-pcomplete-refresh-updaters ()
+  "Return a list of all available refresh updater types."
+  (guix-pcomplete-run-guix-and-search
+   guix-help-parse-list-regexp
+   guix-help-parse-regexp-group
+   "refresh" "--list-updaters"))
+
 \f
 ;;; Completing
 
@@ -287,9 +294,12 @@ INPUT is the current partially completed string."
            (option? "-u" "--user"))
       (complete* (pcmpl-unix-user-names)))
 
-     ((and (command? "refresh")
-           (option? "-s" "--select"))
-      (complete* guix-help-refresh-subsets))
+     ((command? "refresh")
+      (cond
+       ((option? "-s" "--select")
+        (complete* guix-help-refresh-subsets))
+       ((option? "-t" "--type")
+        (complete* (guix-pcomplete-refresh-updaters)))))
 
      ((and (command? "size")
            (option? "-m" "--map-file"))
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] emacs: Add shell completions for 'guix refresh --type'.
  2015-10-28 18:55 [PATCH] emacs: Add shell completions for 'guix refresh --type' Alex Kost
@ 2015-10-29 19:24 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2015-10-29 19:24 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> From 5c2294db69811395650db151d14d548495002cfb Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Wed, 28 Oct 2015 20:48:45 +0300
> Subject: [PATCH] emacs: Add shell completions for 'guix refresh --type'.
>
> * emacs/guix-pcomplete.el (guix-pcomplete-refresh-updaters): New function.
>   (guix-pcomplete-complete-option-arg): Complete '-t/--type' option for
>   'guix refresh' command.

Sure!

Ludo'.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-29 19:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-28 18:55 [PATCH] emacs: Add shell completions for 'guix refresh --type' Alex Kost
2015-10-29 19:24 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).