Now on revision 107886. ------------------------------------------------------------ revno: 107886 committer: Chong Yidong branch nick: trunk timestamp: Fri 2012-04-13 14:22:01 +0800 message: Fix typo in last commit. diff: === modified file 'src/indent.c' --- src/indent.c 2012-04-13 06:20:39 +0000 +++ src/indent.c 2012-04-13 06:22:01 +0000 @@ -957,7 +957,7 @@ } DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, - "NMove to column:", + "NMove to column: ", doc: /* Move point to column COLUMN in the current line. Interactively, COLUMN is the value of prefix numeric argument. The column of a character is calculated by adding together the widths ------------------------------------------------------------ revno: 107885 author: Reuben Thomas committer: Chong Yidong branch nick: trunk timestamp: Fri 2012-04-13 14:20:39 +0800 message: * src/indent.c (Fmove_to_column): Change interactive spec. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-04-12 23:47:13 +0000 +++ etc/NEWS 2012-04-13 06:20:39 +0000 @@ -37,6 +37,10 @@ * Editing Changes in Emacs 24.2 + +** M-x move-to-column, if called interactively with no prefix arg, now +prompts for a column number. + * Changes in Specialized Modes and Packages in Emacs 24.2 === modified file 'src/ChangeLog' --- src/ChangeLog 2012-04-11 11:43:55 +0000 +++ src/ChangeLog 2012-04-13 06:20:39 +0000 @@ -1,3 +1,7 @@ +2012-04-13 Reuben Thomas + + * indent.c (Fmove_to_column): Change interactive spec (Bug#739). + 2012-04-11 Daniel Colascione * s/cygwin.h: The vfork the #define in cygwin.h was protecting === modified file 'src/indent.c' --- src/indent.c 2012-04-09 13:05:48 +0000 +++ src/indent.c 2012-04-13 06:20:39 +0000 @@ -956,7 +956,8 @@ return val >= column; } -DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p", +DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, + "NMove to column:", doc: /* Move point to column COLUMN in the current line. Interactively, COLUMN is the value of prefix numeric argument. The column of a character is calculated by adding together the widths ------------------------------------------------------------ revno: 107884 committer: Glenn Morris branch nick: trunk timestamp: Thu 2012-04-12 19:51:19 -0400 message: * doc/emacs/ack.texi (Acknowledgments): Don't mention obsolete mailpost.el. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2012-04-07 20:00:16 +0000 +++ doc/emacs/ChangeLog 2012-04-12 23:51:19 +0000 @@ -1,3 +1,7 @@ +2012-04-12 Glenn Morris + + * ack.texi (Acknowledgments): Don't mention obsolete mailpost.el. + 2012-04-07 Glenn Morris * emacsver.texi (EMACSVER): Bump version to 24.1.50. === modified file 'doc/emacs/ack.texi' --- doc/emacs/ack.texi 2012-02-29 08:31:30 +0000 +++ doc/emacs/ack.texi 2012-04-12 23:51:19 +0000 @@ -252,10 +252,6 @@ source tree to HTML. @item -Gary Delp wrote @file{mailpost.el}, an interface between RMAIL and the -@file{/usr/uci/post} mailer. - -@item Matthieu Devin wrote @file{delsel.el}, a package to make newly-typed text replace the current selection. ------------------------------------------------------------ revno: 107883 committer: Glenn Morris branch nick: trunk timestamp: Thu 2012-04-12 19:47:13 -0400 message: Obsolete lisp/mail/mailpost.el diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-04-11 07:06:42 +0000 +++ etc/NEWS 2012-04-12 23:47:13 +0000 @@ -43,7 +43,9 @@ ** erc will look up server/channel names via auth-source and use the channel keys found, if any. -** Obsolete modes +** Obsolete packages: + +*** mailpost.el *** mouse-sel.el === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-04-12 20:00:24 +0000 +++ lisp/ChangeLog 2012-04-12 23:47:13 +0000 @@ -1,3 +1,7 @@ +2012-04-12 Glenn Morris + + * mail/mailpost.el: Move to obsolete/. + 2012-04-12 Drew Adams * imenu.el (imenu--generic-function): Ignore invisible definitions === renamed file 'lisp/mail/mailpost.el' => 'lisp/obsolete/mailpost.el' --- lisp/mail/mailpost.el 2011-01-15 23:16:57 +0000 +++ lisp/obsolete/mailpost.el 2012-04-12 23:47:13 +0000 @@ -9,6 +9,7 @@ ;; Maintainer: FSF ;; Created: 13 Jan 1986 ;; Keywords: mail +;; Obsolete-since: 24.2 ;;; Commentary: ------------------------------------------------------------ revno: 107882 fixes bug(s): http://debbugs.gnu.org/10123 author: Drew Adams committer: Lars Magne Ingebrigtsen branch nick: trunk timestamp: Thu 2012-04-12 22:00:24 +0200 message: * imenu.el (imenu--generic-function): Ignore invisible definitions. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-04-12 15:58:53 +0000 +++ lisp/ChangeLog 2012-04-12 20:00:24 +0000 @@ -1,3 +1,8 @@ +2012-04-12 Drew Adams + + * imenu.el (imenu--generic-function): Ignore invisible definitions + (bug#10123). + 2012-04-12 Vivek Dasmohapatra * hexl.el (hexl-bits): New variable. === modified file 'lisp/imenu.el' --- lisp/imenu.el 2012-04-11 21:37:13 +0000 +++ lisp/imenu.el 2012-04-12 20:00:24 +0000 @@ -800,7 +800,17 @@ (goto-char (point-max)) (while (and (if (functionp regexp) (funcall regexp) - (re-search-backward regexp nil t)) + (and + (re-search-backward regexp nil t) + ;; Do not count invisible definitions. + (let ((invis (invisible-p (point)))) + (or (not invis) + (progn + (while (and invis + (not (bobp))) + (setq invis (not (re-search-backward + regexp nil 'move)))) + (not invis)))))) ;; Exit the loop if we get an empty match, ;; because it means a bad regexp was specified. (not (= (match-beginning 0) (match-end 0)))) ------------------------------------------------------------ revno: 107881 fixes bug(s): http://debbugs.gnu.org/7515 author: Jari Aalto committer: Lars Magne Ingebrigtsen branch nick: trunk timestamp: Thu 2012-04-12 21:14:43 +0200 message: * processes.texi (Synchronous Processes): Mention `default-directory'. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-04-09 12:36:01 +0000 +++ doc/lispref/ChangeLog 2012-04-12 19:14:43 +0000 @@ -1,3 +1,8 @@ +2012-04-12 Jari Aalto + + * processes.texi (Synchronous Processes): Mention + `default-directory' (bug#7515). + 2012-04-09 Chong Yidong * customize.texi (Variable Definitions): Remove user-variable-p. === modified file 'doc/lispref/processes.texi' --- doc/lispref/processes.texi 2012-03-27 00:50:49 +0000 +++ doc/lispref/processes.texi 2012-04-12 19:14:43 +0000 @@ -268,6 +268,9 @@ @defun call-process program &optional infile destination display &rest args This function calls @var{program} and waits for it to finish. +The current working directory of the subprocess is +@code{default-directory}. + The standard input for the new process comes from file @var{infile} if @var{infile} is not @code{nil}, and from the null device otherwise. The argument @var{destination} says where to put the process output. ------------------------------------------------------------ revno: 107880 committer: Glenn Morris branch nick: trunk timestamp: Thu 2012-04-12 09:33:13 -0700 message: New defcustoms should get :version tags diff: === modified file 'lisp/hexl.el' --- lisp/hexl.el 2012-04-12 15:58:53 +0000 +++ lisp/hexl.el 2012-04-12 16:33:13 +0000 @@ -57,7 +57,8 @@ (const 16) (const 32) (const 64)) - :group 'hexl) + :group 'hexl + :version "24.2") (defcustom hexl-program "hexl" "The program that will hexlify and dehexlify its stdin. ------------------------------------------------------------ revno: 107879 fixes bug(s): http://debbugs.gnu.org/4941 author: Vivek Dasmohapatra committer: Lars Magne Ingebrigtsen branch nick: trunk timestamp: Thu 2012-04-12 17:58:53 +0200 message: Allow the user to alter the bit grouping in hexl.el * hexl.el (hexl-bits): New variable. (hexl-options): Mention the variable in the doc string. (hexl-rulerise): New function. (hexl-line-displen): New function (hexl-mode): Mention the new variable. (hexl-mode, hexl-current-address, hexl-current-address): Use the displen. (hexl-ascii-start-column): New function. (hexl-address-to-marker, hexl-beginning-of-line, hexl-options) (hexl-insert-char, hexl-mode-ruler): Use the displen. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-04-12 14:19:40 +0000 +++ lisp/ChangeLog 2012-04-12 15:58:53 +0000 @@ -1,3 +1,16 @@ +2012-04-12 Vivek Dasmohapatra + + * hexl.el (hexl-bits): New variable. + (hexl-options): Mention the variable in the doc string. + (hexl-rulerise): New function. + (hexl-line-displen): New function + (hexl-mode): Mention the new variable. + (hexl-mode, hexl-current-address, hexl-current-address): Use the + displen. + (hexl-ascii-start-column): New function. + (hexl-address-to-marker, hexl-beginning-of-line, hexl-options) + (hexl-insert-char, hexl-mode-ruler): Use the displen (bug#4941). + 2012-04-12 Agustín Martín Domingo * textmodes/flyspell.el (flyspell-large-region): For hunspell, use === modified file 'lisp/hexl.el' --- lisp/hexl.el 2012-01-19 07:21:25 +0000 +++ lisp/hexl.el 2012-04-12 15:58:53 +0000 @@ -51,6 +51,13 @@ "Edit a file in a hex dump format using the hexl filter." :group 'data) +(defcustom hexl-bits 16 + "The bit grouping that hexl will use." + :type '(choice (const 8 ) + (const 16) + (const 32) + (const 64)) + :group 'hexl) (defcustom hexl-program "hexl" "The program that will hexlify and dehexlify its stdin. @@ -67,7 +74,9 @@ (defcustom hexl-options (format "-hex %s" hexl-iso) "Space separated options to `hexl-program' that suit your needs. -Quoting cannot be used, so the arguments cannot themselves contain spaces." +Quoting cannot be used, so the arguments cannot themselves contain spaces. +If you wish to set the `-group-by-X-bits' options, set `hexl-bits' instead, +as that will override any bit grouping options set here." :type 'string :group 'hexl) @@ -212,10 +221,34 @@ (2 'hexl-ascii-region t t))) "Font lock keywords used in `hexl-mode'.") +(defun hexl-rulerise (string bits) + (let ((size (/ bits 4)) (strlen (length string)) (pos 0) (ruler "")) + (while (< pos strlen) + (setq ruler (concat ruler " " (substring string pos (+ pos size)))) + (setq pos (+ pos size))) + (substring ruler 1) )) + +(defvar hexl-rulers + (mapcar + (lambda (bits) + (cons bits + (concat " 87654321 " + (hexl-rulerise "00112233445566778899aabbccddeeff" bits) + " 0123456789abcdef"))) + '(8 16 32 64))) ;; routines (put 'hexl-mode 'mode-class 'special) +;; 10 chars for the "address: " +;; 32 chars for the hexlified bytes +;; 1 char for the space +;; 16 chars for the character display +;; X chars for the spaces (128 bits divided by the hexl-bits) +;; 1 char for the newline. +(defun hexl-line-displen () + "The length of a hexl display line (varies with `hexl-bits')." + (+ 60 (/ 128 (or hexl-bits 16)))) (defun hexl-mode--minor-mode-p (var) (memq var '(ruler-mode hl-line-mode))) @@ -248,7 +281,7 @@ Each line in the buffer has an \"address\" (displayed in hexadecimal) representing the offset into the file that the characters on this line are at and 16 characters from the file (displayed as hexadecimal -values grouped every 16 bits) and as their ASCII values. +values grouped every `hexl-bits' bits) and as their ASCII values. If any of the characters (displayed as ASCII characters) are unprintable (control or meta characters) they will be replaced as @@ -330,10 +363,7 @@ (hexlify-buffer) (restore-buffer-modified-p modified)) (set (make-local-variable 'hexl-max-address) - (let* ((full-lines (/ (buffer-size) 68)) - (last-line (% (buffer-size) 68)) - (last-line-bytes (% last-line 52))) - (+ last-line-bytes (* full-lines 16) -1))) + (+ (* (/ (1- (buffer-size)) (hexl-line-displen)) 16) 15)) (condition-case nil (hexl-goto-address original-point) (error nil))) @@ -510,17 +540,20 @@ (defun hexl-current-address (&optional validate) "Return current hexl-address." (interactive) - (let ((current-column (- (% (- (point) (point-min) -1) 68) 11)) + (let ((current-column + (- (% (- (point) (point-min) -1) (hexl-line-displen)) 11)) (hexl-address 0)) (if (< current-column 0) (if validate (error "Point is not on a character in the file") (setq current-column 0))) (setq hexl-address - (+ (* (/ (- (point) (point-min) -1) 68) 16) - (if (>= current-column 41) - (- current-column 41) - (/ (- current-column (/ current-column 5)) 2)))) + (+ (* (/ (- (point) (point-min) -1) + (hexl-line-displen)) 16) + (if (>= current-column (- (hexl-ascii-start-column) 10)) + (- current-column (- (hexl-ascii-start-column) 10)) + (/ (- current-column + (/ current-column (1+ (/ hexl-bits 4)))) 2)))) (when (called-interactively-p 'interactive) (message "Current address is %d/0x%08x" hexl-address hexl-address)) hexl-address)) @@ -531,10 +564,18 @@ (let ((addr (hexl-current-address))) (format "Current address is %d/0x%08x" addr addr))) +(defun hexl-ascii-start-column () + "Column at which the ascii portion of the hexl display starts." + (+ 43 (/ 128 hexl-bits))) + (defun hexl-address-to-marker (address) "Return buffer position for ADDRESS." (interactive "nAddress: ") - (+ (* (/ address 16) 68) 10 (point-min) (/ (* (% address 16) 5) 2))) + (let ((N (* (% address 16) 2))) + (+ (* (/ address 16) (hexl-line-displen)) ; hexl line no * display length + 10 ; 10 chars for the "address: " prefix + (point-min) ; base offset (point usually starts at 1, not 0) + (+ N (/ N (/ hexl-bits 4))) )) ) ; char offset into hexl display line (defun hexl-goto-address (address) "Go to hexl-mode (decimal) address ADDRESS. @@ -700,7 +741,7 @@ (defun hexl-beginning-of-line () "Goto beginning of line in hexl mode." (interactive) - (goto-char (+ (* (/ (point) 68) 68) 11))) + (goto-char (+ (* (/ (point) (hexl-line-displen)) (hexl-line-displen)) 11))) (defun hexl-end-of-line () "Goto end of line in hexl mode." @@ -776,6 +817,17 @@ ;00000000: 0011 2233 4455 6677 8899 aabb ccdd eeff 0123456789ABCDEF +(defun hexl-options (&optional test) + "Combine `hexl-bits' with `hexl-options', altering `hexl-options' as needed +to produce the command line options to pass to the hexl command." + (let ((opts (or test hexl-options))) + (when (memq hexl-bits '(8 16 32 64)) + (when (string-match "\\(.*\\)-group-by-[0-9]+-bits\\(.*\\)" opts) + (setq opts (concat (match-string 1 opts) + (match-string 2 opts)))) + (setq opts (format "%s -group-by-%d-bits " opts hexl-bits)) ) + opts)) + ;;;###autoload (defun hexlify-buffer () "Convert a binary buffer to hexl format. @@ -798,7 +850,7 @@ (mapcar (lambda (s) (if (not (multibyte-string-p s)) s (encode-coding-string s locale-coding-system))) - (split-string hexl-options))) + (split-string (hexl-options)))) (if (> (point) (hexl-address-to-marker hexl-max-address)) (hexl-goto-address hexl-max-address)))) @@ -815,7 +867,7 @@ (buffer-undo-list t)) (apply 'call-process-region (point-min) (point-max) (expand-file-name hexl-program exec-directory) - t t nil "-de" (split-string hexl-options)))) + t t nil "-de" (split-string (hexl-options))))) (defun hexl-char-after-point () "Return char for ASCII hex digits at point." @@ -912,12 +964,15 @@ (let ((address (hexl-current-address t))) (while (> num 0) (let ((hex-position - (+ (* (/ address 16) 68) + (+ (* (/ address 16) (hexl-line-displen)) 10 (point-min) (* 2 (% address 16)) (/ (% address 16) 2))) (ascii-position - (+ (* (/ address 16) 68) 51 (point-min) (% address 16))) + (+ (* (/ address 16) (hexl-line-displen)) + (hexl-ascii-start-column) + (point-min) + (% address 16))) at-ascii-position) (if (= (point) ascii-position) (setq at-ascii-position t)) @@ -933,7 +988,7 @@ (if at-ascii-position (progn (beginning-of-line) - (forward-char 51) + (forward-char (hexl-ascii-start-column)) (forward-char (% address 16))))) (setq num (1- num))))) @@ -1041,7 +1096,7 @@ (defun hexl-follow-ascii-find () "Find and highlight the ASCII element corresponding to current point." - (let ((pos (+ 51 + (let ((pos (+ (hexl-ascii-start-column) (- (point) (current-column)) (mod (hexl-current-address) 16)))) (move-overlay hexl-ascii-overlay pos (1+ pos)) @@ -1050,7 +1105,7 @@ (defun hexl-mode-ruler () "Return a string ruler for hexl mode." (let* ((highlight (mod (hexl-current-address) 16)) - (s " 87654321 0011 2233 4455 6677 8899 aabb ccdd eeff 0123456789abcdef") + (s (cdr (assq hexl-bits hexl-rulers))) (pos 0)) (set-text-properties 0 (length s) nil s) ;; Turn spaces in the header into stretch specs so they work @@ -1062,12 +1117,12 @@ `(space :align-to ,(1- pos)) s)) ;; Highlight the current column. - (put-text-property (+ 11 (/ (* 5 highlight) 2)) - (+ 13 (/ (* 5 highlight) 2)) - 'face 'highlight s) + (let ( (offset (+ (* 2 highlight) (/ (* 8 highlight) hexl-bits))) ) + (put-text-property (+ 11 offset) (+ 13 offset) 'face 'highlight s)) ;; Highlight the current ascii column - (put-text-property (+ 13 39 highlight) (+ 13 40 highlight) - 'face 'highlight s) + (put-text-property (+ (hexl-ascii-start-column) highlight 1) + (+ (hexl-ascii-start-column) highlight 2) + 'face 'highlight s) s)) ;; startup stuff. ------------------------------------------------------------ revno: 107878 committer: Agustin Martin branch nick: trunk timestamp: Thu 2012-04-12 16:19:40 +0200 message: textmodes/flyspell.el (flyspell-large-region): Specify encoding for hunspell with ("-i" ENCODING). As done for ispell in in r107799, in flyspell-large-region we also need to specify encoding for hunspell with ("-i" ENCODING), in 2 separate command-line arguments, as expected by hunspell. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-04-12 02:04:29 +0000 +++ lisp/ChangeLog 2012-04-12 14:19:40 +0000 @@ -1,3 +1,9 @@ +2012-04-12 Agustín Martín Domingo + + * textmodes/flyspell.el (flyspell-large-region): For hunspell, use + '("-i" ENCODING), in 2 separate command-line arguments, to specify + the encoding, as expected by hunspell. + 2012-04-12 Stefan Monnier * battery.el (battery--linux-sysfs-regexp): New const. === modified file 'lisp/textmodes/flyspell.el' --- lisp/textmodes/flyspell.el 2012-04-09 13:05:48 +0000 +++ lisp/textmodes/flyspell.el 2012-04-12 14:19:40 +0000 @@ -1576,10 +1576,11 @@ (if ispell-encoding8-command (setq args (append args - (list - (concat ispell-encoding8-command - (symbol-name - encoding)))))) + (if ispell-really-hunspell + (list ispell-encoding8-command + (upcase (symbol-name encoding))) + (list (concat ispell-encoding8-command + (symbol-name encoding))))))) (let ((process-coding-system-alist (list (cons "\\.*" encoding)))) (setq c (apply 'ispell-call-process-region beg ------------------------------------------------------------ revno: 107877 committer: Ken Brown branch nick: trunk timestamp: Thu 2012-04-12 08:17:20 -0400 message: * configure.in: Warn that Cygwin 1.5 is unsupported. (Bug#10398) diff: === modified file 'ChangeLog' --- ChangeLog 2012-04-11 01:25:51 +0000 +++ ChangeLog 2012-04-12 12:17:20 +0000 @@ -1,3 +1,7 @@ +2012-04-12 Ken Brown + + * configure.in: Warn that Cygwin 1.5 is unsupported. (Bug#10398) + 2012-04-11 Glenn Morris * configure.in (GNUSTEP_CFLAGS): Rename from C_SWITCH_X_SYSTEM. === modified file 'configure.in' --- configure.in 2012-04-11 01:25:51 +0000 +++ configure.in 2012-04-12 12:17:20 +0000 @@ -3800,6 +3800,13 @@ echo fi +if test "${opsys}" = "cygwin"; then + case `uname -r` in + 1.5.*) AC_MSG_WARN([[building Emacs on Cygwin 1.5 is not supported.]]) + echo + ;; + esac +fi # Remove any trailing slashes in these variables. [test "${prefix}" != NONE && ------------------------------------------------------------ revno: 107876 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-04-11 22:04:29 -0400 message: Make generic sysfs support apply for yeeloong as well. * lisp/battery.el (battery--linux-sysfs-regexp): New const. (battery-status-function): Use it. Remove yeeloong special case. (battery-yeeloong-sysfs): Remove. (battery-echo-area-format): Remove yeeloong special case. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-04-11 21:37:13 +0000 +++ lisp/ChangeLog 2012-04-12 02:04:29 +0000 @@ -1,3 +1,10 @@ +2012-04-12 Stefan Monnier + + * battery.el (battery--linux-sysfs-regexp): New const. + (battery-status-function): Use it. Remove yeeloong special case. + (battery-yeeloong-sysfs): Remove. + (battery-echo-area-format): Remove yeeloong special case. + 2012-04-11 Stefan Monnier * imenu.el (imenu-add-to-menubar): `current-local-map' can be nil. === modified file 'lisp/battery.el' --- lisp/battery.el 2012-04-10 23:24:31 +0000 +++ lisp/battery.el 2012-04-12 02:04:29 +0000 @@ -39,6 +39,9 @@ :prefix "battery-" :group 'hardware) +;; Either BATn or yeeloong-bat, basically. +(defconst battery--linux-sysfs-regexp "[bB][aA][tT][0-9]?$") + (defcustom battery-status-function (cond ((and (eq system-type 'gnu/linux) (file-readable-p "/proc/apm")) @@ -48,12 +51,9 @@ '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]$")) + (directory-files "/sys/class/power_supply/" nil + battery--linux-sysfs-regexp)) 'battery-linux-sysfs) - ((and (eq system-type 'gnu/linux) - (file-directory-p "/sys/class/power_supply/yeeloong-bat/") - (directory-files "/sys/class/power_supply/yeeloong-bat/" nil "charge_")) - 'battery-yeeloong-sysfs) ((and (eq system-type 'darwin) (condition-case nil (with-temp-buffer @@ -81,8 +81,6 @@ "Power %L, battery %B (%p%% load)") ((eq battery-status-function 'battery-pmset) "%L power, battery %B (%p%% load, remaining time %t)") - ((eq battery-status-function 'battery-yeeloong-sysfs) - "%L power, battery %B (%p%% load, remaining time %t)") (battery-status-function "Power %L, battery %B (%p%% load, remaining time %t)")) "Control string formatting the string to display in the echo area. @@ -448,7 +446,8 @@ (with-temp-buffer (dolist (dir (ignore-errors (directory-files - "/sys/class/power_supply/" t "BAT[0-9]$"))) + "/sys/class/power_supply/" t + battery--linux-sysfs-regexp))) (erase-buffer) (ignore-errors (insert-file-contents (expand-file-name "uevent" dir))) @@ -525,91 +524,6 @@ "AC" "BAT") "N/A"))))) - -(defun battery-yeeloong-sysfs () - "Get ACPI status information from Linux (the kernel). -This function works only on the Lemote Yeeloong. - -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 -%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'" - - (let (capacity - capacity-level - status - ac-online - hours - current-now - charge-full - charge-now) - - (with-temp-buffer - (ignore-errors - (insert-file-contents "/sys/class/power_supply/yeeloong-bat/uevent") - (goto-char 1) - (search-forward "POWER_SUPPLY_CHARGE_NOW=") - (setq charge-now (read (current-buffer))) - (goto-char 1) - (search-forward "POWER_SUPPLY_CHARGE_FULL=") - (setq charge-full (read (current-buffer))) - (goto-char 1) - (search-forward "POWER_SUPPLY_CURRENT_NOW=") - (setq current-now (read (current-buffer))) - (goto-char 1) - (search-forward "POWER_SUPPLY_CAPACITY_LEVEL=") - (setq capacity-level (buffer-substring (point) (line-end-position))) - (goto-char 1) - (search-forward "POWER_SUPPLY_STATUS=") - (setq status (buffer-substring (point) (line-end-position)))) - - (erase-buffer) - (ignore-errors - (insert-file-contents - "/sys/class/power_supply/yeeloong-ac/online") - (goto-char 1) - (setq ac-online (read (current-buffer))) - (erase-buffer))) - - - (setq capacity (round (/ (* charge-now 100.0) charge-full))) - (when (and current-now (not (= current-now 0))) - (if (< current-now 0) - ;; Charging - (setq hours (/ (- charge-now charge-full) (+ 0.0 current-now))) - ;; Discharging - (setq hours (/ charge-now (+ 0.0 current-now))))) - - (list (cons ?c (if charge-now - (number-to-string charge-now) - "N/A")) - (cons ?r current-now) - (cons ?B (cond ((equal capacity-level "Full") "full") - ((equal status "Charging") "charging") - ((equal capacity-level "Low") "low") - ((equal capacity-level "Critical") "critical") - (t "high"))) - (cons ?b (cond ((equal capacity-level "Full") " ") - ((equal status "Charging") "+") - ((equal capacity-level "Low") "-") - ((equal capacity-level "Critical") "!") - (t " "))) - (cons ?h (if hours (number-to-string hours) "N/A")) - (cons ?m (if hours (number-to-string (* 60 hours)) "N/A")) - (cons ?t (if hours - (format "%d:%d" - (/ (round (* 60 hours)) 60) - (% (round (* 60 hours)) 60)) - "N/A")) - (cons ?p (if capacity (number-to-string capacity) "N/A")) - (cons ?L (if (eq ac-online 1) "AC" "BAT"))))) ;;; `pmset' interface for Darwin (OS X).