Anonymous avatar Anonymous committed 0e8f20e

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

Comments (0)

Files changed (2)

+2009-10-02  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* 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  <kehoea@parhasard.net>
 
 	* lisp/xwem-battery.el:

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."
   (xwem-interactive)
-     (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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.