From: Eli Zaretskii Date: Thu, 19 May 2022 08:00:36 +0000 (+0300) Subject: Fix Flymake diagnostics reporting in non-UTF-8 locales X-Git-Tag: emacs-29.0.90~1910^2~590 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6308f0738d3b1c1e0add5cab87bf02097fb1a8d1;p=emacs.git Fix Flymake diagnostics reporting in non-UTF-8 locales * 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. --- diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 1ae1cf7eb6d..37fd4fdb3c8 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -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)