]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix downcasing of mode-name in compile.el
authorEli Zaretskii <eliz@gnu.org>
Sat, 3 Feb 2024 11:00:15 +0000 (13:00 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 4 Feb 2024 11:05:05 +0000 (12:05 +0100)
* lisp/progmodes/compile.el (compilation--downcase-mode-name): New
function.
(compilation-start, kill-compilation): Use it instead of calling
'downcase' on 'mode-name'.  (Bug#68795)

(cherry picked from commit 492e16f2ff33e7ff65ff965e9cd2ba658c9f9a45)

lisp/progmodes/compile.el

index 51c81b9d2f6205545810857d6f7882839aedf485..11d400e145a6e86400188193e7ddaf6b0dbf7ad6 100644 (file)
@@ -1890,6 +1890,12 @@ process from additional information inserted by Emacs."
 (defvar-local compilation--start-time nil
   "The time when the compilation started as returned by `float-time'.")
 
+(defun compilation--downcase-mode-name (mode)
+  "Downcase the name of major MODE, even if MODE is not a string.
+The function `downcase' will barf if passed the name of a `major-mode'
+which is not a string, but instead a symbol or a list."
+  (downcase (format-mode-line mode)))
+
 ;;;###autoload
 (defun compilation-start (command &optional mode name-function highlight-regexp
                                   continue)
@@ -2081,11 +2087,12 @@ Returns the compilation buffer created."
                        (get-buffer-process
                         (with-no-warnings
                           (comint-exec
-                           outbuf (downcase mode-name)
+                           outbuf (compilation--downcase-mode-name mode-name)
                            shell-file-name
                            nil `(,shell-command-switch ,command)))))
-                    (start-file-process-shell-command (downcase mode-name)
-                                                      outbuf command))))
+                    (start-file-process-shell-command
+                      (compilation--downcase-mode-name mode-name)
+                     outbuf command))))
               ;; Make the buffer's mode line show process state.
               (setq mode-line-process
                     '((:propertize ":%s" face compilation-mode-line-run)
@@ -2790,7 +2797,8 @@ Prefix arg N says how many files to move backwards (or forwards, if negative)."
   (let ((buffer (compilation-find-buffer)))
     (if (get-buffer-process buffer)
        (interrupt-process (get-buffer-process buffer))
-      (error "The %s process is not running" (downcase mode-name)))))
+      (error "The %s process is not running"
+             (compilation--downcase-mode-name mode-name)))))
 
 (defalias 'compile-mouse-goto-error 'compile-goto-error)