branch: elpa/zig-mode commit b0eb489668d24d39841b25dede9a6359527b63eb Author: serialdev <carlos.mariscal.mel...@gmail.com> Commit: serialdev <carlos.mariscal.mel...@gmail.com>
[+] Guarantee Unix line endings to avoid compiler complaining with DOS carriage return --- zig-mode.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zig-mode.el b/zig-mode.el index e2932cd..3b89788 100644 --- a/zig-mode.el +++ b/zig-mode.el @@ -298,6 +298,16 @@ '("enum" "struct" "union")) `(("Fn" ,(zig-re-definition "fn") 1)))) +;;; Guarantee filesystem unix line endings +(defun zig-file-coding-system () + (with-current-buffer (current-buffer) + (if (string-match "\\.d?zig\\'" buffer-file-name) + (setq buffer-file-coding-system 'utf-8-unix) + nil) +)) + +(add-hook 'zig-mode-hook 'zig-file-coding-system) + ;;;###autoload (define-derived-mode zig-mode prog-mode "Zig" "A major mode for the Zig programming language."