+ enable lexical-scope everywhere (lexical-binding = t): ~5-10% faster startup; ~5-20% general boost + reduce consing, function calls & garbage collection by preferring cl-loop & dolist over lambda closures (for mapc[ar], add-hook, and various cl-lib filter/map/reduce functions) -- where possible + prefer functions with dedicated opcodes, like assq (see byte-defop's in bytecomp.el for more) + prefer pcase & cond (faster) over cl-case + general refactor for code readability + ensure naming & style conventions are adhered to + appease byte-compiler by marking unused variables with underscore + defer minor mode activation to after-init, emacs-startup or window-setup hooks; a customization opportunity for users + ensures custom functionality won't interfere with startup.
40 lines
1,015 B
EmacsLisp
40 lines
1,015 B
EmacsLisp
;;; lang/lua/config.el --- lua + Love2D -*- lexical-binding: t; -*-
|
|
|
|
(def-package! lua-mode
|
|
:mode "\\.lua$"
|
|
:interpreter "lua"
|
|
:init
|
|
(add-hook 'lua-mode-hook #'flycheck-mode)
|
|
:config
|
|
(set! :electric 'lua-mode :words '("else" "end"))
|
|
(set! :repl 'lua-mode #'+lua/repl)
|
|
|
|
;; sp's lua-specific rules are obnoxious, so we disable them
|
|
(setq sp-pairs (delete (assq 'lua-mode sp-pairs) sp-pairs)))
|
|
|
|
|
|
(def-package! company-lua
|
|
:when (featurep! :completion company)
|
|
:after lua-mode
|
|
:config
|
|
(set! :company-backend 'lua-mode '(company-lua company-yasnippet)))
|
|
|
|
|
|
(def-package! moonscript
|
|
:mode ("\\.moon$" . moonscript-mode)
|
|
:config
|
|
(set! :editorconfig :add '(moonscript-mode moonscript-indent-offset)))
|
|
|
|
|
|
;;
|
|
;; Frameworks
|
|
;;
|
|
|
|
(def-project-mode! +lua-love-mode
|
|
:modes (lua-mode markdown-mode json-mode)
|
|
:files (and "main.lua" "conf.lua")
|
|
:init
|
|
(set! :build 'run-love-app '+lua-love-mode
|
|
(lambda ()
|
|
(async-shell-command (format "open -a love.app '%s'" (doom-project-root))))))
|
|
|