From f2efab92993eb0e6d6337cd38d3d5eb2afd0fdc6 Mon Sep 17 00:00:00 2001 From: L3viathan Date: Tue, 31 Mar 2026 21:05:28 +0200 Subject: [PATCH 1/4] _pyrepl: Add M-_ binding for yank-arg Just like in readline, this does exactly the same thing as M-. --- Lib/_pyrepl/historical_reader.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/_pyrepl/historical_reader.py b/Lib/_pyrepl/historical_reader.py index 5cc82690ae36fc..e6635ef323d02f 100644 --- a/Lib/_pyrepl/historical_reader.py +++ b/Lib/_pyrepl/historical_reader.py @@ -264,6 +264,7 @@ def collect_keymap(self) -> tuple[tuple[KeySpec, CommandName], ...]: (r"\C-s", "forward-history-isearch"), (r"\M-r", "restore-history"), (r"\M-.", "yank-arg"), + (r"\M-_", "yank-arg"), (r"\", "history-search-forward"), (r"\x1b[6~", "history-search-forward"), (r"\", "history-search-backward"), From 74974a4025beb2eb6a4622c9616de64475dfdad7 Mon Sep 17 00:00:00 2001 From: L3viathan Date: Tue, 31 Mar 2026 21:25:48 +0200 Subject: [PATCH 2/4] Add NEWS entry --- .../next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst diff --git a/Misc/NEWS.d/next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst b/Misc/NEWS.d/next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst new file mode 100644 index 00000000000000..dfb8f5b8b319c0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst @@ -0,0 +1 @@ +Additionally bind `yank-arg` to `M-_` in pyrepl From b0e6701ecc117bbad868867681b7eb564fb95da6 Mon Sep 17 00:00:00 2001 From: L3viathan Date: Tue, 31 Mar 2026 21:29:01 +0200 Subject: [PATCH 3/4] Fix NEWS entry syntax (I'm not used to RST) --- .../next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst b/Misc/NEWS.d/next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst index dfb8f5b8b319c0..859810414c53db 100644 --- a/Misc/NEWS.d/next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst +++ b/Misc/NEWS.d/next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst @@ -1 +1 @@ -Additionally bind `yank-arg` to `M-_` in pyrepl +Additionally bind ``yank-arg`` to ``M-_`` in pyrepl From 42f3f0d5409f22fa95038c44ce5874d4f310653d Mon Sep 17 00:00:00 2001 From: L3viathan Date: Tue, 31 Mar 2026 21:29:45 +0200 Subject: [PATCH 4/4] Fix NEWS phrasing as requested by codereview --- .../next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst b/Misc/NEWS.d/next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst index 859810414c53db..48c50efb3b0cb2 100644 --- a/Misc/NEWS.d/next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst +++ b/Misc/NEWS.d/next/Library/2026-03-31-21-25-44.gh-issue-147950.5JR0sK.rst @@ -1 +1 @@ -Additionally bind ``yank-arg`` to ``M-_`` in pyrepl +Bind ``yank-arg`` to :kbd:`M-_` in the REPL.