unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: David Hansen <david.hansen@gmx.net>
To: help-gnu-emacs@gnu.org
Subject: Re: How to edit "mixed" (e.g. HTML/JavaScript) files?
Date: Thu, 08 Mar 2007 17:43:03 +0100	[thread overview]
Message-ID: <87k5xrhejs.fsf@localhorst.mine.nu> (raw)
In-Reply-To: 45F0349D.5060602@gmail.com

On Thu, 08 Mar 2007 17:06:53 +0100 Lennart Borgman wrote:
> I guess you mean that it is bad to switch major mode because of that
> it takes long time, or are there other reasons?
>
> If it is the time to change that is important, what do you believe
> is that takes too much time?

I guess mainly the first font-lock run.

> When it comes to fontification the approach with indirect buffers
> can not work, unfortunately, since text properties (which are used
> for fontification) are shared between the buffers.

multi-mode works (or at least tries to works) the way that
fontification happens region by region only in the relevant buffer.
In theory this should work (long time ago that i had a look at the
sources).

> This together with that a major mode wants to fontify the whole
> buffer

There's `font-lock-dont-widen' (I think one of the glitches of
multi-mode is that it doesn't set this and syntactic fontification
in one mode may screws it in the other mode).

> makes it impossible as far as I can see. (There is nothing
> in Emacs 22 beta that can remedy this either.)

Have a look at the multi-mode sources.  It's a relatively small,
clean coded and good commented package (no not by me ;).

For my taste this is a minor problem anyway as long as the text
around the part of code I'm currently editing looks OK (and if not
there's M-o M-o).

What terrible sucks is indentation if some construct spreads over
more than one region.  But at least it works reliable within one
region.  MMM mode can't even that.

I assume NXML mode won't be that happy too if you narrow it to one
region (or does it widen for it's syntax analysis?  Would probably
be even worse).

>> I hope this topic will get some more attention after the upcoming
>> (?) release of Emacs 22.
>
> Yes, that would be good. But I think we need some experiences then
> about what can work.


> As far as I can see switching major mode might not be that bad if it
> could be applied to a part of a buffer.

This always implies unnecessary refontification which IMHO is *very*
bad.

David

  reply	other threads:[~2007-03-08 16:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-06 19:45 How to edit "mixed" (e.g. HTML/JavaScript) files? kj
2007-03-06 21:07 ` Lennart Borgman (gmail)
     [not found] ` <mailman.552.1173217248.7795.help-gnu-emacs@gnu.org>
2007-03-07 18:06   ` kj
2007-03-08  9:48   ` Hadron
2007-03-08 11:02     ` Hadron
2007-03-08 11:49     ` David Hansen
2007-03-08 13:27       ` Lennart Borgman (gmail)
2007-03-08 14:11         ` David Hansen
2007-03-08 16:06           ` Lennart Borgman (gmail)
2007-03-08 16:43             ` David Hansen [this message]
2007-03-08 17:15               ` Lennart Borgman (gmail)
2007-03-08 18:14                 ` David Hansen
     [not found]       ` <mailman.655.1173360456.7795.help-gnu-emacs@gnu.org>
2007-03-08 13:51         ` Hadron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k5xrhejs.fsf@localhorst.mine.nu \
    --to=david.hansen@gmx.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).