emacs - tidy up the code
authorPeng Li <seudut@gmail.com>
Sat, 3 Dec 2016 12:41:05 +0000 (20:41 +0800)
committerPeng Li <seudut@gmail.com>
Sat, 3 Dec 2016 12:41:05 +0000 (20:41 +0800)
emacs.d/config.org

index 273249b..2322cf8 100644 (file)
@@ -574,15 +574,17 @@ Fix the issue in mode line when showing triangle
 
 set height in mode line
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
+  (defconst sd/mode-line-font-heigh 100
+    "Defaulet the fontsize on mode line.")
+
   (with-eval-after-load "powerline"
-    (if window-system
-        (progn 
-          (let* ((base-font-size (face-attribute 'default :height)))
-            ;; 100/140;0.8
-            (set-variable 'powerline-height (/ base-font-size 10))
-            (set-variable 'powerline-text-scale-factor (/ (float 100) base-font-size)))
-          (set-face-attribute 'mode-line nil :height 100)
-          (set-face-attribute 'mode-line-inactive nil :height 100))))
+    (when (display-graphic-p)
+      (set-face-attribute 'mode-line-inactive nil :height sd/mode-line-font-heigh)
+      (set-face-attribute 'mode-line nil :height sd/mode-line-font-heigh)
+      (let* ((base-font-size (face-attribute 'default :height)))
+        ;; 100/140;0.8
+        (set-variable 'powerline-height (/ base-font-size 10))
+        (set-variable 'powerline-text-scale-factor (/ (float sd/mode-line-font-heigh) base-font-size)))))
 #+END_SRC
 
 * IDO & SMEX