From: Francois Fleuret Date: Wed, 23 Jan 2013 13:32:11 +0000 (+0100) Subject: Highlight the battery level when below 20%. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=85c4238d46e71c1ded36f9ba912d66a6de4db708;p=elisp.git Highlight the battery level when below 20%. --- diff --git a/emacs.el b/emacs.el index f871271..525a118 100644 --- a/emacs.el +++ b/emacs.el @@ -830,8 +830,10 @@ printer." (ff/battery-percent "energy")))) ((string= battery-status "Discharging") - (format "B%d%%" (max (ff/battery-percent "charge") - (ff/battery-percent "energy")))) + (let* ((c (max (ff/battery-percent "charge") + (ff/battery-percent "energy"))) + (s (format "B%d%%" c))) + (if (>= c 20) s (propertize s 'face 'font-lock-warning-face)))) (t battery-status)