From 0a317afc299ba32fda97a4ec5268cc9a5bbe9939 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Fri, 16 Apr 2021 15:18:03 +0200 Subject: [PATCH] Default to builtin region completion for shell mode As for eshell, path completion in shell mode erroneously adds extra spaces when using ivy. Since the builtin completion is good enough for shell mode anyway, let's stick to that. No bad surprises. --- init.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index be9f610..24be382 100644 --- a/init.el +++ b/init.el @@ -2537,8 +2537,20 @@ With given ARG, display files in `db/important-document-path’." ;; We may want to use readline support in bash, don't inhibit this ;; with explicit command line arguments; ;; cf. https://coredumped.dev/2020/01/04/native-shell-completion-in-emacs/ + (setq explicit-bash-args - (delete "--noediting" explicit-bash-args)))) + (delete "--noediting" explicit-bash-args)) + + ;; When doing completion, ivy seems to add an extra space, much like + ;; in the case for eshell. However, here the space seems to come + ;; out of nowhere. Since the builtin completion using + ;; `completion--in-region' is good enough for the shell mode, let's + ;; stick to that. + + (add-hook 'shell-mode-hook + (lambda () + (setq-local completion-in-region-function + #'completion--in-region))))) (use-package db-eshell :commands (db/run-or-hide-eshell