Subject: Re: bug#41844: 26.3; Compilation mode keybindings inconsistent with Grep mode

From: Stefan Kangas <[email-masked]>
Date: Thu, 20 Aug 2020 07:54:05 -0700

severity 41844 wishlist
tags 41844 + patch
thanks

Colton Lewis <[email-masked]> writes:

> When in Grep mode, 'n' and 'p' respectively go to the next and previous
> match in the buffer.
>
> However, Compilation mode leaves 'n' and 'p' unbound. This inconsistency
> is annoying.

Sounds like a good idea to me.  I've attached a patch which does this.

Any other opinions?  I admit that I don't use compilation-mode as much
as I probably should (I'm silly enough to often run make manually from
my shell).

Best regards,
Stefan Kangas
From 4373da0b4e8cee23c53b5e46f28d69e9b6e444ed Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Thu, 20 Aug 2020 16:41:50 +0200
Subject: [PATCH] Bind 'n' and 'p' in compilation-mode-map

* lisp/progmodes/compile.el (compilation-mode-map): Bind
'(next|previous)-error-no-select' to 'n' and 'p'.  (Bug#41844)
---
 lisp/progmodes/compile.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 0b9f417845..2805f644e9 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -2064,6 +2064,8 @@ compilation-mode-map
     (define-key map "\M-p" 'compilation-previous-error)
     (define-key map "\M-{" 'compilation-previous-file)
     (define-key map "\M-}" 'compilation-next-file)
+    (define-key map "n" 'next-error-no-select)
+    (define-key map "p" 'previous-error-no-select)
     (define-key map "\t" 'compilation-next-error)
     (define-key map [backtab] 'compilation-previous-error)
     (define-key map "g" 'recompile) ; revert
-- 
2.28.0