emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 492e16f2ff3: Fix downcasing of mode-name in compile.el


From: Eli Zaretskii
Subject: master 492e16f2ff3: Fix downcasing of mode-name in compile.el
Date: Sat, 3 Feb 2024 06:01:12 -0500 (EST)

branch: master
commit 492e16f2ff33e7ff65ff965e9cd2ba658c9f9a45
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix downcasing of mode-name in compile.el
    
    * 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)
---
 lisp/progmodes/compile.el | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 51c81b9d2f6..11d400e145a 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -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)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]