summary refs log tree commit diff
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/completion/bash/guix117
-rwxr-xr-xetc/indent-code.el3
-rw-r--r--etc/news.scm2
-rw-r--r--etc/substitutes/bordeaux.guix.gnu.org.pub6
4 files changed, 83 insertions, 45 deletions
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index 26480e5863..a9386e7794 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -1,5 +1,6 @@
 # GNU Guix --- Functional package management for GNU
 # Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2021 Tobias Geerinck-Rice <me@tobias.gr>
 #
 # This file is part of GNU Guix.
 #
@@ -68,31 +69,29 @@ _guix_complete_installed_package ()
 
 _guix_complete_option ()
 {
-    local subcommand
-    case "${COMP_WORDS[2]}" in
-	-*)     subcommand="";;
-	[a-z]*) subcommand="${COMP_WORDS[2]}";;
-    esac
-    local options="$(${COMP_WORDS[0]} ${COMP_WORDS[1]} $subcommand --help 2> /dev/null \
+    local command="${COMP_WORDS[$1]}"
+    local subcommand="${COMP_WORDS[$(($1 + 1))]}"
+    if _guix_is_option "$subcommand"
+    then
+	subcommand=""
+    fi
+    local options="$(${COMP_WORDS[0]} $command $subcommand --help 2> /dev/null \
                             | grep '^  \+-' \
                             | sed -e's/^.*--\([a-zA-Z0-9_-]\+\)\(=\?\).*/--\1\2/g')"
     compopt -o nospace
-    COMPREPLY=($(compgen -W "$options" -- "${COMP_WORDS[${#COMP_WORDS[*]} - 1]}"))
+    COMPREPLY=($(compgen -W "$options" -- "$2"))
 }
 
-_guix_is_command ()
+_guix_is_option ()
 {
-    local word
-    local result="false"
-    for word in ${COMP_WORDS[*]}
-    do
-	if [ "$word" = "$1" ]
-	then
-	    result=true
-	    break
-	fi
-    done
-    $result
+    case "$1" in
+	-*)
+	    true
+	    ;;
+	*)
+	    false
+	    ;;
+    esac
 }
 
 _guix_is_removing ()
@@ -183,22 +182,43 @@ _guix_complete ()
     local word_count=${#COMP_WORDS[*]}
     local word_at_point="${COMP_WORDS[$COMP_CWORD]}"
 
-    if [ "$COMP_CWORD" -gt 1 ]
-    then
-	case "$word_at_point" in
-	    -*)
-		_guix_complete_option "$word_at_point"
-		return
-		;;
-	esac
-    fi
+    # Find the innermost command at point, e.g. "build" in the case of
+    # "guix time-machine OPTIONS -- build<Tab>" -- but "time-machine" if
+    # point is moved before "build".
+    local command_index=0
+    local command
+    local word_index=0
+    local word
+    local expect_command="true"
+    while [[ $((++word_index)) -le COMP_CWORD ]]
+    do
+	word="${COMP_WORDS[$word_index]}"
+	if $expect_command
+	then
+	    command_index=$word_index
+	    command="$word"
+	    expect_command="false"
+	    continue
+	fi
+	if [[ "$word" = "--" ]]
+	then
+	    case "$command" in
+		environment)
+		    break
+		    ;;
+		time-machine)
+		    expect_command="true"
+		    ;;
+	    esac
+	fi
+    done
 
     case $COMP_CWORD in
-	1)
+	$command_index)
 	    _guix_complete_command
 	    ;;
 	*)
-	    if _guix_is_command "package"
+	    if [[ "$command" = "package" ]]
 	    then
 		if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p || _guix_is_dash_f
 		then
@@ -209,7 +229,7 @@ _guix_complete ()
 		else
 		    _guix_complete_available_package "$word_at_point"
 		fi
-	    elif _guix_is_command "install"
+	    elif [[ "$command" = "install" ]]
 	    then
                 if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p
                 then
@@ -217,7 +237,7 @@ _guix_complete ()
 		else
 		    _guix_complete_available_package "$word_at_point"
 		fi
-	    elif _guix_is_command "remove"
+	    elif [[ "$command" = "remove" ]]
 	    then
                 if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p
                 then
@@ -225,7 +245,7 @@ _guix_complete ()
 		else
 		    _guix_complete_installed_package "$word_at_point"
 		fi
-	    elif _guix_is_command "upgrade"
+	    elif [[ "$command" = "upgrade" ]]
 	    then
                 if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p
                 then
@@ -233,7 +253,7 @@ _guix_complete ()
 		else
 		    _guix_complete_installed_package "$word_at_point"
 		fi
-            elif _guix_is_command "build"
+            elif [[ "$command" = "build" ]]
             then
                 if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_f
                 then
@@ -241,51 +261,54 @@ _guix_complete ()
 		else
 		    _guix_complete_available_package "$word_at_point"
                 fi
-	    elif _guix_is_command "environment"
+	    elif [[ "$command" = "environment" ]]
 	    then
                 if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p || _guix_is_dash_l
                 then
                     _guix_complete_file
+		elif _guix_is_option "$word_at_point"
+		then
+		    _guix_complete_option "$command_index" "$word_at_point"
 		else
 		    _guix_complete_available_package "$word_at_point"
 		fi
-	    elif _guix_is_command "download"
+	    elif [[ "$command" = "download" ]]
 	    then
 		 _guix_complete_file
-	    elif _guix_is_command "system"
+	    elif [[ "$command" = "system" ]]
 	    then
 		case $COMP_CWORD in
 		    2) _guix_complete_subcommand;;
 		    *) _guix_complete_file;; # TODO: restrict to *.scm
 		esac
-            elif _guix_is_command "pull"
+            elif [[ "$command" = "pull" ]]
             then
                 if _guix_is_dash_C || _guix_is_dash_p
                 then
                     _guix_complete_file
                 fi
-            elif _guix_is_command "time-machine"
+            elif [[ "$command" = "time-machine" ]]
             then
                 if _guix_is_dash_C
                 then
                     _guix_complete_file
 		else
-		    _guix_complete_command
+		    _guix_complete_option "$command_index" "$word_at_point"
                 fi
-	    elif _guix_is_command "container"
+	    elif [[ "$command" = "container" ]]
 	    then
 		case $COMP_CWORD in
 		    2) _guix_complete_subcommand;;
 		    3) _guix_complete_pid "$word_at_point";;
 		    *) _guix_complete_file;;
 		esac
-	    elif _guix_is_command "import"
+	    elif [[ "$command" = "import" ]]
 	    then
 		_guix_complete_subcommand
-	    elif _guix_is_command "hash" || _guix_is_command "gc"
+	    elif [[ "$command" = "hash" || "$command" = "gc" ]]
 	    then
 		_guix_complete_file
-            elif _guix_is_command "weather"
+            elif [[ "$command" = "weather" ]]
             then
                 if _guix_is_dash_m
                 then
@@ -296,6 +319,12 @@ _guix_complete ()
 	    fi
 	    ;;
     esac
+
+    if [[ -z "$COMPREPLY" && COMP_CWORD -gt command_index ]] &&
+        _guix_is_option "$word_at_point"
+    then
+	_guix_complete_option "$command_index" "$word_at_point"
+    fi
 }
 
 complete -F _guix_complete guix
diff --git a/etc/indent-code.el b/etc/indent-code.el
index 84b15b356f..bdea8ee8bf 100755
--- a/etc/indent-code.el
+++ b/etc/indent-code.el
@@ -99,6 +99,8 @@
                             nil t)
          (let ((indent-tabs-mode nil))
            (beginning-of-defun)
+           (mark-sexp)
+           (untabify (point) (mark))
            (indent-sexp)
            (save-buffer)
            (message "Done!"))
@@ -108,6 +110,7 @@
      ;; Indent all of FILE-NAME.
      (find-file file-name)
      (let ((indent-tabs-mode nil))
+       (untabify (point-min) (point-max))
        (indent-region (point-min) (point-max))
        (save-buffer)
        (message "Done!")))
diff --git a/etc/news.scm b/etc/news.scm
index 25bc0d40a2..3207c12152 100644
--- a/etc/news.scm
+++ b/etc/news.scm
@@ -50,7 +50,7 @@ Führen Sie @command{info \"(guix.de) Aufruf von guix import\"} aus, um mehr
 Informationen zu bekommen.")
          (zh "新的 @command{guix import egg} 命令能让贡献者从一个CHICKEN egg生
 成一个包装或包装样板。
-x
+
 @example
 guix import egg sourcehut
 @end example
diff --git a/etc/substitutes/bordeaux.guix.gnu.org.pub b/etc/substitutes/bordeaux.guix.gnu.org.pub
new file mode 100644
index 0000000000..67085c4498
--- /dev/null
+++ b/etc/substitutes/bordeaux.guix.gnu.org.pub
@@ -0,0 +1,6 @@
+(public-key
+ (ecc
+  (curve Ed25519)
+  (q #7D602902D3A2DBB83F8A0FB98602A754C5493B0B778C8D1DD4E0F41DE14DE34F#)
+  )
+ )