aidan  committed 0e8f20e

Avoid compile-time autoloading by compiler-macroexpand, xwem-battery.el

  • Participants
  • Parent commits 5f2f76b

Comments (0)

Files changed (2)

+2009-10-02  Aidan Kehoe  <>
+	* lisp/xwem-battery.el (xwem-battery-status): 
+	Turns out that #'compiler-macroexpand attempts the autoload for
+	any autoloaded functions it encounters in a form handed to it, so
+	if we define a compiler macro for #'values-list, compilation of
+	this file fails on 21.4, since #'apm-battery is defined at compile
+	time as an autoload.
+	So, use #'destructuring-bind instead of #'multiple-value-bind,
+	being careful to always return a three-element list in EXPR.
 2009-08-13  Aidan Kehoe  <>
 	* lisp/xwem-battery.el:

File lisp/xwem-battery.el

 (require 'xwem-load)
-;; Have compiled 21.4 code also work on XEmacs binaries with real support
-;; for multiple values, by avoiding runtime calls to #'values-list: 
-(eval-when-compile (when (eq 'identity (symbol-function 'values-list))
-                     (define-compiler-macro values-list (arg) arg)))
 ;;; Customisation
 (defgroup xwem-batt nil
   "Group to customise APM battery monitor."
 (define-xwem-command xwem-battery-status ()
   "Show battery status in xwem minibuffer."
-     (multiple-value-bind (ac-line status perc)
-         (values-list (apm-battery))
-       (xwem-message
-        'info "APM Battery: AC-line: %s, Status: %S, Percentage: %d%%"
-        (if ac-line "on" "off") status perc)))
+  (destructuring-bind
+      (ac-line status perc)
+      (or (apm-battery) '(nil nil nil))
+    (xwem-message
+     'info "APM Battery: AC-line: %s, Status: %S, Percentage: %d%%"
+     (if ac-line "on" "off") status perc)))
 ;;;###autoload(autoload 'xwem-battery-popup-menu "xwem-battery" nil t)
 (define-xwem-command xwem-battery-popup-menu (ev)