all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vitalie Spinu <spinuvit@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org, cyd@gnu.org, lennart.borgman@gmail.com,
	Dmitry Gutov <dgutov@yandex.ru>
Subject: Re: web-mode.el
Date: Fri, 15 Jun 2012 10:34:38 +0200	[thread overview]
Message-ID: <871ulh3rdt.fsf@gmail.com> (raw)
In-Reply-To: <jwvobom1syp.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 13 Jun 2012 23:23:54 -0400")

  >> Stefan Monnier <monnier@iro.umontreal.ca>
  >> on Wed, 13 Jun 2012 23:23:54 -0400 wrote:

  >> I'm also using narrowing during indentation, but some modes (like js)
  >> use (widen) in indent-line-function. It should be somewhat fixable by

  > I don't think it's worthwhile trying to make a "multi-major-mode" that
  > works with any major mode, no matter what wicked thing it does.
  > So it's OK to impose a few conventions that the major mode needs
  > to obey.  The important and difficult part is to figure what those
  > conventions need to be.

I also think that multi-major-mode is too much work into a wrong
direction. Major mode with chunk switching modes is a dead end
also. Modes are becoming heavier and more complex, and one can never
know reliably what is happening during the initialization. Besides that,
this approach is extremely expensive. Mumamo has almost 10000 lines and
it doesn't look like it's the end of it.

Dave Love wrote his 400 lines multi-mode.el in 2003, which is based on
indirect buffers (http://www.loveshack.ukfsn.org/emacs/multi-mode.el).
It still needs tweaking, but it's lightening fast and doesn't require
mode swapping. It happened that I've started improving it here
(https://github.com/vitoshka/litprog) as part of a general literate
programing framework project a couple of weeks ago.

I bet a working *minor*-web-mode can be written in less than 100 lines
only by specifying chunk delimiters regexps and a mode detection
function.

  > Of course, tweaking some parts of the C mode might help.  E.g. we could
  > maybe extend syntax-tables slightly so that chunk boundaries are marked
  > with a special syntax-table value which then makes forward-comment skip
  > over "other language" chunks, so that any indentation code which
  > consistently ignores comments would then work in multi-major-mode.

In litprog-mode.el chunk delimiters already marked as comments to avoid
issues with parse-partial-sexp (they even have a separate mode). I guess
this works well enough for most of the cases. To achieve full generality
one would need to mark whole "irrelevant" chunks as comments. For
example in js-mode buffer all html, php etc chunks are comments. In
html-mode buffer js, php are comments, etc. 

Dmitry suggested collecting test cases. That would be great for
comparing multi modes head to head. Where can I find really difficult
ones?

Best, 
Vitalie.






  reply	other threads:[~2012-06-15  8:34 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14  0:33 web-mode.el Dmitry Gutov
2012-06-14  1:49 ` web-mode.el Lennart Borgman
2012-06-14  2:13   ` web-mode.el Dmitry Gutov
2012-06-14  3:23 ` web-mode.el Stefan Monnier
2012-06-15  8:34   ` Vitalie Spinu [this message]
2012-06-15  9:23     ` web-mode.el Lennart Borgman
2012-06-15  9:41       ` web-mode.El Vitalie Spinu
2012-06-16  1:37         ` web-mode.El Lennart Borgman
  -- strict thread matches above, loose matches on Subject: below --
2012-06-14 14:24 web-mode.el Dmitry Gutov
2012-06-14 16:54 ` web-mode.el Lennart Borgman
2012-06-15  3:24   ` web-mode.el Dmitry Gutov
2012-06-16  1:43     ` web-mode.el Lennart Borgman
2012-06-16 13:19       ` web-mode.el Dmitry Gutov
2012-06-16 13:30         ` web-mode.el Lennart Borgman
2012-06-19  1:18           ` web-mode.el Dmitry Gutov
2012-06-19  1:56             ` web-mode.el Lennart Borgman
2012-06-19 16:04               ` web-mode.el Dmitry Gutov
2012-06-14 17:28 ` web-mode.el Stefan Monnier
2012-06-15  1:40   ` web-mode.el Dmitry Gutov
2012-06-16  6:17     ` web-mode.el Stefan Monnier
2012-06-16 10:55       ` web-mode.el Lennart Borgman
2012-06-16 13:27       ` web-mode.el Dmitry Gutov
2012-06-16 13:32         ` web-mode.el Lennart Borgman
2012-06-18  1:49         ` web-mode.el Stefan Monnier
2012-06-19  1:00           ` web-mode.el Dmitry Gutov
2012-06-19  3:09             ` web-mode.el Stefan Monnier
2012-06-19 10:39               ` web-mode.el Lennart Borgman
2012-06-20  2:01               ` web-mode.el Dmitry Gutov
2012-07-31  8:46                 ` web-mode.el Lennart Borgman
2012-06-11 22:24 web-mode.el Bois Francois-Xavier
2012-06-12 11:37 ` web-mode.el Lennart Borgman
2012-06-12 13:23   ` web-mode.el Bois Francois-Xavier
     [not found]   ` <CAK1xyPN=7To8ZsznHdjhDO=pd_8MocAqWXzSSrFJNe=uHRwp9g@mail.gmail.com>
2012-06-12 13:24     ` web-mode.el Lennart Borgman
2012-06-12 13:45       ` web-mode.el Bois Francois-Xavier
2012-06-13  7:45 ` web-mode.el Chong Yidong
2012-06-13  8:39   ` web-mode.el Bois Francois-Xavier
2012-07-31  8:41     ` web-mode.el Steinar Bang
2012-06-13 10:36   ` web-mode.el Lennart Borgman
2012-06-13 10:49     ` web-mode.el Bois Francois-Xavier
2012-06-13 10:55       ` web-mode.el Lennart Borgman
2012-06-13 11:43         ` web-mode.el Bois Francois-Xavier
2012-06-13 11:52           ` web-mode.el Lennart Borgman
2012-06-13 12:30     ` web-mode.el Stefan Monnier
2012-06-13 12:37       ` web-mode.el Lennart Borgman
2012-06-13 10:37   ` web-mode.el Dmitry Gutov
2012-06-13 10:46     ` web-mode.el Lennart Borgman
2012-06-13 10:26 ` web-mode.el Dmitry Gutov
2012-06-13 14:18 ` web-mode.el Richard Riley

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=871ulh3rdt.fsf@gmail.com \
    --to=spinuvit@gmail.com \
    --cc=cyd@gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=lennart.borgman@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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.