+ ;; (defun org-src-color-blocks-light ()
+ ;; "Colors the block headers and footers to make them stand out more for lighter themes"
+ ;; (interactive)
+ ;; (custom-set-faces
+ ;; '(org-block-begin-line
+ ;; ((t (:underline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF"))))
+ ;; '(org-block-background
+ ;; ((t (:background "#FFFFEA"))))
+ ;; '(org-block
+ ;; ((t (:background "#FFFFEA"))))
+ ;; '(org-block-end-line
+ ;; ((t (:overline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF"))))
+
+ ;; '(mode-line-buffer-id ((t (:foreground "#005000" :bold t))))
+ ;; '(which-func ((t (:foreground "#008000"))))))
+
+ ;; (defun org-src-color-blocks-dark ()
+ ;; "Colors the block headers and footers to make them stand out more for dark themes"
+ ;; (interactive)
+ ;; (custom-set-faces
+ ;; '(org-block-begin-line
+ ;; ((t (:foreground "#008ED1" :background "#002E41"))))
+ ;; '(org-block-background
+ ;; ((t (:background "#000000"))))
+ ;; '(org-block
+ ;; ((t (:background "#000000"))))
+ ;; '(org-block-end-line
+ ;; ((t (:foreground "#008ED1" :background "#002E41"))))
+
+ ;; '(mode-line-buffer-id ((t (:foreground "black" :bold t))))
+ ;; '(which-func ((t (:foreground "green"))))))
+
+ ;; (org-src-color-blocks-dark)
+
+#+END_SRC
+
+improve color for org-mode
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ ;; (deftheme ha/org-theme "Sub-theme to beautify org mode")
+
+ ;; (if window-system
+ ;; (defvar sd/variable-font-tuple
+ ;; (cond ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro"))
+ ;; ((x-list-fonts "Lucida Grande") '(:font "Lucida Grande"))
+ ;; ((x-list-fonts "Verdana") '(:font "Verdana"))
+ ;; ((x-family-fonts "Sans Serif") '(:family "Sans Serif"))
+ ;; (nil (warn "Cannot find a Sans Serif Font. Install Source Sans Pro.")))
+ ;; "My variable width font available to org-mode files and whatnot."))
+
+ ;; (defun sd/org-color ()
+ ;; (let* ((sd/fixed-font-tuple (list :font sd/fixed-font-family))
+ ;; (base-font-color (face-foreground 'default nil 'default))
+ ;; (background-color (face-background 'default nil 'default))
+ ;; (primary-color (face-foreground 'mode-line nil))
+ ;; (secondary-color (face-background 'secondary-selection nil 'region))
+ ;; (base-height (face-attribute 'default :height))
+ ;; (headline `(:inherit default :weight bold :foreground ,base-font-color)))
+ ;; (custom-theme-set-faces 'ha/org-theme
+ ;; `(org-agenda-structure ((t (:inherit default :height 2.0 :underline nil))))
+ ;; `(org-verbatim ((t (:inherit 'fixed-pitched :foreground "#aef"))))
+ ;; `(org-table ((t (:inherit 'fixed-pitched))))
+ ;; `(org-block ((t (:inherit 'fixed-pitched))))
+ ;; `(org-block-background ((t (:inherit 'fixed-pitched))))
+ ;; `(org-block-begin-line ((t (:inherit 'fixed-pitched))))
+ ;; `(org-block-end-line ((t (:inherit 'fixed-pitched))))
+ ;; `(org-level-8 ((t (,@headline ,@sd/variable-font-tuple))))
+ ;; `(org-level-7 ((t (,@headline ,@sd/variable-font-tuple))))
+ ;; `(org-level-6 ((t (,@headline ,@sd/variable-font-tuple))))
+ ;; `(org-level-5 ((t (,@headline ,@sd/variable-font-tuple))))
+ ;; `(org-level-4 ((t (,@headline ,@sd/variable-font-tuple
+ ;; :height ,(round (* 1.1 base-height))))))
+ ;; `(org-level-3 ((t (,@headline ,@sd/variable-font-tuple
+ ;; :height ,(round (* 1.25 base-height))))))
+ ;; `(org-level-2 ((t (,@headline ,@sd/variable-font-tuple
+ ;; :height ,(round (* 1.5 base-height))))))
+ ;; `(org-level-1 ((t (,@headline ,@sd/variable-font-tuple
+ ;; :height ,(round (* 1.75 base-height))))))
+ ;; `(org-document-title ((t (,@headline ,@sd/variable-font-tuple :height 1.5 :underline nil)))))))
+
+
+#+END_SRC
+
+
+
+** Rainbow-delimiter
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package rainbow-delimiters
+ :ensure t
+ :init
+ (add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
+#+END_SRC
+
+** page-break-lines
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package page-break-lines
+ :ensure t
+ :config
+ (global-page-break-lines-mode))
+#+END_SRC
+
+** rainbow-mode
+
+Enable rainbow mode in emacs lisp mode
+
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package rainbow-mode
+ :ensure t
+ ; :init
+ ; (add-hook emacs-lisp-mode-hook 'rainbow-mode)
+ )
+
+#+END_SRC
+
+** cusor color
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (if (display-graphic-p)
+ (set-cursor-color 'red))
+#+END_SRC
+
+* Font Settingh
+** font lock
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (global-font-lock-mode 1)
+#+END_SRC
+
+** fonts family
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (defvar my-font-family
+ (cond ((x-list-fonts "Source Code Pro") "Source Code Pro"))
+ (cond ((x-list-fonts "HanziPen SC") "HanziPen SC"))
+ ;; (cond ((x-list-fonts "Source Code Pro") "Source Code Pro:weight=light"))
+ )
+
+ ;; (when (display-graphic-p)
+ ;; (set-frame-font my-font-family)
+ ;; (set-face-attribute 'default nil :font my-font-family :height 120)
+ ;; (set-face-font 'default my-font-family))
+#+END_SRC
+
+** Chinese fonts
+
+Fix the font alignment issue when both Chinese and English hybird in org-mode table. Refer [fn:1]
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ ;; (defvar emacs-english-font "Source Code Pro:weight=light" "The font name of English.")
+ (defvar emacs-english-font "Source Code Pro" "The font name of English.")
+
+ ;; (defvar emacs-cjk-font "STHeiti" "The font name for CJK.")
+ (defvar emacs-cjk-font "HanziPen SC" "The font name for CJK.")
+
+ (defvar emacs-font-size-pair-list
+ '((5 . 6) (10 . 12)
+ (11 . 14) (12 . 14)
+ (13 . 16) (14 . 16) (15 . 18) (16 . 20) (17 . 20)
+ (18 . 22) (19 . 22) (20 . 24) (21 . 26)
+ (24 . 28) (26 . 32) (28 . 34)
+ (30 . 36) (34 . 40) (36 . 44))
+ "This list is used to store matching (englis . chinese) font-size.")
+ ;; (defvar emacs-font-size-pair '(13 . 16) "Default font size pair for (english . chinese)")
+
+ ;; (defvar emacs-font-size-pair '(13 . 16) "Default font size pair for (english . chinese)")
+
+ (defvar emacs-font-size-pair (nth 3 emacs-font-size-pair-list) "Default font size pair for (english . chinese)")
+
+ (defun font-exist-p (fontname)
+ "Test if this font is exist or not."
+ (if (or (not fontname) (string= fontname ""))
+ nil
+ (if (not (x-list-fonts fontname)) nil t)))
+
+ (defun set-font (english chinese size-pair)
+ "Setup emacs English and Chinese font on x window-system."
+ (if (font-exist-p english)
+ (set-frame-font english (format "%s:pixelsize=%d" english (car size-pair)) t)
+ ;; (set-face-attribute 'default nil :font english :height (* 10 (car size-pair)))
+
+ ;; (set-frame-font (format "%s:pixelsize=%d" english (car size-pair)) t)
+ )
+ (if (font-exist-p chinese)
+ (dolist (charset '(han cjk-misc) ;; '(kana han symbol cjk-misc bopomofo)
+ )
+ (set-fontset-font (frame-parameter nil 'font) charset
+ (font-spec :family chinese :size (cdr size-pair))))))
+
+ (defun emacs-step-font-size (step)
+ "Increase/Decrease emacs's font size."
+ (let ((scale-steps emacs-font-size-pair-list))
+ (if (< step 0) (setq scale-steps (reverse scale-steps)))
+ (setq emacs-font-size-pair
+ (or (cadr (member emacs-font-size-pair scale-steps))
+ emacs-font-size-pair))
+ (when emacs-font-size-pair
+ (message "emacs font size set to %.1f" (car emacs-font-size-pair))
+ (set-font emacs-english-font emacs-cjk-font emacs-font-size-pair))))
+
+ (defun increase-emacs-font-size ()
+ "Decrease emacs's font-size acording emacs-font-size-pair-list."
+ (interactive) (emacs-step-font-size 1))
+
+ (defun decrease-emacs-font-size ()
+ "Increase emacs's font-size acording emacs-font-size-pair-list."
+ (interactive) (emacs-step-font-size -1))
+
+ ; (set-font emacs-english-font emacs-cjk-font '(12 . 16))
+ ;; (set-font emacs-english-font emacs-cjk-font emacs-font-size-pair)
+#+END_SRC
+
+** Org Mode font
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (when (display-graphic-p)
+ (setq my-ch-font "STkaiti")
+ ;; (setq face-font-rescale-alist `(("HanziPen SC" . ,(/ 16.0 13))))
+ (setq face-font-rescale-alist `((,my-ch-font . ,(/ 16.0 13))))
+ ;; (set-face-attribute 'default nil :font "Source Code Pro-13")
+ (set-face-attribute 'default nil :font "Source Code Pro:weight=light" :height 130)
+ ;; (set-fontset-font t 'han (font-spec :family "STkaiti"))
+ ;; (set-fontset-font t 'cjk-misc (font-spec :family "STkaiti"))
+ (dolist (charset '(han cjk-misc))
+ (set-fontset-font (frame-parameter nil 'font) charset
+ ;; (font-spec :family "HanziPen SC")
+ (font-spec :family my-ch-font))))