forked from purcell/emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-locales.el
26 lines (22 loc) · 965 Bytes
/
init-locales.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
;;; init-locales.el --- Configure default locale -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
(defun sanityinc/locale-var-encoding (v)
"Return the encoding portion of the locale string V, or nil if missing."
(when v
(save-match-data
(let ((case-fold-search t))
(when (string-match "\\.\\([^.]*\\)\\'" v)
(intern (downcase (match-string 1 v))))))))
(dolist (varname '("LC_ALL" "LANG" "LC_CTYPE"))
(let ((encoding (sanityinc/locale-var-encoding (getenv varname))))
(unless (memq encoding '(nil utf8 utf-8))
(message "Warning: non-UTF8 encoding in environment variable %s may cause interop problems with this Emacs configuration." varname))))
(when (fboundp 'set-charset-priority)
(set-charset-priority 'unicode))
(prefer-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
(unless (eq system-type 'windows-nt)
(set-selection-coding-system 'utf-8))
(provide 'init-locales)
;;; init-locales.el ends here