Playdate on Emacs — some helpful elisp

Hi everyone,

Here is some Elisp that I use to make playdate dev a smidge easier. If there are any other emacs wonks, I'd consider turning it into en elisp package for distribution through melpa.

(use-package lua-mode)

(use-package luarocks)

(setenv "PLAYDATE_SDK_PATH" (expand-file-name "~/Developer/PlaydateSDK"))

(defun playdate/sdk-bin (binary)
  (shell-quote-argument (expand-file-name (concat (getenv "PLAYDATE_SDK_PATH")
                                                  "/bin/"
                                                  binary))))
(defun playdate/compile ()
   (interactive "")
   (when (not (file-directory-p (playdate/pdx-dir)))
     (make-directory (playdate/pdx-dir)))
   (projectile-run-shell-command-in-root
    (concat "pdc source "
            (shell-quote-argument(playdate/pdx-dir)))))


(defun playdate/pdx-dir()
  (interactive)
  (expand-file-name (concat (playdate/game-name) ".pdx")
                    (projectile-project-root)))

(defun playdate/run-emu ()
  (interactive)
  (shell-command
   (concat "/usr/bin/open "
           "-a "
           (playdate/sdk-bin "Playdate Simulator.app")
           " "                          
           (shell-quote-argument (playdate/pdx-dir)))))

(use-package ini
  :straight t)

(defun playdate/read-pdxinfo ()
  (cdr (assoc "pdxinfo"
               (ini-decode (expand-file-name "source/pdxinfo" (projectile-project-root))))))

(defun playdate/game-name ()
  (cdr (assoc "name" (playdate/read-pdxinfo))))
4 Likes

How does one setup eMac support?
I have a iMac G3 with OSX 10.3, is it possible to make everything run on it with this snippet?


I just realized that it has absolutely nothing to do with Apples eMac line of computers.

1 Like