branch: elpa/zig-mode
commit b5b802630adce68ca5e8b10efa591e55b7c4de69
Author: Steve Purcell <[email protected]>
Commit: Steve Purcell <[email protected]>

    Use a more appropriate method to set buffer-file-coding-system
---
 zig-mode.el | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/zig-mode.el b/zig-mode.el
index 7e4b4d75cc..d69e6713e2 100644
--- a/zig-mode.el
+++ b/zig-mode.el
@@ -458,16 +458,6 @@ This is written mainly to be used as 
`end-of-defun-function' for Zig."
                   '("enum" "struct" "union"))
           `(("Fn" ,(zig-re-definition "fn") 1))))
 
-(defun zig-file-coding-system ()
-  "Guarantee filesystem unix line endings."
-  (with-current-buffer (current-buffer)
-    (if (buffer-file-name)
-        (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)
-
 (defvar zig-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "C-c C-b") #'zig-compile)
@@ -493,6 +483,7 @@ This is written mainly to be used as 
`end-of-defun-function' for Zig."
   (setq-local indent-tabs-mode nil)  ; Zig forbids tab characters.
   (setq-local syntax-propertize-function 'zig-syntax-propertize)
   (setq-local imenu-generic-expression zig-imenu-generic-expression)
+  (setq buffer-file-coding-system 'utf-8-unix) ; zig source is always utf-8
   (setq font-lock-defaults '(zig-font-lock-keywords
                              nil nil nil nil
                              (font-lock-syntactic-face-function . 
zig-mode-syntactic-face-function)))

Reply via email to