Compare commits

...

3 Commits

Author SHA1 Message Date
Yushun Cheng fcd66772dc [emacs] Improve font settings. 2022-04-10 11:17:26 +08:00
Yushun Cheng 8aa91165c8 [emacs] Set prefer-coding-system to utf-8-unix. 2022-04-10 10:25:01 +08:00
Yushun Cheng 1a61ccb376 [emacs] Add chezmoi-location and switch mirrors smartly. 2022-04-10 10:22:30 +08:00
2 changed files with 25 additions and 18 deletions

View File

@ -19,10 +19,11 @@
:after (chezmoi)
:config
(setq package-archives
; '(("gnu" . "https://elpa.gnu.org/packages/")
; ("melpa" . "https://melpa.org/packages/")))
'(("gnu" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
("melpa" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/"))))
(if (equal chezmoi-location "PRC")
'(("gnu" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
("melpa" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/"))
'(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))))
;;; use-package.
(use-package use-package
@ -51,25 +52,29 @@
(setq ring-bell-function 'ignore)
;;; Encoding.
(prefer-coding-system 'utf-8)
(prefer-coding-system 'utf-8-unix)
;;; Emoji fonts
(unless (equal chezmoi-os "windows")
(defvar emoji-font-pairs '(("Noto Color Emoji" . 1)))
(dolist (emoji-font-pair emoji-font-pairs)
(set-fontset-font t 'unicode ; Override later.
(font-spec :family (car emoji-font-pair)))
(add-to-list 'face-font-rescale-alist emoji-font-pair)))
(dolist (emoji-font-pair
'(("Note Color Emoji" . 1)
("Segoe UI Emoji" . 0.8)))
(add-to-list 'face-font-rescale-alist emoji-font-pair))
(let ((emoji-font
(if (equal chezmoi-os "windows")
"Segoe UI Emoji"
"Noto Color Emoji")))
(set-fontset-font t 'unicode (font-spec :family emoji-font)))
;;; Chinese fonts.
(defvar chinese-char-sets '(han kana cjk-misc hangul kanbun bopomofo))
(defvar chinese-font-pairs
`(,(if (equal chezmoi-os "windows")
'("微软雅黑" . 1.1) '("Source Han Sans CN" . 1.2))))
(dolist (chinese-font-pair chinese-font-pairs)
(dolist (charset chinese-char-sets)
(set-fontset-font t charset (font-spec :family (car chinese-font-pair))))
(dolist (chinese-font-pair
'(("Source Han Sans CN" . 1.2)
("微软雅黑" . 1.1)))
(add-to-list 'face-font-rescale-alist chinese-font-pair))
(let ((chinese-font
(if (equal chezmoi-os "windows")
"微软雅黑"
"Source Han Sans CN")))
(set-fontset-font t 'han (font-spec :family chinese-font)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; PACKAGES

View File

@ -23,6 +23,8 @@
"The chezmoi data structure.")
(defvar chezmoi-os (gethash "os" (gethash "chezmoi" chezmoi-data))
"Operating system.")
(defvar chezmoi-location (gethash "location" (gethash "options" chezmoi-data))
"Geographical location.")
(defun chezmoi-cd ()
"Open chezmoi directory in dired."
(interactive)