Configure Emacs FlyMake to use Rakefile as well as Makefile

I learned to use Emacs for a while. While I like it.

My problem is that for small C codes, I prefer to use Rake instead of Make. However, flymake doesn't seem to want anything but Make. Because he complains that he cannot find the Makefile. From the command line, Rake is used in the same way as Make, so I was wondering if there was some kind of emacs configuration that I could introduce to allow Rake to use flymake?

To fix a little what I'm doing. I do not edit the Rakefile. And flymake-ruby doesn't help at all. I am working with C code. I just use RAKE to compile c code with gcc instead of MAKE.

+4
source share
3 answers

True, it turned out now; sorry for the earlier confusion.

Taking a quick look at flymake.el, for * .c files, the 'make' call ends up:

(defun flymake-get-make-cmdline (source base-dir) (list "make" (list "-s" "-C" base-dir (concat "CHK_SOURCES=" source) "SYNTAX_CHECK_MODE=1" "check-syntax"))) 

This is caused by flymake-simple-make-init , which is called because in order for *.c files to be displayed on flymake-allowed-file-name-masks .

So, the correct answer would be to change the flymake-allowed-file-name-masks to map *.c files to another init defun, and then write that defun to call rake the way you want. There are a ton of defuns that are already written for different things, and most of them are pretty short and clear - so even if you don’t know Emacs Lisp, you can probably work something with a minimum of futzing. (Actually, the correct answer would be to change flymake-simple-make-init so that the command name is read from the defcustom variable, then push this change back up ...)

A quick and dirty answer, given that you said that all you have to do is call rake with the same arguments as make, it would grab a copy of flymake.el, paste it at an early stage load-path and run the line "make" in flymake-get-make-cmdline to read "rake" instead. This will at least lead you to the next step ...

+2
source

Rake is Ruby syntax, so just including flymake for rby in a file should do it. This link is for someone from this code. EmacsWiki has many features for it . (In fact, you should read EmacsWiki in general, there is a lot of useful material.)

0
source

To continue what Charlie said, the FlymakeRuby node on EmacsWiki has exactly the code you need, including bits, to include it in rakefiles.

0
source

All Articles