From: anhnmncb <anhnmncb@sina.com>
To: emacs-devel@gnu.org
Subject: Re: Need a function for fbsd-battery-status.
Date: Mon, 24 Nov 2008 07:36:13 +0800 [thread overview]
Message-ID: <87k5auvwuq.fsf@sina.com> (raw)
In-Reply-To: 86ej12jyso.fsf@oolong.tulipan.home
Nikolai Nespor <usenet@nespor.at> writes:
> (defun battery-freebsd-acpi ()
> (let* ((acpi-output (split-string
> (shell-command-to-string "sysctl -n hw.acpi.battery")))
> (battery-life-percentage (nth 0 acpi-output))
> (battery-life-time (nth 1 acpi-output))
> (battery-status-terse (cond
> ((< (string-to-number battery-life-time)
> 0) "+")
> ((> (string-to-number battery-life-percentage)
> 30) "")
> ((< (string-to-number battery-life-percentage)
> 31) "-")
> ((< (string-to-number battery-life-percentage)
> 15) "!")
> (t "?")))
> (retval ()))
> (when battery-life-percentage
> (setq retval (cons (cons ?p battery-life-percentage) retval)))
> (when battery-status-terse
> (setq retval (cons (cons ?b battery-status-terse) retval)))
> retval))
>
> HTH, Nikolai
Nice, thank you :)
prev parent reply other threads:[~2008-11-23 23:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-23 6:22 Need a function for fbsd-battery-status anhnmncb
2008-11-23 14:35 ` Nikolai Nespor
2008-11-23 23:36 ` anhnmncb [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k5auvwuq.fsf@sina.com \
--to=anhnmncb@sina.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.