]> git.eshelyaron.com Git - kubed.git/commitdiff
Ensure SPC is self-inserting when reading kubectl command line
authorEshel Yaron <me@eshelyaron.com>
Wed, 31 Jul 2024 10:21:39 +0000 (12:21 +0200)
committerEshel Yaron <me@eshelyaron.com>
Wed, 31 Jul 2024 10:24:23 +0000 (12:24 +0200)
* cobra.el (cobra-read-command-line): Ensure SPC key is
self-inserting in the minibuffer.

cobra.el

index 8efb3e24104cb9636224271691440e7de038123c..1fdbabe6e16f2f834146456a9c2c7754e5f108d4 100644 (file)
--- a/cobra.el
+++ b/cobra.el
@@ -129,8 +129,15 @@ Perform completion action A on string S with predicate P."
 Optional argument HIST is the name of the history list variable to use,
 if it is nil or omitted, it defaults to `shell-command-history'."
   (let ((exec (car (split-string-and-unquote initial))))
-    (completing-read prompt (apply-partially #'cobra-completion-table exec)
-                     nil nil initial (or hist 'shell-command-history))))
+    (minibuffer-with-setup-hook
+        (:append (lambda ()
+                   (let ((map (make-sparse-keymap)))
+                     ;; Ensure SPC is self-inserting.
+                     (keymap-unset map "SPC")
+                     (use-local-map
+                      (make-composed-keymap map (current-local-map))))))
+      (completing-read prompt (apply-partially #'cobra-completion-table exec)
+                       nil nil initial (or hist 'shell-command-history)))))
 
 (provide 'cobra)
 ;;; cobra.el ends here