For nanonote (debian)-emacs users

Rubén Berenguel ruben at mostlymaths.net
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"
  (with-temp-buffer
    (insert-file-contents fpath)
    (split-string (buffer-string) "\n" t)))

(defun BatteryData ()
  (interactive)
  (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!

Ruben

-- 
====================================
* Rubén Berenguel
* http://www.mostlymaths.net
====================================




More information about the discussion mailing list


interactive