Using emacs with z80asm

First off, I want to state I am not a lisp podgammer1)

OK, now that that is out of the way, this is what I added to my .emacs when I started using z80asm to work with z80 assembly code.  It adds ASM to the list of extensions that will put you into asm-mode for editing assembly code and defines the compile command the way I wanted it.  If there is a better way to do these tasks please let me know.

;;
;; mods for z80asm GEP-D 2008-02
;;
;;
;; add ".ASM" to asm-mode, does ".asm" already
;;
(setq auto-mode-alist (cons '
              ("\\.ASM$" . asm-mode)
                     auto-mode-alist))
;;
;; z80 compile
;;
;; if either a "Makefile" or "makefile" exists use it, otherwise
;; build a compile command where you get a listing and output such 
;; that running it on FILENAME.asm gets you FILENAME.lst and FILENAME.rom
;;
;; Then bind it to f5 'cus I'm use to it being there.
;;
(add-hook 'asm-mode-hook
      (function
       (lambda ()
         (unless (or (file-exists-p "makefile")
                     (file-exists-p "Makefile"))
           (make-local-variable 'compile-command)
           (setq compile-command
                 (concat "z80asm --input="
                         (buffer-file-name) " --output=" (file-name-sans-extens\
ion buffer-file-name) ".rom  --list=" (file-name-sans-extension buffer-file-nam\
e) ".lst" ))
                  (local-set-key [f5] 'compile)
                           ))))
;;
;; end of z80asm mods
;;

 — Greg Priest-Dorman 2008/02/20 13:47

1)
yeah, I know ain't spelled that way.