Update of /project/movitz/cvsroot/movitz/ide
In directory clnet:/tmp/cvs-serv313
Modified Files:
movitz-slime.el
Log Message:
More complete ide: movitz-arglist, macroexpand, etc.
--- /project/movitz/cvsroot/movitz/ide/movitz-slime.el 2007/03/01 17:52:59 1.2
+++ /project/movitz/cvsroot/movitz/ide/movitz-slime.el 2007/03/03 18:34:58 1.3
@@ -49,12 +49,17 @@
(define-key movitz-mode-commands-map (car spec) (cadr spec)))
(define-key movitz-mode-map movitz-command-prefix movitz-mode-commands-map)
- (define-key movitz-mode-map "\C-c\C-d" 'movitz-dump-image)
+ (define-key movitz-mode-map "\C-cd" 'movitz-dump-image)
(define-key movitz-mode-map "\C-c\C-v" 'movitz-disassemble-defun)
(define-key movitz-mode-map "\C-c\C-b" 'movitz-compile-file)
(define-key movitz-mode-map "\C-\M-x" 'movitz-compile-defun)
(define-key movitz-mode-map "\C-cm" 'movitz-macroexpand)
- (define-key movitz-mode-map "\C-ca" 'movitz-arglist))
+ (define-key movitz-mode-map "\C-ca" 'movitz-arglist)
+ (define-key movitz-mode-map "\C-cd" 'movitz-dump-image-and-qemu)
+ (define-key movitz-mode-map "\M-." 'find-tag)
+ (define-key movitz-mode-map "\M-," 'tags-loop-continue)
+ (define-key movitz-mode-map "\r" 'newline-and-indent)
+ (define-key movitz-mode-map " " 'self-insert-command))
(movitz-init-command-keymap)
@@ -64,7 +69,7 @@
does."
(add-hook 'find-file-hooks
(defun movitz-auto-enable ()
- (when (string-match "/movitz/losp/.*\\.lisp$" (buffer-file-name))
+ (when (string-match ".*/movitz/losp/.*\\.lisp$" (buffer-file-name))
(movitz-mode 1)))))
@@ -96,6 +101,25 @@
(slime-eval-async `(movitz.ide:compile-defun ,(slime-defun-at-point) ,package-name)
(lambda (_) (message "Movitz compilation of %s '%s' finished." defun-type defun-name))))))
+(defun movitz-macroexpand ()
+ "Macroexpand the form at point."
+ (interactive)
+ (lexical-let ((form (slime-sexp-at-point-or-error))
+ (package-name (slime-current-package)))
+ (slime-eval-async `(movitz.ide:movitz-macroexpand ,form ,package-name)
+ (lambda (expansion)
+ (if (and (not (find 10 expansion))
+ (< (length expansion) 80))
+ (message "Movitz: \"%s\"" expansion)
+ (let ((buffer (get-buffer-create "*Movitz Macroexpand*")))
+ (with-current-buffer buffer
+ (delete-region 1 (point-max))
+ (common-lisp-mode)
+ (insert expansion)
+ (newline 2)
+ (pop-to-buffer buffer))))))))
+
+
(defun movitz-disassemble-fdefinition (symbol-name package-name)
"Show disassembly of the (non-generic) function at point."
(interactive (list (slime-read-symbol-name "Symbol: ")
@@ -139,6 +163,15 @@
;; (message "Movitz disassembling %s %s...done." defun-type defun-name))
(t (message "Don't know how to Movitz disassemble %s '%s'." defun-type defun-name))))))
+(defun movitz-arglist (string)
+ (interactive (list (slime-read-symbol-name "Movitz arglist of: ")))
+ (when (and string (plusp (length string)))
+ (lexical-let ((string string))
+ (slime-eval-async `(movitz.ide:movitz-arglist ,string ,(slime-current-package))
+ (lambda (result)
+ (message "Movitz args for %s: %s." string result))))))
+
+
(defvar movitz-default-image-file nil
"The default filename to dump images to.
This is set by `movitz-dump-image' and can also be preinitialized in
@@ -157,17 +190,24 @@
(lambda (_) (message "Finished."))))
-(defun movitz-dump-image-and-qemu ()
+(defun movitz-dump-image-and-qemu (filename)
"Dump the current image to FILENAME."
- (let ((filename (list (if (and (null current-prefix-arg)
- movitz-default-image-file)
- movitz-default-image-file
- (let ((filename (read-file-name "Image file: ")))
- (setq movitz-default-image-file filename)
- filename)))
- (message "Dumping..")
- (slime-eval-async `(movitz.ide:dump-image ,filename)
- (lambda (_) (message "Finished."))))
+ (interactive (list (if (and (null current-prefix-arg)
+ movitz-default-image-file)
+ movitz-default-image-file
+ (let ((filename (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)
+ (lambda (_)
+ (message "Dumping '%s'..done, starting quemu." filename)
+ (call-process "c:/progra~1/qemu/qemu"
+ nil 0 nil
+ "-L" "c:/progra~1/qemu"
+ "-fda" filename
+ "-boot" "a")))))
@@ -214,3 +254,12 @@
definition-type
lambda-list
nil)))))
+
+;;; Indentation of Movit syntax
+
+(let ((l '((with-inline-assembly . tagbody))))
+ (dolist (el l)
+ (put (car el) 'common-lisp-indent-function
+ (if (symbolp (cdr el))
+ (get (cdr el) 'common-lisp-indent-function)
+ (car (cdr el))))))
\ No newline at end of file