emacs-devel
[Top][All Lists]
Advanced

[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:39:01 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux)

Tom> I implemented the buffer-local-variables stuff last night, so I
Tom> will try removing this code soon.

This cleaned things up nicely; and in particular only minimal changes
are needed to the smie, js, and css modes now.

I am still having a problem that I could use help with.  My mode is
using cursor-sensor-functions to detect when point enters or leaves a
sub-mode's region.  When this happens the mode resets a bunch of
buffer-local variables.  For example, comment-start is modified
depending on the current region.

I discovered, though, that this doesn't do the right thing if I show an
mhtml-mode buffer in multiple windows.  For example if I enter a <style>
element in one window, and a <script> element in another window, then
switching between windows doesn't call cursor-sensor-functions, leaving
comment-start (et al) with the wrong values.

It seems to me that switching windows should call
cursor-sensor-functions.  What do you think?

Alternatively, what are my options?

I considered not remapping variables like this, and instead rebinding
the various comment-* functions to wrappers that would let-bind the
variables.  The difficulty here is that it's difficult to be sure all
the functions are wrapped, especially as Emacs evolves.

I could maybe listen to buffer-list-update-hook and do the same
remapping there?  Is there a more specific hook that could be used?

Tom



reply via email to

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