Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Commit b5b8026

Browse files
committed
Use a more appropriate method to set buffer-file-coding-system
1 parent 33ac0fc commit b5b8026

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

zig-mode.el

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -458,16 +458,6 @@ This is written mainly to be used as `end-of-defun-function' for Zig."
458458
'("enum" "struct" "union"))
459459
`(("Fn" ,(zig-re-definition "fn") 1))))
460460

461-
(defun zig-file-coding-system ()
462-
"Guarantee filesystem unix line endings."
463-
(with-current-buffer (current-buffer)
464-
(if (buffer-file-name)
465-
(if (string-match "\\.d?zig\\'" buffer-file-name)
466-
(setq buffer-file-coding-system 'utf-8-unix)
467-
nil))))
468-
469-
(add-hook 'zig-mode-hook 'zig-file-coding-system)
470-
471461
(defvar zig-mode-map
472462
(let ((map (make-sparse-keymap)))
473463
(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."
493483
(setq-local indent-tabs-mode nil) ; Zig forbids tab characters.
494484
(setq-local syntax-propertize-function 'zig-syntax-propertize)
495485
(setq-local imenu-generic-expression zig-imenu-generic-expression)
486+
(setq buffer-file-coding-system 'utf-8-unix) ; zig source is always utf-8
496487
(setq font-lock-defaults '(zig-font-lock-keywords
497488
nil nil nil nil
498489
(font-lock-syntactic-face-function . zig-mode-syntactic-face-function)))

0 commit comments

Comments
 (0)