commit 887e02da33afe7001206ad4897bd7d7800db12ec
parent 8669ae8cfe1a62ff5f03cd5082eb933566959bd9
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date: Sat, 17 Oct 2026 12:05:57 +0200
Improve bracketed-paste hack
Diffstat:
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/.bash_prompt b/.bash_prompt
@@ -186,18 +186,6 @@ __dumb-term/refresh ()
__dumb-term/init ()
{
PROMPT_COMMAND=__dumb-term/refresh
-
- # I configure 'M-x shell' to use TERM=dumb-emacs-ansi; empirically
- # this makes Bash emit this bracketed paste sequence…
- #
- # ^[[?2004l^M^J^[[?2004h
- #
- # … whenever I send a command in a nested shell ('bash' started
- # within the original shell, without --noediting).
- #
- # Until I figure something smarter:
- bind 'set enable-bracketed-paste off' 2>/dev/null
- # (Silence stderr: 'bind' complains when run with --noediting)
}
diff --git a/.inputrc b/.inputrc
@@ -0,0 +1,11 @@
+$if term=dumb-emacs-ansi
+# Turn off bracketed paste to avoid empty lines cluttering M-x shell.
+#
+# This can happen e.g. when running 'bash' or 'gdb' from M-x shell:
+# the mode spawns the initial shell with --no-editing, but for some
+# reason, as soon as TERM is not "dumb", the shell/comint/bash
+# --no-editing/[one-more-interpreter] stack emits bracketed-paste
+# sequences, and however comint washes those, spurious newlines still
+# make it through.
+set enable-bracketed-paste off
+$endif