all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Daniel Colascione <dan.colascione@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Better parse-partial-sexp;	multiple major modes
Date: Sun, 31 Aug 2008 17:02:36 +0200	[thread overview]
Message-ID: <48BAB28C.9000407@gmail.com> (raw)
In-Reply-To: <CD8754BE-CF3A-4339-8291-1D8DE10B6610@gmail.com>

Daniel Colascione wrote:
>> Also, Lennart is asking for it to work nicely with multiple major modes.
>> Surely this would be a Good Thing.  Files containing several major modes
>> are commonplace (awk or sed embedded within a shell script, html
>> embedded within php, ....).
> 
> After several attempts at using and understanding multiple major mode
> facilities, I'm convinced the only way forward is core support for the
> concept. Lennart's done a fine job with what's in Emacs currently. But
> anything involving multiple major modes today is a quivering mound of
> hacks. All the work Lennart's had to do to get modes playing nice with
> each other is a testament to that.

Are you suggesting that you have problems using MuMaMo today? If so then
please report it as a bug.

> Maybe a core solution could be something like this: in a given buffer,
> each character has a chunk-name character property. You'd buffer-locally
> map chunk names to major modes. For each chunk name, create a buffer
> containing just the text assigned to that chunk. Make the major-mode the
> major mode for the chunk buffer, and let that major-mode handle
> fontification, keybindings, and so on. In the main buffer, assemble the
> various bits from the chunk-buffers and allow the user to navigate the
> combined buffer normally.

This was an idea I played with at the beginning when I wrote mumamo.el.

I am afraid I think the concepts involved (like buffer local etc) must
be considered quite a bit more first before going in this direction. It
is unclear to me now whether chunk-buffers really would be of any help.
They might be, but I am not sure.

> Keybindings with point at a particular character would just be the
> keybindings present in that character's chunk-buffer. If you need
> special keybindings common across all chunk buffers, just bind the key
> in all the chunk buffers. If a given chunk needs placeholder text to
> represent text of some other chunk, it should be possible add it to that
> chunk buffer without affecting any of the others.
> 
> Anyway, this scheme is:
> 
> 1) Robust - no messing around with variables, no tweaking fontification

Unfortunately I do not think that will hold.

I think the way to go is "interface style". font-lock has some good
support for making multiple major modes possible.

> 2) Backwards compatible - a major-mode doesn't need to know it's being
> used this way

Are you aware of that a major mode does not need to know anything when
used in MuMaMo?

> 3) Versatile - you can compose arbitrary modes this way, even recursively

The main difficulty with sub-modes in sub-modes is stability. How do you
find the sub-modes in sub-modes after buffer changes?

I think I know how to implement this in MuMaMo, but I do not have time
right now. (And it is not very much needed.)

> 4) Conceptually simple (I hope)
> 
> Any thoughts?
> 
> 
> 




  reply	other threads:[~2008-08-31 15:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-26 21:44 Idea for syntax-ppss. Is it new? Could it be any good? Alan Mackenzie
2008-07-27  0:36 ` Lennart Borgman (gmail)
2008-07-27  1:34 ` Stefan Monnier
2008-07-27 14:50   ` Alan Mackenzie
2008-07-27 15:51     ` Stefan Monnier
2008-07-27 19:20       ` Alan Mackenzie
2008-07-27 20:17         ` Stefan Monnier
2008-07-28  2:27     ` Richard M Stallman
2008-07-28  4:08       ` Stefan Monnier
2008-07-28 21:47         ` Richard M Stallman
2008-08-31  8:37     ` Better parse-partial-sexp; multiple major modes (was: Idea for syntax-ppss) Daniel Colascione
2008-08-31 15:02       ` Lennart Borgman (gmail) [this message]
2008-09-01  6:10       ` Richard M. Stallman
  -- strict thread matches above, loose matches on Subject: below --
2008-08-31  9:39 Daniel Colascione
2008-08-31 18:17 ` Better parse-partial-sexp; multiple major modes Stefan Monnier

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

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

  git send-email \
    --in-reply-to=48BAB28C.9000407@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=dan.colascione@gmail.com \
    --cc=emacs-devel@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.