[Top][All Lists]

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

Re: html, css, and js modes working together

From: Dmitry Gutov
Subject: Re: html, css, and js modes working together
Date: Sun, 12 Feb 2017 18:20:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0

On 11.02.2017 19:46, Tom Tromey wrote:

Stefan> To keep `html-mode` as the dispatch function for the various options
Stefan> (there's web-mode, mumamo's xhtml-mode, psgaml-mode, nxml-mode, ...).

The way I see it is that Emacs should come with something reasonable out
of the box.  Disabling a feature because it might cause difficulty for
some other mode that isn't in-tree is both a disservice to users (the
default Emacs is missing a useful feature) and a maintenance problem
(who knows what else is out there).

The default Emacs will have this feature if html-rich-mode is associated with *.html in auto-mode-alist.

Also, concretely speaking, these modes will have an easy time adapting.
In particular the new mode sets 4 local variables:

   (setq-local indent-line-function #'mhtml-indent-line)
   (setq-local parse-sexp-lookup-properties t)
   (setq-local syntax-propertize-function #'mhtml-syntax-propertize)
   (setq-local font-lock-fontify-region-function

... so all some other deriving mode would have to do is reset these (and
maybe not even parse-sexp-lookup-properties, since it's harmless).

How does your buffer-locals approach work?

In mmm-mode, you first call a major mode to get its values of indent-line-function and so on. Without them being available after calling html-mode, we'd have to hardcode an annoying amount of stuff, and become less resilient against renames.

reply via email to

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