For nanonote (debian)-emacs users

Rubén Berenguel ruben at
Thu Jun 3 14:33:40 EDT 2010

Hi! If you add

(defun read-lines (fpath)
  "Return a list of lines of a file at at FPATH. Taken from Xah Lee's website"
    (insert-file-contents fpath)
    (split-string (buffer-string) "\n" t)))

(defun BatteryData ()
  (message  (concat "Battery at " (car (read-lines
"/sys/class/power_supply/battery/capacity")) "%%, "
  (car (read-lines "/sys/class/power_supply/battery/status")))))

(global-set-key [f8] 'BatteryData)

to your ~/.emacs file, when pressing f8 the message Battery at NN%,
charging/discharging will appear in your message zone, under the mode
line. Enjoy!


* Rubén Berenguel

More information about the discussion mailing list