diff --git a/.gitmodules b/.gitmodules index 5820d9e..27a20de 100644 --- a/.gitmodules +++ b/.gitmodules @@ -124,3 +124,12 @@ [submodule "site-lisp/eslint-disable-rule"] path = site-lisp/eslint-disable-rule url = https://github.com/DamienCassou/eslint-disable-rule.git +[submodule "site-lisp/rainbow-identifiers"] + path = site-lisp/rainbow-identifiers + url = https://github.com/Fanael/rainbow-identifiers.git +[submodule "site-lisp/rainbow-delimiters"] + path = site-lisp/rainbow-delimiters + url = https://github.com/Fanael/rainbow-delimiters.git +[submodule "site-lisp/circadian"] + path = site-lisp/circadian + url = https://github.com/guidoschmidt/circadian.el.git diff --git a/lisp/init-theme.el b/lisp/init-theme.el index 24f138c..300f004 100644 --- a/lisp/init-theme.el +++ b/lisp/init-theme.el @@ -20,4 +20,67 @@ (add-to-list 'window-selection-change-functions #'creature/pulse-line) +;; address style +(add-hook 'erc-mode-hook #'goto-address-mode) +(add-hook 'text-mode-hook #'goto-address-mode) +(add-hook 'prog-mode-hook #'goto-address-prog-mode) + + +(autoload 'rainbow-delimiters-mode "rainbow-delimiters") +(autoload 'rainbow-identifiers-mode "rainbow-identifiers") +(dolist (mode '(rainbow-delimiters-mode rainbow-identifiers-mode)) + (add-hook 'prog-mode-hook mode)) + + +(require 'circadian) +(when (and (fboundp 'circadian-setup) + (custom-theme-name-valid-p 'modus-vivendi)) + (setq circadian-themes '(("08:00" . modus-operandi) + ("18:00" . modus-vivendi))) + (circadian-setup)) + + +(defconst creature/font-config + ;; '(("Operator Mono Book" . 16)) + (if (eq system-type 'windows-nt) + (if (> (frame-pixel-width) 2560) + '(("等距更纱黑体 SC" . 24)) + '(("等距更纱黑体 SC" . 16))) + '(("Sarasa Mono SC" . 16))) + ;; '(("Source Code Pro" . 16)) + "Font config. +It's a list of single-byte and multi-byte font. +Each font conf looks like (FAMILY . SIZE).") + +(defun creature/fontset (&optional frame) + "Config fonts for FRAME. +if FRAME is nil, setup for current frame." + ;; single-byte code + (setq inhibit-compacting-font-caches + (if (eq system-type 'window-nt) t nil)) + + (let ((single (car creature/font-config)) + (multi (cdr creature/font-config))) + (let ((family (car single)) + (size (cdr single))) + (when (or family size) + (condition-case nil + (set-face-attribute + 'default frame + :font (font-spec :family family :size size)) + (error nil)))) + (let ((family (car multi)) + (size (cdr multi))) + (when (member family (font-family-list)) + (dolist (charset '(kana han cjk-misc bopomofo)) + (condition-case nil + (set-fontset-font + t charset + (font-spec :family family :size size) frame) + (error nil))))))) + +(add-hook 'emacs-startup-hook #'creature/fontset) +(add-hook 'server-after-make-frame-hook #'creature/fontset) + + (provide 'init-theme) diff --git a/site-lisp/circadian b/site-lisp/circadian new file mode 160000 index 0000000..bf5a00e --- /dev/null +++ b/site-lisp/circadian @@ -0,0 +1 @@ +Subproject commit bf5a00ea45c14dfdcda72c5d9f61bcd230c48159 diff --git a/site-lisp/rainbow-delimiters b/site-lisp/rainbow-delimiters new file mode 160000 index 0000000..a32b39b --- /dev/null +++ b/site-lisp/rainbow-delimiters @@ -0,0 +1 @@ +Subproject commit a32b39bdfe6c61c322c37226d66e1b6d4f107ed0 diff --git a/site-lisp/rainbow-identifiers b/site-lisp/rainbow-identifiers new file mode 160000 index 0000000..19fbfde --- /dev/null +++ b/site-lisp/rainbow-identifiers @@ -0,0 +1 @@ +Subproject commit 19fbfded1baa98d12335f26f6d7b20e5ae44ce2e