X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/33017fafd17d722e82a268e9b272f27df261e09d..ac0215a325f4226b73fd650318349395a6d88835:/lisp/battery.el diff --git a/lisp/battery.el b/lisp/battery.el index dcfe07121b..696b121465 100644 --- a/lisp/battery.el +++ b/lisp/battery.el @@ -1,6 +1,6 @@ ;;; battery.el --- display battery status information -*- coding: iso-8859-1 -*- -;; Copyright (C) 1997-1998, 2000-2012 Free Software Foundation, Inc. +;; Copyright (C) 1997-1998, 2000-2013 Free Software Foundation, Inc. ;; Author: Ralph Schleicher ;; Keywords: hardware @@ -31,8 +31,7 @@ ;;; Code: (require 'timer) -(eval-when-compile (require 'cl)) - +(eval-when-compile (require 'cl-lib)) (defgroup battery nil "Display battery status information." @@ -61,7 +60,7 @@ (> (buffer-size) 0))) (error nil))) 'battery-pmset) - ((eq system-type 'windows-nt) + ((fboundp 'w32-battery-status) 'w32-battery-status)) "Function for getting battery status information. The function has to return an alist of conversion definitions. @@ -360,16 +359,16 @@ The following %-sequences are provided: (when (re-search-forward "present: +yes$" nil t) (when (re-search-forward "design capacity: +\\([0-9]+\\) m[AW]h$" nil t) - (incf design-capacity (string-to-number (match-string 1)))) + (cl-incf design-capacity (string-to-number (match-string 1)))) (when (re-search-forward "last full capacity: +\\([0-9]+\\) m[AW]h$" nil t) - (incf last-full-capacity (string-to-number (match-string 1)))) + (cl-incf last-full-capacity (string-to-number (match-string 1)))) (when (re-search-forward "design capacity warning: +\\([0-9]+\\) m[AW]h$" nil t) - (incf warn (string-to-number (match-string 1)))) + (cl-incf warn (string-to-number (match-string 1)))) (when (re-search-forward "design capacity low: +\\([0-9]+\\) m[AW]h$" nil t) - (incf low (string-to-number (match-string 1))))))) + (cl-incf low (string-to-number (match-string 1))))))) (setq full-capacity (if (> last-full-capacity 0) last-full-capacity design-capacity)) (and capacity rate