Skip to content

Commit a1e0211

Browse files
committed
Fix locale issues with TeX
1 parent cc988c5 commit a1e0211

File tree

4 files changed

+35
-7
lines changed

4 files changed

+35
-7
lines changed

custom.el

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@
133133
(102 . "\\footcite[][]{%l}")
134134
(70 . "\\fullcite[]{%l}")
135135
(120 . "[]{%l}")
136-
(88 . "{%l}"))) t)
136+
(88 . "{%l}"))))
137137
'(reftex-default-bibliography
138138
(quote
139-
("/Users/ronert/Dropbox/bib/library.bib" "/Users/ronert/Dropbox/bib/rpackages.bib" "/Users/ronert/Dropbox/bib/websites.bib")) t)
139+
("/Users/ronert/Dropbox/bib/library.bib" "/Users/ronert/Dropbox/bib/rpackages.bib" "/Users/ronert/Dropbox/bib/websites.bib")))
140140
'(reftex-ref-style-alist
141141
(quote
142142
(("Default" t

init.el

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
33

44
;; No splash screen please ... jeez
5-
(setq inhibit-startup-message t)
5+
(setq inhibit-startupmessage t)
66

77
;; Set path to dependencies
88
(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))
@@ -27,6 +27,7 @@
2727
(defvar init-files
2828
'(
2929
;; Appearance
30+
init-locales
3031
init-appearance
3132
;;----------------------------------------------------------------------------
3233
;; Load configs for specific features and modes
@@ -104,10 +105,10 @@
104105
;;----------------------------------------------------------------------------;; Allow access from emacsclient
105106
;;----------------------------------------------------------------------------
106107
(add-hook 'after-init-hook
107-
(lambda ()
108-
(require 'server)
109-
(unless (server-running-p)
110-
(server-start))))
108+
(lambda ()
109+
(require 'server)
110+
(unless (server-running-p)
111+
(server-start))))
111112

112113
;;----------------------------------------------------------------------------;; Variables configured via the interactive 'customize' interface
113114
;;----------------------------------------------------------------------------

lisp/init-exec-path.el

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
(add-to-list 'exec-path "/usr/texbin:/usr/local/bin")
1717
(add-to-list 'exec-path "~/anaconda3/bin")
1818
(add-to-list 'exec-path "~/.local/bin")
19+
(exec-path-from-shell-copy-envs '("LANG" "LC_ALL" "LC_CTYPES"))
1920
)
2021
)
2122

lisp/init-locales.el

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

0 commit comments

Comments
 (0)