emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: makefile-mode font-lock bugs and annoyances


From: Stefan Monnier
Subject: Re: makefile-mode font-lock bugs and annoyances
Date: Thu, 09 Jun 2005 10:10:47 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> 2. Highlighting of conditional constructs is broken:
>> 
>> ifdef FOO
>> blah
>> else
>> blah blah
>> endif
>> 
>> i) FOO does not get highlighted as a variable. Emacs-21.3 gets this
>> right.
>> ii) ifdef / else / endif do not get highlighted as keywords.
>> Emacs-21.3 gets this right.
>> 
>> 
> This is correct, because ifdef et al. are not keywords for make! The old
> makefile-mode mixed up make, gmake and automake, not allowing you to see
> when you wrote stuff for the wrong make into a makefile. In Emacs' own
> makefiles for example ifdef must *not* get highlighted for this very
> reason. (Maybe it should even signal an error when you type it, so you
> really notice :-)

> The problem here is that for backwards compatibility gmake will read in
> a Makefile when there is no GNUmakefile. That made some people get sloppy
> and actually write gmake constructs into plain Makefiles. There is
> a keybinding C-c C-m C-g for quickly switching to makefile-gmake-mode in
> such a case. There you get what you are looking for.

You mean the problem is that you make a decision (i.e. "this is a non-GNU
makefile") based on insufficient information.  I.e. you make a poor
decision.  The nature of Emacs is that it always has to be overly permissive
because it can rarely if ever know with enough certainty that something is
really wrong.  E.g. cc-mode will highlight an "else" even if it doesn't
follow an "if" and it will properly indent a call to "argc(1,2)" even if
`argc' is not a function.

Most BSD-only makefiles are called "Makefile"; most GNU-only makefiles are
called "Makefile"; ... you can't assume that if a file is called "Makefile"
it will be plain-old "make" (what is that anyway, SUSv3? SUSv2? SysV?).

So please revert the default make-mode to accept GNU-isms (as well as
BSD-isms, ...).  You can also additionally provide stricter derived modes
if you want, but the default should stay on the safe side and trust the user
that she knows what she's doing.
Or you can provide sanity-check functions (rather than derived modes) which
verify that the file doesn't use any GNU-isms, or BSD-isms.  Then users can
put those functions on their before-save-hook if they want to.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]