From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthew Leach Newsgroups: gmane.emacs.bugs Subject: bug#23216: 25.1.50; battery.el doesn't allow for exotic power supply types in sysfs. Date: Mon, 04 Apr 2016 16:09:54 +0000 Message-ID: <864mbh5p9p.fsf@cohex.co.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1459786347 26241 80.91.229.3 (4 Apr 2016 16:12:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Apr 2016 16:12:27 +0000 (UTC) To: 23216@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 04 18:12:11 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1an76p-0006oJ-Lf for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Apr 2016 18:12:11 +0200 Original-Received: from localhost ([::1]:59750 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1an76p-0003ZA-4I for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Apr 2016 12:12:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1an75o-0002BI-TU for bug-gnu-emacs@gnu.org; Mon, 04 Apr 2016 12:11:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1an75i-0002tr-Bn for bug-gnu-emacs@gnu.org; Mon, 04 Apr 2016 12:11:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54162) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1an75i-0002tn-7t for bug-gnu-emacs@gnu.org; Mon, 04 Apr 2016 12:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1an75i-0005D8-1Z for bug-gnu-emacs@gnu.org; Mon, 04 Apr 2016 12:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Matthew Leach Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Apr 2016 16:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 23216 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.145978622219984 (code B ref -1); Mon, 04 Apr 2016 16:11:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Apr 2016 16:10:22 +0000 Original-Received: from localhost ([127.0.0.1]:51289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1an754-0005CG-3k for submit@debbugs.gnu.org; Mon, 04 Apr 2016 12:10:22 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50481) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1an752-0005C2-7p for submit@debbugs.gnu.org; Mon, 04 Apr 2016 12:10:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1an74r-0002nX-Sg for submit@debbugs.gnu.org; Mon, 04 Apr 2016 12:10:15 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:35847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1an74r-0002nT-Px for submit@debbugs.gnu.org; Mon, 04 Apr 2016 12:10:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1an74l-0001f5-Bg for bug-gnu-emacs@gnu.org; Mon, 04 Apr 2016 12:10:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1an74e-0002iw-V1 for bug-gnu-emacs@gnu.org; Mon, 04 Apr 2016 12:10:03 -0400 Original-Received: from mx0.mattleach.net ([176.58.118.143]:59860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1an74e-0002ir-Lg for bug-gnu-emacs@gnu.org; Mon, 04 Apr 2016 12:09:56 -0400 Original-Received: by mx0.mattleach.net (Postfix, from userid 99) id 152F56222E; Mon, 4 Apr 2016 17:09:56 +0100 (BST) Original-Received: from armson.mattleach.net (host81-159-23-200.range81-159.btcentralplus.com [81.159.23.200]) by mx0.mattleach.net (Postfix) with ESMTPSA id 5AEA162226 for ; Mon, 4 Apr 2016 17:09:55 +0100 (BST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:116027 Archived-At: --=-=-= Content-Type: text/plain Hello, battery.el doesn't allow the customizing of the regexp used to filter folders under /sys/class/power_supply/. On more exotic systems, this doesn't necessarily have the name BAT[0-9]. For example, on my machine I have: matthew@armson /sys/class/power_supply $ ls bq27500-0 gpio-charger Attached is a patch that allows this value to be customized. Thanks, Matt In GNU Emacs 25.1.50.1 (armv7l-unknown-linux-gnueabihf, GTK+ Version 3.18.9) of 2016-04-03 built on armson Repository revision: f7c5f79ca565d3ef3feeb1e0af5ca261f1bcf58a Windowing system distributor 'The X.Org Foundation', version 11.0.11802000 Configured using: 'configure --prefix=/usr/local' Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Important settings: value of $LANG: C locale-coding-system: nil Major mode: Emacs-Lisp Minor modes in effect: magit-auto-revert-mode: t auto-revert-mode: t global-git-commit-mode: t async-bytecomp-package-mode: t shell-dirtrack-mode: t text-scale-mode: t diff-auto-refine-mode: t smartparens-mode: t hl-sexp-mode: t show-paren-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: Mark saved where search started battery-linux-sysfs-regexp C-x C-g is undefined Saving file /home/matthew/Development/emacs/lisp/battery.el... Wrote /home/matthew/Development/emacs/lisp/battery.el Mark set Mark saved where search started [2 times] Quit [2 times] Saving file /home/matthew/Development/emacs/lisp/battery.el... Wrote /home/matthew/Development/emacs/lisp/battery.el Load-path shadows: /home/matthew/.emacs.d/elpa/emms-20160304.920/tq hides /usr/local/share/emacs/25.1.50/lisp/emacs-lisp/tq Features: (shadow linum magit-blame magit-stash magit-bisect magit-remote magit-commit magit-sequence magit magit-apply magit-wip magit-log magit-diff smerge-mode magit-core magit-autorevert autorevert filenotify magit-process magit-popup magit-mode magit-git magit-section magit-utils git-commit log-edit pcvs-util add-log with-editor async-bytecomp async tramp-sh tramp tramp-compat tramp-loaddefs trampver ucs-normalize shell server jka-compr face-remap eieio-opt speedbar sb-image ezimage dframe find-func help-fns em-unix em-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl em-basic em-banner em-alias battery emacsbug vc vc-dispatcher vc-git map macrostep-c cmacexp macrostep flyspell whitespace cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs tsdh-light-theme mailalias smtpmail ispell bbdb-message sendmail nnir gnus-cite smiley shr-color color qp mm-archive mail-extr gnus-bcklg shr svg dom misearch multi-isearch gnus-async gnus-ml gnus-topic nndraft nnmh utf-7 nnfolder network-stream puny nsm starttls gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-cache gnus-sum bbdb-gnus bbdb-mua bbdb-com crm bbdb bbdb-site timezone gnus-demon nntp gnus-group gnus-undo gnus-article-treat-patch diff-mode gnus-start gnus-cloud nnimap nnmail mail-source tls gnutls utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range message rfc822 mml mml-sec epa derived epg mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus nnheader subr-x gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums mail-utils mm-util mail-prsvr wid-edit tsdh-dark-theme conf-toplev conf-sp smartparens dash conf-coffee conf-windmove windmove conf-whitespace conf-slime slime-repl slime-parse slime compile etags xref project arc-mode archive-mode noutline outline pp hyperspec browse-url conf-faces hl-sexp thingatpt conf-eshell em-term term disp-table ehelp em-smart pcomplete comint ansi-color ring esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode esh-util conf-erc conf-emms emms-librefm-stream xml emms-librefm-scrobbler emms-playlist-limit emms-volume easy-mmode emms-volume-amixer emms-i18n emms-history emms-score emms-stream-info emms-metaplaylist-mode emms-bookmarks emms-cue emms-mode-line-icon emms-browser sort emms-playlist-sort emms-last-played emms-player-xine emms-player-mpd tq emms-lyrics emms-url url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap emms-streams emms-show-all emms-tag-editor format-spec emms-mark emms-cache emms-info-ogginfo emms-info-mp3info emms-playlist-mode emms-player-vlc advice emms-source-playlist emms-source-file locate dired dired-loaddefs emms-player-mplayer emms-playing-time emms-player-simple emms-info later-do emms-setup emms-mode-line emms emms-compat conf-elisp conf-packages conf-dir conf-dired conf-c-mode conf-auctex conf-asm conf-ace-jump conf-personal ido seq edmacro kmacro paren finder-inf slime-autoloads info package epg-config url-handlers url-parse auth-source cl-seq eieio byte-opt bytecomp byte-compile cl-extra help-mode easymenu cconv eieio-core cl-macs gv eieio-loaddefs cl-loaddefs pcase cl-lib password-cache url-vars time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 8 481780 48466) (symbols 24 55472 0) (miscs 20 295 1628) (strings 16 109507 15863) (string-bytes 1 3721327) (vectors 8 73068) (vector-slots 4 1538007 53194) (floats 8 765 882) (intervals 28 7541 2713) (buffers 520 47) (heap 1024 55108 1933)) -- Matt --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Make-sysfs-file-name-regexp-in-battery.el-customizab.patch >From 1dd40b00d00b5690063ec2b7b0d3b08de41f02cb Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Mon, 4 Apr 2016 16:05:05 +0000 Subject: [PATCH] Make sysfs file name regexp in battery.el customizable. * lisp/battery.el (battery-linux-sysfs-regexp): Replace `battery--linux-sysfs-regexp' with defcustom. (battery-status-function): Rename to `battery-linux-sysfs-regexp'. (battery-linux-sysfs): Likewise. --- lisp/battery.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/battery.el b/lisp/battery.el index b5e312f..091980d 100644 --- a/lisp/battery.el +++ b/lisp/battery.el @@ -38,8 +38,11 @@ :prefix "battery-" :group 'hardware) -;; Either BATn or yeeloong-bat, basically. -(defconst battery--linux-sysfs-regexp "[bB][aA][tT][0-9]?$") +(defcustom battery-linux-sysfs-regexp "[bB][aA][tT][0-9]?$" + "Regexp for folder names to be searched under + /sys/class/power_supply/ that contain battery information." + :type 'regexp + :group 'battery) (defcustom battery-status-function (cond ((and (eq system-type 'gnu/linux) @@ -51,7 +54,7 @@ ((and (eq system-type 'gnu/linux) (file-directory-p "/sys/class/power_supply/") (directory-files "/sys/class/power_supply/" nil - battery--linux-sysfs-regexp)) + battery-linux-sysfs-regexp)) #'battery-linux-sysfs) ((and (eq system-type 'berkeley-unix) (file-executable-p "/usr/sbin/apm")) @@ -445,7 +448,7 @@ The following %-sequences are provided: (dolist (dir (ignore-errors (directory-files "/sys/class/power_supply/" t - battery--linux-sysfs-regexp))) + battery-linux-sysfs-regexp))) (erase-buffer) (ignore-errors (insert-file-contents (expand-file-name "uevent" dir))) -- 2.8.0 --=-=-=--