Subject: bug#64452: [Wishlist/PATCH] Use special-mode for *Native-compile-log*, *Async-native-compile-log*

From: No Wayman <[email-masked]>
Date: Tue, 04 Jul 2023 18:21:00 -0400

Eli Zaretskii <[email-masked]> writes:

> Thanks, but why not elisp-compile-mode, like we do in 
> *Compile-log*
> buffers for byte compilation?

Works for me. Revision attached.

>From 9912e598354f877cb4ccf20ac68d7267d8c599c8 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <[email-masked]>
Date: Mon, 3 Jul 2023 20:23:00 -0400
Subject: [PATCH] * comp.el: use emacs-lisp-compilation-mode for log buffers

(comp-log-to-buffer): ensure comp-log-buffer in emacs-lisp-compilation-mode
(comp-run-async-workers): ensure comp-async-buffer in emacs-lisp-compilation-mode
---
 lisp/emacs-lisp/comp.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 22fb08e4688..5f42d10407f 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -1133,7 +1133,8 @@ comp-log-to-buffer
          (log-buffer
              (or (get-buffer comp-log-buffer-name)
                  (with-current-buffer (get-buffer-create comp-log-buffer-name)
-                   (setf buffer-read-only t)
+                   (unless (derived-mode-p 'emacs-lisp-compilation-mode)
+                     (emacs-lisp-compilation-mode))
                    (current-buffer))))
          (log-window (get-buffer-window log-buffer))
          (inhibit-read-only t)
@@ -4085,7 +4086,8 @@ comp-run-async-workers
                              :buffer (with-current-buffer
                                          (get-buffer-create
                                           comp-async-buffer-name)
-                                       (setf buffer-read-only t)
+                                       (unless (derived-mode-p 'emacs-lisp-compilation-mode)
+                                         (emacs-lisp-compilation-mode))
 			               (current-buffer))
                              :command (list
                                        (expand-file-name invocation-name
@@ -4119,6 +4121,8 @@ comp-run-async-workers
     (run-hooks 'native-comp-async-all-done-hook)
     (with-current-buffer (get-buffer-create comp-async-buffer-name)
       (save-excursion
+        (unless (derived-mode-p 'emacs-lisp-compilation-mode)
+          (emacs-lisp-compilation-mode))
         (let ((inhibit-read-only t))
           (goto-char (point-max))
           (insert "Compilation finished.\n"))))
-- 
2.41.0