movitz-dump-image-and-qemu

Yoni Rabkin Katzenell <[email protected]> Mon, 21 May 2007 07:52:43 +0300
Newsgroups gmane.lisp.movitz.devel
Message-ID <[email protected]>
movitz-dump-image-and-qemu (C-c d) is a really convenient feature, if
only it worked under GNU/Linux. But something told me that with
hard-coded strings like "c:/progra~1/qemu/qemu" it was not going to
work.

The attached patch makes it work for me, with the addition of 

(setq movitz-mode-default-qemu-binary-path "/usr/bin/qemu") 
(setq movitz-mode-default-qemu-directory "/usr/share/qemu/") 

..in my .emacs.


-- 
   "Cut your own wood and it will warm you twice"
movitz-slime-dump-and-qemu.patch (text/x-patch, 2.1 KB)
Index: movitz-slime.el
===================================================================
RCS file: /project/movitz/cvsroot/movitz/ide/movitz-slime.el,v
retrieving revision 1.6
diff -u -r1.6 movitz-slime.el
--- movitz-slime.el	9 Apr 2007 16:00:00 -0000	1.6
+++ movitz-slime.el	20 May 2007 20:19:30 -0000
@@ -59,6 +59,14 @@
                                 ("D" movitz-dump-image))
   "Keys to bind in `movitz-mode-commands-map'.")
 
+(defvar movitz-mode-default-qemu-binary-path
+  "c:/progra~1/qemu/qemu"
+  "Default directory for the QEMU binary.")
+
+(defvar movitz-mode-default-qemu-directory
+  "c:/progra~1/qemu/qemu"
+  "Default directory for the QEMU -L option.")
+
 (defun movitz-init-command-keymap ()
   "Bind the movitz-mode keys.
 This command can be called interactively to redefine the keys."
@@ -212,18 +220,18 @@
   (interactive (list (if (and (null current-prefix-arg)
                               movitz-default-image-file)
                          movitz-default-image-file
-                       (let ((filename (read-file-name "Image file: ")))
+                       (let ((filename (expand-file-name (read-file-name "Image file: "))))
                          (setq movitz-default-image-file filename)
                          filename))))
   (lexical-let ((filename filename))
     (message "Dumping '%s'.." filename)
-    (slime-eval-async `(movitz.ide:dump-image ,filename)
+    (slime-eval-async `(movitz.ide:dump-image ,(file-name-nondirectory filename))
                       (lambda (_)
-                        (message "Dumping '%s'..done, starting quemu." filename)
-                        (call-process "c:/progra~1/qemu/qemu"
+                        (message "Dumping '%s'..done, starting qemu" filename)
+                        (call-process movitz-mode-default-qemu-binary-path
                                       nil 0 nil
                                       "-s"
-                                      "-L" "c:/progra~1/qemu"
+                                      "-L" movitz-mode-default-qemu-directory
                                       "-fda" filename
                                       "-boot" "a")))))