;ELC
;;; Compiled by LTX@Xue-LingTaos-MacBook-Pro.local on Wed Mar 16 23:09:09 2011
;;; from file /Users/LTX/Projects/Emacs/emacs/lisp/battery.el
;;; in Emacs version 24.0.50.1
;;; with all optimizations.

;;; This file contains utf-8 non-ASCII characters,
;;; and so cannot be loaded into Emacs 22 or earlier.
(and (boundp 'emacs-version)
     (< (aref emacs-version (1- (length emacs-version))) ?A)
     (string-lessp emacs-version "23")
     (error "`battery.el' was compiled for Emacs 23 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;


(byte-code "\300\301!\210\302\303\304\305\306\307\310\311&\207" [require timer custom-declare-group battery nil "Display battery status information." :prefix "battery-" :group hardware] 8)
#@298 Function for getting battery status information.
The function has to return an alist of conversion definitions.
Its cons cells are of the form

    (CONVERSION . REPLACEMENT-TEXT)

CONVERSION is the character code of a "conversion specification"
introduced by a `%' character in a control string.
(custom-declare-variable 'battery-status-function '(cond ((and (eq system-type 'gnu/linux) (file-readable-p "/proc/apm")) 'battery-linux-proc-apm) ((and (eq system-type 'gnu/linux) (file-directory-p "/proc/acpi/battery")) 'battery-linux-proc-acpi) ((and (eq system-type 'gnu/linux) (file-directory-p "/sys/class/power_supply/") (directory-files "/sys/class/power_supply/" nil "BAT[0-9]$")) 'battery-linux-sysfs) ((and (eq system-type 'darwin) (condition-case nil (with-temp-buffer (and (eq (call-process "pmset" nil t nil "-g" "ps") 0) (> (buffer-size) 0))) (error nil))) 'battery-pmset) ((eq system-type 'windows-nt) 'w32-battery-status)) '(#$ . 732) :type '(choice (const nil) function) :group 'battery)
#@801 Control string formatting the string to display in the echo area.
Ordinary characters in the control string are printed as-is, while
conversion specifications introduced by a `%' character in the control
string are substituted as defined by the current value of the variable
`battery-status-function'.  Here are the ones generally available:
%c Current capacity (mAh or mWh)
%r Current rate of charge or discharge
%B Battery status (verbose)
%b Battery status: empty means high, `-' means low,
   `!' means critical, and `+' means charging
%d Temperature (in degrees Celsius)
%L AC line status (verbose)
%p Battery load percentage
%m Remaining time (to charge or discharge) in minutes
%h Remaining time (to charge or discharge) in hours
%t Remaining time (to charge or discharge) in the form `h:min'
(custom-declare-variable 'battery-echo-area-format '(cond ((eq battery-status-function 'battery-linux-proc-acpi) "Power %L, battery %B at %r (%p%% load, remaining time %t)") ((eq battery-status-function 'battery-linux-sysfs) "Power %L, battery %B (%p%% load)") ((eq battery-status-function 'battery-pmset) "%L power, battery %B (%p%% load, remaining time %t)") (battery-status-function "Power %L, battery %B (%p%% load, remaining time %t)")) '(#$ . 1742) :type '(choice string (const nil)) :group 'battery)
#@37 String to display in the mode line.
(defvar battery-mode-line-string nil (#$ . 3055))
#@801 Control string formatting the string to display in the mode line.
Ordinary characters in the control string are printed as-is, while
conversion specifications introduced by a `%' character in the control
string are substituted as defined by the current value of the variable
`battery-status-function'.  Here are the ones generally available:
%c Current capacity (mAh or mWh)
%r Current rate of charge or discharge
%B Battery status (verbose)
%b Battery status: empty means high, `-' means low,
   `!' means critical, and `+' means charging
%d Temperature (in degrees Celsius)
%L AC line status (verbose)
%p Battery load percentage
%m Remaining time (to charge or discharge) in minutes
%h Remaining time (to charge or discharge) in hours
%t Remaining time (to charge or discharge) in the form `h:min'
(custom-declare-variable 'battery-mode-line-format '(cond ((eq battery-status-function 'battery-linux-proc-acpi) "[%b%p%%,%dÂ°C]") (battery-status-function "[%b%p%%]")) '(#$ . 3148) :type '(choice string (const nil)) :group 'battery)
#@57 Seconds after which the battery status will be updated.
(custom-declare-variable 'battery-update-interval '60 '(#$ . 4188) :type 'integer :group 'battery)
#@108 Upper bound of low battery load percentage.
A battery load percentage below this number is considered low.
(custom-declare-variable 'battery-load-low '25 '(#$ . 4350) :type 'integer :group 'battery)
#@118 Upper bound of critical battery load percentage.
A battery load percentage below this number is considered critical.
(custom-declare-variable 'battery-load-critical '10 '(#$ . 4556) :type 'integer :group 'battery)
#@24 Interval timer object.
(defvar battery-update-timer nil (#$ . 4776))
#@185 Display battery status information in the echo area.
The text being displayed in the echo area is controlled by the variables
`battery-echo-area-format' and `battery-status-function'.
(defalias 'battery #[nil "\302\303\203	\203\304	 \"\202\305\"\207" [battery-echo-area-format battery-status-function message "%s" battery-format "Battery status not available"] 5 (#$ . 4852) nil])
#@281 Non-nil if Display-Battery mode is enabled.
See the command `display-battery-mode' for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `display-battery-mode'.
(custom-declare-variable 'display-battery-mode 'nil '(#$ . 5248) :set 'custom-set-minor-mode :initialize 'custom-initialize-default :group 'battery :type 'boolean)
#@270 Display battery status information in the mode line.
The text being displayed in the mode line is controlled by the variables
`battery-mode-line-format' and `battery-status-function'.
The mode line will be updated automatically every `battery-update-interval'
seconds.
(defalias 'display-battery-mode #[(&optional arg) "\306 	\307=\203\n?\202\310	!\311V\312\f\204\313
\203$\314
!\210\n\2040\315\303\f\"\202@\316\304\303\317#\210\320\321 \322#\323 \210\324\325\n\203J\326\202K\327\"\210\330\331!\203p\332\302!\210\306 \203c\306 \232\203p\333\334\n\203m\335\202n\336\"\210)\337 \210\n\207" [#1=#:last-message arg display-battery-mode battery-mode-line-string global-mode-string battery-update-timer current-message toggle prefix-numeric-value 0 #2="" (#2#) cancel-timer delq add-to-list t run-at-time nil battery-update-handler battery-update run-hooks display-battery-mode-hook display-battery-mode-on-hook display-battery-mode-off-hook called-interactively-p any customize-mark-as-set message "Display-Battery mode %sabled" "en" "dis" force-mode-line-update battery-update-interval] 4 (#$ . 5699) (list (or current-prefix-arg 'toggle))])
(byte-code "\301\302\303\304\300!\205\n\303\211%\207" [display-battery-mode-map add-minor-mode display-battery-mode nil boundp] 6)
(defalias 'battery-update-handler #[nil "\300 \210\301\302!\207" [battery-update sit-for 0] 2])
#@53 Update battery status information in the mode line.
(defalias 'battery-update #[nil "\303\203	\203\304	 \"\202\305\306\307#\310 \207" [battery-mode-line-format battery-status-function battery-mode-line-string propertize battery-format "" help-echo "Battery status information" force-mode-line-update] 4 (#$ . 7096)])
#@54 Regular expression matching contents of `/proc/apm'.
(defconst battery-linux-proc-apm-regexp "^\\([^ ]+\\) \\([^ ]+\\) 0x\\([0-9a-f]+\\) 0x\\([0-9a-f]+\\) 0x\\([0-9a-f]+\\) 0x\\([0-9a-f]+\\) \\(-?[0-9]+\\)% \\(-?[0-9]+\\) \\(.*\\)$" (#$ . 7428))
#@658 Get APM status information from Linux kernel.
This function works only with the new `/proc/apm' format introduced
in Linux version 1.3.58.

The following %-sequences are provided:
%v Linux driver version
%V APM BIOS version
%I APM BIOS status (verbose)
%L AC line status (verbose)
%B Battery status (verbose)
%b Battery status, empty means high, `-' means low,
   `!' means critical, and `+' means charging
%p Battery load percentage
%s Remaining time (to charge or discharge) in seconds
%m Remaining time (to charge or discharge) in minutes
%h Remaining time (to charge or discharge) in hours
%t Remaining time (to charge or discharge) in the form `h:min'
(defalias 'battery-linux-proc-apm #[nil "\306\211\211\211\211\211\211\211\211\211\211\211>?@ABC\307\310!DrDq\210\311\216\306\312\313\217\210\314E!\203\315\316!C\315\317!B\320\315\321!\322\"\323\317\"\204T\324A\202\325A\323\322\"\203d\326A\202n\323\327\"\203n\330A\320\315\331!\322\"\211\332U\203\201\333@\202\226\316U\203\215\334@\202\226\317U\203\226\335@\320\315\336!\322\"\211\337U\203\251\340?\202\320\315\341!\322\"\211\332U\203\277\342?\343>\202\351\316U\203\316\344?\345>\202\351\317U\203\335\346?\347>\202\351\321U\203\351\350?\351>\315\352!\320\315\353!!\315\354!\355\230\203\377\f\356_\f\356\245\f\357\245\360\361\n\n\356_Z#+\362C\206\340B\363B\206!\340B\364A\206)\340B\365@\2061\340B\366?\2069\340B\367>\206A\343B\370
\206H\340B\371\f\203T\372\f!\206U\340B\373\203a\372!\206b\340B\374\n\203n\372\n!\206o\340B\375	\206v\340B\257.\f\207" [tem remaining-time hours minutes seconds load-percentage nil generate-new-buffer " *temp*" ((byte-code "\301!\203\n\302!\210\301\207" [#1=#:temp-buffer buffer-name kill-buffer] 2)) (insert-file-contents "/proc/apm") ((error)) re-search-forward match-string 1 2 string-to-number 3 16 logand "not supported" "enabled" "disabled" 32 "disengaged" 4 0 "off-line" "on-line" "on backup" 6 255 "N/A" 5 "high" "" "low" "-" "critical" "!" "charging" "+" 7 8 9 "min" 60 3600 format "%d:%02d" 118 86 73 76 66 98 112 115 number-to-string 109 104 116 battery-status-symbol battery-status line-status bios-interface bios-version driver-version #1# battery-linux-proc-apm-regexp] 13 (#$ . 7681)])
#@618 Get ACPI status information from Linux kernel.
This function works only with the `/proc/acpi/' format introduced
in Linux version 2.4.20 and 2.6.0.

The following %-sequences are provided:
%c Current capacity (mAh)
%r Current rate
%B Battery status (verbose)
%b Battery status, empty means high, `-' means low,
   `!' means critical, and `+' means charging
%d Temperature (in degrees Celsius)
%L AC line status (verbose)
%p Battery load percentage
%m Remaining time (to charge or discharge) in minutes
%h Remaining time (to charge or discharge) in hours
%t Remaining time (to charge or discharge) in the form `h:min'
(defalias 'battery-linux-proc-acpi #[nil "\306\211\307\306\211\307\211\211\211\211\211@ABCD\310\311!ErEq\210\312\216\307\313\314\217\307F\211G\203G@F\315 \210\307\316\317\217\210\320\321\307\322#\203\241\320\323\307\322#\203[\n\324\235\203[\325\326!\320\327\307\322#\203\215\f\206h\306\330\325\326!!\\\203\211\325\331!\230\203\202\206\332\333\325\331!#\206\214\325\331!\320\334\307\322#\203\241
\206\232\306\330\325\326!!\\db\210\307\335\336\217\210\320\321\307\322#\203\371\320\337\307\322#\203\303D\330\325\326!!\\D\320\340\307\322#\203\325C\330\325\326!!\\C\320\341\307\322#\203\347A\330\325\326!!\\A\320\342\307\322#\203\371@\330\325\326!!\\@GA\211G\2044-C\306V\203C\202DB
\203@\f\203@\343\f!\203%\306\202;\344\345\n\346\230\2034B
Z\2025
!\f\245\347_!\211\347\245\350
\203K\351
!\206L\352B\353\354\355\356\307\357\360\217\"\361\326#\206]\352B\362\354\355\363\307\364\365\217\"\366\326#\206n\352B\367\f\203}\351\f!\370Q\206~\352B\371\n\206\205\352B\372\n\346\230\203\221\373\202\260
\203\240
@W\203\240\374\202\260
\203\257
AW\203\257\375\202\260\376B\377\203\274\351!\206\275\352B\201H	\203\313\351	!\206\314\352B\201I	\203\344\201J\201K	\347_Z#\206\345\352B\201LB\203
\203B\306V\203\351\344
\345B!\362\245\245!!\206	\352B\257\n.\207" [hours minutes charging-state rate-type rate capacity 0 nil generate-new-buffer " *temp*" ((byte-code "\301!\203\n\302!\210\301\207" [#1=#:temp-buffer buffer-name kill-buffer] 2)) (directory-files "/proc/acpi/battery/" t "\\`[^.]") ((error)) erase-buffer (byte-code "\301\302\303\"!\207" [dir insert-file-contents expand-file-name "state"] 4) ((error)) re-search-forward "present: +yes$" t "charging state: +\\(.*\\)$" ("unknown" "charged" nil) match-string 1 "present rate: +\\([0-9]+\\) \\(m[AW]\\)$" string-to-number 2 error "Inconsistent rate types (%s vs. %s)" "remaining capacity: +\\([0-9]+\\) m[AW]h$" (byte-code "\301\302\303\"!\207" [dir insert-file-contents expand-file-name "info"] 4) ((error)) "design capacity: +\\([0-9]+\\) m[AW]h$" "last full capacity: +\\([0-9]+\\) m[AW]h$" "design capacity warning: +\\([0-9]+\\) m[AW]h$" "design capacity low: +\\([0-9]+\\) m[AW]h$" zerop floor float "charging" 60 99 number-to-string "N/A" 76 battery-search-for-one-match-in-files mapcar #[(e) "\301P\207" [e "/state"] 2] (directory-files "/proc/acpi/ac_adapter/" t "\\`[^.]") ((error)) "state: +\\(.*\\)$" 100 #[(e) "\301P\207" [e "/temperature"] 2] (directory-files "/proc/acpi/thermal_zone/" t "\\`[^.]") ((error)) "temperature: +\\([0-9]+\\) C$" 114 " " 66 98 "+" "!" "-" "" 104 low warn full-capacity last-full-capacity design-capacity #1# dir #2=#:--cl-dolist-temp-- 109 116 format "%d:%02d" 112] 16 (#$ . 9977)])
#@313 Get ACPI status information from Linux kernel.
This function works only with the new `/sys/class/power_supply/'
format introduced in Linux version 2.4.25.

The following %-sequences are provided:
%c Current capacity (mAh or mWh)
%B Battery status (verbose)
%p Battery load percentage
%L AC line status (verbose)
(defalias 'battery-linux-sysfs #[nil "\306\307\310\311\312\313\314!r
q\210\315\216\306\316\317\217\3060\2111\203\2761@0\320 \210\306\321\322\217\210\323\324\306\325#\203\265eb\210\323\326\306\325#\203K\f\327\235\203K\330\331!\306\21123\323\332\306\325#\203\204\330\331!\2113\203\204\323\333\306\325#\203\204\330\331!\2112\203\204\3343!\\\n\3342!\\\202\264\323\335\306\325#\203\264\330\331!\2113\203\264\323\336\306\325#\203\264\330\331!\2112\203\264	\3343!\\\3342!\\*1A\2111\204!-\337\340V\204\314\n\340V\203\322\341\n!\202\345	\340V\204\336\340V\203\344\341!\202\345\342B\343\f\206\354\342B\344\340V\203\377\345\346\n\347_\245\"\202	\340V\203\345\346\347_	\245\"\202\342B\350\351\352!\203+\353\352\354D\355\340#\203'\356\202,\357\202,\342BF-\207" [energy-now energy-full charge-now charge-full charging-state #1=#:temp-buffer nil 0.0 0.0 0.0 0.0 generate-new-buffer " *temp*" ((byte-code "\301!\203\n\302!\210\301\207" [#1# buffer-name kill-buffer] 2)) (directory-files "/sys/class/power_supply/" t "BAT[0-9]$") ((error)) erase-buffer (byte-code "\301\302\303\"!\207" [dir insert-file-contents expand-file-name "uevent"] 4) ((error)) re-search-forward "POWER_SUPPLY_PRESENT=1$" t "POWER_SUPPLY_STATUS=\\(.*\\)$" ("Unknown" "Full" nil) match-string 1 "POWER_SUPPLY_CHARGE_FULL=\\([0-9]*\\)$" "POWER_SUPPLY_CHARGE_NOW=\\([0-9]*\\)$" string-to-number "POWER_SUPPLY_ENERGY_FULL=\\([0-9]*\\)$" "POWER_SUPPLY_ENERGY_NOW=\\([0-9]*\\)$" 99 0 number-to-string "N/A" 66 112 format "%.1f" 100 76 file-readable-p "/sys/class/power_supply/AC/online" battery-search-for-one-match-in-files "/sys/class/power_supply/ACAD/online" "1" "AC" "BAT" dir #2=#:--cl-dolist-temp-- now-string full-string] 8 (#$ . 13387)])
#@361 Get battery status information using `pmset'.

The following %-sequences are provided:
%L Power source (verbose)
%B Battery status (verbose)
%b Battery status, empty means high, `-' means low,
   `!' means critical, and `+' means charging
%p Battery load percentage
%h Remaining time in hours
%m Remaining time in minutes
%t Remaining time in the form `h:min'
(defalias 'battery-pmset #[nil "\306\211\211\211\211\211\211-\307\310!.r.q\210\311\216\306\312\313\217\210eb\210\314\315\306\316#\203\256\317\320!-\314\321\306\316#\203\256\322\323!\203\256\317\320!\324\225b\210\322\325!\203S\326\327\202w\330
!/W\203c\331\332\202w\330
!0W\203s\333\334\202w\335\336\314\337\306\316#\203\256\317\320!\330\317\340!!\330\317\341!!12\34221\343W\203\237\324\202\240\320\\!\3422\344_1\\!*+\345-\206\266\346B\347
\206\275\346B\350\f\206\304\346B\351\206\313\336B\352	\206\322\346B\353\206\331\346B\354\n\206\340\346B\257.\207" [minutes hours remaining-time battery-status-symbol battery-status load-percentage nil generate-new-buffer " *temp*" ((byte-code "\301!\203\n\302!\210\301\207" [#1=#:temp-buffer buffer-name kill-buffer] 2)) (byte-code "\300\301\302\303\302\304\305&\207" [call-process "pmset" nil t "-g" "ps"] 7) ((error)) re-search-forward "Currentl?y drawing from '\\(AC\\|Battery\\) Power'" t match-string 1 "^ -InternalBattery-0[ 	]+" looking-at "\\([0-9]\\{1,3\\}\\)%" 0 "; charging" "charging" "+" string-to-number "low" "-" "critical" "!" "high" "" "\\(\\([0-9]+\\):\\([0-9]+\\)\\) remaining" 2 3 number-to-string 30 60 76 "N/A" 112 66 98 104 109 116 power-source #1# battery-load-low battery-load-critical m h] 8 (#$ . 15475)])
#@35 Substitute %-sequences in FORMAT.
(defalias 'battery-format #[(format alist) "\301\302\303\304\211%\207" [format replace-regexp-in-string "%." #[(str) "\303H\211\304=\203\305\202\306	\n\"A\206\307)\207" [str char alist 1 37 "%" assoc ""] 4] t] 6 (#$ . 17171)])
#@177 Search REGEXP in the content of the files listed in FILES.
If a match occurred, return the parenthesized expression numbered by
MATCH-NUM in the match.  Otherwise, return nil.
(defalias 'battery-search-for-one-match-in-files #[(files regexp match-num) "\301\302!rq\210\303\216\304\305\215+\207" [#1=#:temp-buffer generate-new-buffer " *temp*" ((byte-code "\301!\203\n\302!\210\301\207" [#1# buffer-name kill-buffer] 2)) found (byte-code "\305\211\203(\n@\305\306\307\217\203!\310\305\311#\203!\312\313\314\f!\"\210\nA\211\204*\305\207" [files file #2=#:--cl-dolist-temp-- regexp match-num nil (byte-code "\301\302\211\211\303%\207" [file insert-file-contents nil replace] 6) ((error)) re-search-forward t throw found match-string] 5)] 2 (#$ . 17448)])
(provide 'battery)
