Fixed an ugly bug when there are encoding problems with the ICE media infos.
[elisp.git] / emacs.el
index 8060a20..ac9782c 100644 (file)
--- a/emacs.el
+++ b/emacs.el
@@ -31,9 +31,9 @@
 ;; Xft.antialias: true
 ;; Xft.rgba: rgb
 
-(set-default-font "Inconsolata 15")
+;; (set-default-font "Inconsolata 15")
 
-;; (set-default-font "Bitstream vera sans mono-12")
+(set-default-font "Bitstream vera sans mono-12")
 ;; (set-default-font "Liberation Mono-13")
 ;; (set-default-font "DejaVu sans mono 15")
 ;; (set-default-font "Droid sans mono 13")
@@ -340,6 +340,7 @@ load-warning buffer in case of failure."
                                                 (flyspell-mode))))
 
 (add-hook 'c++-mode-hook 'flyspell-prog-mode)
+(add-hook 'lua-mode-hook 'flyspell-prog-mode)
 (add-hook 'log-edit-mode-hook 'flyspell-mode)
 
 ;; I am a power-user
@@ -452,6 +453,7 @@ load-warning buffer in case of failure."
      (fringe :background "gray80")
      (ff/date-info-face :foreground "white")
      (ff/battery-info-face :foreground "black")
+     (ff/battery-info-alarm-face :foreground "red")
      ;; (ff/mail-alarm-face :foreground "white" :background "red2")
      ;; (alarm-vc-face :foreground "black" :background "yellow" :weight 'normal)
      (gui-button-face :background "green" :foreground "black")
@@ -505,6 +507,7 @@ load-warning buffer in case of failure."
      (region :background "white" :foreground "black")
      (ff/date-info-face :foreground "white" :weight 'bold)
      (ff/battery-info-face :foreground "black")
+     (ff/battery-info-alarm-face :foreground "red")
      ;; (ff/mail-alarm-face :foreground "red" :weight 'bold)
      (selector/selection :background "yellow")
      (gui-button-face :background "green" :foreground "white")
@@ -878,9 +881,25 @@ printer."
              ;; (`charging (format "c%d%%" (ff/battery-percent)))
              ;; (`discharging (format "d%d%%" (ff/battery-percent)))
              ;; (`unknown "f")
-             (`charging (format "↑%d%%" (ff/battery-percent)))
-             (`discharging (format "↓%d%%" (ff/battery-percent)))
-             (`unknown "✱")
+
+             (`charging
+              (let ((p (ff/battery-percent)))
+                (if (> p 10)
+                    (propertize (format "↑%d%%" p) 'face 'ff/battery-info-face)
+                  (propertize (format "↑%d%%" p) 'face 'ff/battery-info-alarm-face))
+                )
+              )
+
+             (`discharging
+              (let ((p (ff/battery-percent)))
+                (if (> p 10)
+                    (propertize (format "↓%d%%" p) 'face 'ff/battery-info-face)
+                  (propertize (format "↓%d%%" p) 'face 'ff/battery-info-alarm-face))
+                )
+              )
+
+             ;; (`unknown "✱")
+             (`unknown "F")
              (_ "?"))
          (error nil))
        )
@@ -943,13 +962,15 @@ printer."
 
                              " "
 
-                             ,@(when (ff/battery-info-string)
+                             ,@(when (ff/temp-info-string)
                                  '((ff/temp-info-string)))
 
                              ,@(when (ff/battery-info-string)
-                                 '((propertize
-                                    (ff/battery-info-string)
-                                    'face 'ff/battery-info-face)))
+                                 '((ff/battery-info-string)))
+
+                                 ;; '((propertize
+                                    ;; (ff/battery-info-string)
+                                    ;; 'face 'ff/battery-info-face)))
 
                              " "
 
@@ -2078,7 +2099,7 @@ This may be a useful alternative binding for \\[delete-other-windows]
            (while (re-search-forward "[0-9\.]+" nil t)
              (let ((value (string-to-number (buffer-substring (match-beginning 0) (match-end 0)))))
                (delete-region (match-beginning 0) (match-end 0))
-               (insert (format "%0.2f" value)))))))
+               (insert (format "%0.3f" value)))))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Keymaping