]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Flymake diagnostics reporting in non-UTF-8 locales
authorEli Zaretskii <eliz@gnu.org>
Thu, 19 May 2022 08:00:36 +0000 (11:00 +0300)
committerEli Zaretskii <eliz@gnu.org>
Thu, 19 May 2022 08:00:36 +0000 (11:00 +0300)
* lisp/progmodes/elisp-mode.el (elisp-flymake-byte-compile)
(elisp-flymake--batch-compile-for-flymake): Bind I/O encoding to
UTF-8, instead of relying on the locale's defaults.  This is
needed because ELisp files use UTF-8 by default, but Flymake
doesn't know about that, since it isn't specific to ELisp.

lisp/progmodes/elisp-mode.el

index 1ae1cf7eb6dd1044855183008df7e1016bf53f42..37fd4fdb3c8710dfd16ce4c16fa744a6db8b9e48 100644 (file)
@@ -2088,7 +2088,9 @@ current buffer state and calls REPORT-FN when done."
     (when (process-live-p elisp-flymake--byte-compile-process)
       (kill-process elisp-flymake--byte-compile-process)))
   (let ((temp-file (make-temp-file "elisp-flymake-byte-compile"))
-        (source-buffer (current-buffer)))
+        (source-buffer (current-buffer))
+        (coding-system-for-write 'utf-8-unix)
+        (coding-system-for-read 'utf-8))
     (save-restriction
       (widen)
       (write-region (point-min) (point-max) temp-file nil 'nomessage))
@@ -2138,6 +2140,8 @@ Runs in a batch-mode Emacs.  Interactively use variable
   (interactive (list buffer-file-name))
   (let* ((file (or file
                    (car command-line-args-left)))
+         (coding-system-for-read 'utf-8-unix)
+         (coding-system-for-write 'utf-8)
          (byte-compile-log-buffer
           (generate-new-buffer " *dummy-byte-compile-log-buffer*"))
          (byte-compile-dest-file-function #'ignore)