Page 1 of 1
Question for emacs users
Posted: Fri Nov 30, 2012 11:15 am
by mongrol
Hi all,
Normally I do my C++ dev in Vim and used Emacs for orgmode only. Now I'm moving to Lua I fancy using Emacs for this. I have lua-mode installed and the love-mode as well. I can run my code using C-! "love ./" but any debug shows up printed graphically in the love window. I'd much rather it was in a emacs debug type of window where I can use it to skip to the error.
How do other Emacs users do their love dev?
Re: Question for emacs users
Posted: Fri Nov 30, 2012 3:56 pm
by bartbes
I'm not an emacs user, so I don't know exactly what you want. I do know, however, that all errors are printed on the terminal too, so if you catch the output of love, you should at least have it in emacs..
Re: Question for emacs users
Posted: Sat Dec 01, 2012 5:14 am
by the_leg
I use
Compilation mode to capture the output and hyperlink the error messages to the source code. To enter this mode, you type 'M-x compile'. You'll be prompted to enter the compile command (or accept the default 'make' command).
Here's part of my .emacs that sets this up. I bind C-x C-k to enter this mode.
Code: Select all
(global-set-key "\C-x\C-k" 'compile)
(add-hook 'lua-mode-hook
(lambda ()
(if (file-exists-p "main.lua")
(progn
(set (make-local-variable 'compile-command) "love . ")
(add-to-list 'compilation-error-regexp-alist 'love t)
(add-to-list 'compilation-error-regexp-alist-alist
'(love "^Error: Syntax error: \\(.*?\\):\\([0-9]+\\):.*$" 1 2) t))
(set (make-local-variable 'compile-command)
(concat "lua " (file-name-nondirectory buffer-file-name))))))
The above checks if main.lua exists in your current dir, and if so sets the compile command to be 'love .', otherwise it sets the compile command to 'lua <current-buffer-file-name>'. The regular expression is needed to handle LOVE's error message format.
I also use
flymake-lua. This checks the syntax of your Lua code as you type and highlights any errors. Here's how I set that up:
Code: Select all
(require 'flymake-lua)
(add-hook 'lua-mode-hook 'flymake-lua-load)
Let me know if you have any questions.
Re: Question for emacs users
Posted: Sun Dec 02, 2012 11:08 am
by mongrol
Great! Thanks very much.
Re: Question for emacs users
Posted: Mon Dec 03, 2012 8:19 pm
by ejmr
I am also a long-term Emacs user and started this project some time ago to help with LÖVE development:
https://github.com/ejmr/love-minor-mode
Please feel free to suggest any additions that may be useful; I will admit it does not do too much at the moment.