0

I need a key binding of: M-x compile then in compile command type like Compile command: love2d /home/huseyin/Documents/Programming/Lua/ I am tired of doing that again and again.

1
1

Sure, just add something like this to your init file:

(defun oleg/compile-lua ()
  "use love2d to compile my lua code"
  (interactive)
  (compile "love2d /home/huseyin/Documents/Programming/Lua/"))
(global-set-key (kbd "<f5>") #'oleg/compile-lua)

You can name the function whatever you prefer, and bind it to whichever key you like.

3
  • thanks alot, it works great. Nov 24 '20 at 14:53
  • i want to do the same thing for Lua but in Lua you must write the name of the file, as a file i want the use the name of the current file . Is it possibble? Nov 24 '20 at 15:05
  • @olegharput Usually the variable buffer-file-name gives what you want. So easily you can just do string concat with that.
    – TerryTsao
    Nov 25 '20 at 4:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.