[Top][All Lists]

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

Re: html, css, and js modes working together

From: Tom Tromey
Subject: Re: html, css, and js modes working together
Date: Sat, 11 Feb 2017 10:46:16 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux)

>>>>> "Stefan" == Stefan Monnier <address@hidden> writes:

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).

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).

As for hooking in to auto-mode-alist or whatever, there are already ok
approaches to this, I think.  web-mode or the like can either prepend an
entry to auto-mode-alist, or even fset html-mode to point to their mode
function.  (web-mode in particular is funny because it tries to do
everything; so I suppose in theory if html-mode must be subjected to
alternatives, so should js-, css-, ... whatever web-mode adds next.)


reply via email to

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