X-Git-Url: https://git.korewanetadesu.com/?p=pico8.git;a=blobdiff_plain;f=pico8.el;h=95fcd2036190d7ef2daeba073c5a53f2f3361652;hp=3789d6612e4a9f0f008d1c49bebe50a0f2a12671;hb=8f8b10d094b14dc6b5fc8cf105a5ae456b02d42e;hpb=7283c676af9e41031d63d7ea407072f853a13445 diff --git a/pico8.el b/pico8.el index 3789d66..95fcd20 100644 --- a/pico8.el +++ b/pico8.el @@ -17,7 +17,7 @@ ;; of which is "real Lua" text and the other five of which have ;; diverse strict formatting requirements. ;; -;; It provides the keybinds and commands for inter-mode actions. +;; It provides keybindings and commands for inter-mode actions. ;;; Code: @@ -59,9 +59,10 @@ disabled by setting this to t." (defcustom pico8-lua-indent-level 1 "Default indentation for PICO-8 Lua mode. -This overrides lua-indent-mode in `pico8-lua-mode'. `lua-mode''s -default indentation is 3, which is both idiosyncractic and quite -large when viewed in the PICO-8 editor, where the convetion is 1." +This overrides `lua-indent-level' in `pico8-lua-mode'. +`lua-mode''s default indentation is 3, which is both +idiosyncratic and quite large when viewed in the PICO-8 editor, +where the convention is 1." :group 'pico8 :tag "PICO-8 Lua Indent Level") @@ -108,13 +109,13 @@ insert the typed character if it is one of these characters, overwriting one of these characters." (interactive "P") (when (memq (char-after) pico8-data-characters) - (let ((overwrite-mode t)) + (let ((overwrite-mode 'overwrite-mode-textual)) (self-insert-command (prefix-numeric-value n))))) (let ((map pico8-data-mode-map)) (suppress-keymap map) - (dolist (c pico8-data-characters) - (define-key map (format "%c" c) 'pico8-data-self-insert-command))) + (dolist (c (mapcar #'char-to-string pico8-data-characters)) + (define-key map c 'pico8-data-self-insert-command))) (defun pico8-goto-char (position) "Set point to POSITION, a number. @@ -310,7 +311,7 @@ to change `pico8-pixel-face'." ("f+" . 'pico8-pixel-f) ;; If the \n isn't in the smaller face the line is taller to - ;; accomodate the full sized point at the end-of-line. + ;; accommodate the full sized point at the end-of-line. ("\n" . 'pico8-pixel-0))) (defun pico8-gfx-current-position () @@ -453,9 +454,8 @@ this is the numeric literal in the code." (let ((beg (- (point) (% (min 255 (current-column)) 2)))) (string-to-number (buffer-substring beg (+ beg 2)) 16))) - ;; In Lua or other code, the sprite is a numeric literal. - ;; lua-mode doesn't derive from anything. - ((or (derived-mode-p 'lua-mode) (derived-mode-p 'prog-mode)) + ;; In Lua, the sprite is a numeric literal. + ((derived-mode-p 'lua-mode) (pico8--string-to-number (or (word-at-point) ""))) (t nil))) @@ -495,9 +495,6 @@ This function needs a lot of work.." (and (re-search-backward "\\" (- (point) 30) t) (char-after))))) - ;; FIXME: Actually parse something? lua-mode's sexp - ;; commands don't seem too good, and counting parentheses - ;; by hand is for nerds. (cond ((= c ?f) (pico8-goto-flag n)) ((= c ?s) (pico8-goto-sprite n)) (t (error "There's nothing obvious to go to")))))