From: Dmitry Gutov <dgutov@yandex.ru>
To: Vitalie Spinu <spinuvit@gmail.com>,
Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Alan Mackenzie <acm@muc.de>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Syntax tables for multiple modes [was: bug#22983: syntax-ppss returns wrong result.]
Date: Tue, 22 Mar 2016 00:55:30 +0200 [thread overview]
Message-ID: <113082e0-f01b-c290-4e31-009a30f55759@yandex.ru> (raw)
In-Reply-To: <87bn67eq4t.fsf@gmail.com>
On 03/21/2016 06:45 PM, Vitalie Spinu wrote:
> Real trouble comes with continuation chunks. You might need to have a completely
> reversed indentation logic - in outer/host spans MM engine needs to call inner
> mode for indentation. Consider this example of erb mode taken from
> https://github.com/fxbois/web-mode/blob/master/tests/demo.erb.
>
> <div id='header'>
> <% if signed_in? -%>
> <%= link_to t('.sign_out'), sign_out_path, :method => :delete %>
> <% else -%>
> <%= link_to t('.sign_in'), sign_in_path %>
> <% end -%>
> </div>
FWIW, I've successfully implemented indentation for ERB (and EJS) files
without delegating to ruby-mode and js-mode indentation code:
https://github.com/purcell/mmm-mode/blob/c9a857a638701482931ffaaee262b61ce53489f3/mmm-erb.el#L157-L225
(it indents web-mode's example almost identically)
It should be easy to add support for similar types of files with almost
the same code. But yes, it implies adding support for each new template
format manually.
> One meaningful approach here is to indent if-else-end block using inner mode
> rules, right? This is what web-mode seems to be currently doing. Assume you are
> just in front of `<%= link_to`. This is host hmtl mode. But you need to indent
> according to inner mode construct. So what do you do? You go to the end of
> previous code chunk and call prog-indentation-function of inner mode with
> STRING-BEFORE = "\n" and STRING-AFTER="link_to t('.sign_out'), sign_out_path,
> :method => :delete". Simple isn't it? That's precisely my proposal.
It's simpler for the caller, but I'm having hard time imagining how to
implement it properly on a major mode's side without inserting those
strings into the buffer, or using a temporary buffer.
If STRING-BEFORE and STRING-AFTER are not allowed to contain newlines,
yes, that becomes easier to handle, but that also loses in generality.
next prev parent reply other threads:[~2016-03-21 22:55 UTC|newest]
Thread overview: 155+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-11 15:15 bug#22983: syntax-ppss returns wrong result Alan Mackenzie
2016-03-11 20:31 ` Dmitry Gutov
2016-03-11 21:24 ` Alan Mackenzie
2016-03-11 21:35 ` Dmitry Gutov
2016-03-11 22:15 ` Alan Mackenzie
2016-03-11 22:38 ` Dmitry Gutov
2016-03-13 17:37 ` Stefan Monnier
2016-03-13 18:57 ` Alan Mackenzie
2016-03-14 0:47 ` Dmitry Gutov
2016-03-14 1:04 ` Drew Adams
2016-04-03 22:55 ` John Wiegley
2016-03-14 1:49 ` Stefan Monnier
2016-03-14 15:16 ` Syntax tables for multiple modes [was: bug#22983: syntax-ppss returns wrong result.] Alan Mackenzie
2016-03-14 17:34 ` Andreas Röhler
2016-03-14 20:06 ` Dmitry Gutov
2016-03-19 22:51 ` Vitalie Spinu
2016-03-20 2:19 ` Dmitry Gutov
2016-03-20 12:15 ` Vitalie Spinu
2016-03-20 15:58 ` Dmitry Gutov
2016-03-21 1:05 ` Vitalie Spinu
2016-03-21 3:11 ` Stefan Monnier
2016-03-21 5:05 ` Vitalie Spinu
2016-03-21 7:13 ` Andreas Röhler
2016-03-21 12:26 ` Stefan Monnier
2016-03-21 14:13 ` Vitalie Spinu
2016-03-21 14:43 ` Stefan Monnier
2016-03-21 16:42 ` Vitalie Spinu
2016-03-21 18:31 ` Stefan Monnier
2016-03-21 19:16 ` Vitalie Spinu
2016-03-21 20:47 ` Stefan Monnier
2016-03-21 20:33 ` Alan Mackenzie
2016-03-21 20:49 ` Stefan Monnier
2016-03-21 21:03 ` Drew Adams
2016-03-21 21:12 ` Dmitry Gutov
2016-03-21 16:45 ` Vitalie Spinu
2016-03-21 22:55 ` Dmitry Gutov [this message]
2016-03-22 14:51 ` Stefan Monnier
2016-03-22 18:17 ` Vitalie Spinu
2016-03-23 1:18 ` Dmitry Gutov
2016-03-23 13:18 ` Stefan Monnier
2016-03-22 18:26 ` Vitalie Spinu
2016-03-23 2:07 ` Stefan Monnier
2016-03-23 10:56 ` Vitalie Spinu
2016-03-23 11:41 ` Stefan Monnier
2016-03-23 12:39 ` Vitalie Spinu
2016-03-23 13:23 ` Stefan Monnier
2016-03-23 15:28 ` Dmitry Gutov
2016-03-23 21:51 ` Vitalie Spinu
2016-03-24 7:30 ` Andreas Röhler
2016-03-21 11:56 ` Dmitry Gutov
2016-03-21 5:08 ` [Patch] hard-widen-limits [was Re: Syntax tables for multiple modes [was: bug#22983: syntax-ppss returns wrong result.]] Vitalie Spinu
2016-03-21 12:39 ` Stefan Monnier
2016-03-21 12:54 ` Vitalie Spinu
2016-03-21 14:07 ` Stefan Monnier
2016-03-21 14:14 ` Vitalie Spinu
2016-03-21 14:04 ` Stefan Monnier
2016-03-21 14:33 ` Vitalie Spinu
2016-03-21 14:54 ` Stefan Monnier
2016-03-21 17:16 ` Vitalie Spinu
2016-03-21 18:36 ` Stefan Monnier
2016-03-21 19:18 ` Vitalie Spinu
2016-03-22 3:17 ` Vitalie Spinu
2016-03-22 9:57 ` Vitalie Spinu
2016-03-22 10:05 ` Vitalie Spinu
2016-03-22 11:57 ` Stefan Monnier
2016-03-22 16:28 ` Vitalie Spinu
2016-03-22 16:44 ` Stefan Monnier
2016-03-22 19:36 ` Vitalie Spinu
2016-03-23 2:22 ` Stefan Monnier
2016-03-23 11:41 ` Vitalie Spinu
2016-03-23 12:34 ` Stefan Monnier
2016-03-23 12:41 ` Vitalie Spinu
2016-03-29 21:43 ` Vitalie Spinu
2016-04-22 14:34 ` Dmitry Gutov
2016-04-24 7:22 ` Vitalie Spinu
2016-04-24 7:28 ` Achim Gratz
2016-04-24 11:33 ` Vitalie Spinu
2016-04-24 13:20 ` Andreas Schwab
2016-04-24 16:11 ` Vitalie Spinu
2016-04-24 16:19 ` Andreas Schwab
2016-04-24 16:41 ` Vitalie Spinu
2016-04-24 16:48 ` Andreas Schwab
2016-04-24 18:01 ` Vitalie Spinu
2016-04-24 19:05 ` Andreas Schwab
2016-04-28 13:29 ` Vitalie Spinu
2016-04-30 14:06 ` Stefan Monnier
2016-03-22 20:08 ` Richard Stallman
2016-03-22 22:45 ` Vitalie Spinu
2016-03-21 11:47 ` Syntax tables for multiple modes [was: bug#22983: syntax-ppss returns wrong result.] Dmitry Gutov
2016-03-21 12:40 ` Vitalie Spinu
2016-03-21 13:07 ` Dmitry Gutov
2016-03-21 14:20 ` Vitalie Spinu
2016-03-21 14:29 ` Dmitry Gutov
2016-03-21 14:42 ` Vitalie Spinu
2016-03-21 14:56 ` Dmitry Gutov
2016-03-21 16:52 ` Vitalie Spinu
2016-03-21 21:30 ` Dmitry Gutov
2016-04-03 23:34 ` John Wiegley
2016-03-21 14:02 ` Stefan Monnier
2016-03-21 14:31 ` Vitalie Spinu
2016-03-21 15:06 ` Stefan Monnier
2016-03-21 17:15 ` Andreas Röhler
2016-03-13 17:32 ` bug#22983: syntax-ppss returns wrong result Stefan Monnier
2016-03-13 18:52 ` Andreas Röhler
2016-03-13 18:56 ` Dmitry Gutov
2016-03-18 0:49 ` Dmitry Gutov
2016-03-19 12:27 ` Alan Mackenzie
2016-03-19 18:47 ` Dmitry Gutov
2016-03-27 0:51 ` John Wiegley
2016-03-27 1:14 ` Dmitry Gutov
2016-04-03 22:58 ` John Wiegley
2016-04-03 23:15 ` Dmitry Gutov
2017-09-02 13:12 ` Eli Zaretskii
2017-09-02 17:40 ` Alan Mackenzie
2017-09-02 17:53 ` Eli Zaretskii
2017-09-03 20:44 ` John Wiegley
2017-09-04 23:34 ` Dmitry Gutov
2017-09-05 6:57 ` Andreas Röhler
2017-09-05 12:28 ` John Wiegley
2017-09-07 20:45 ` Alan Mackenzie
2017-09-08 16:04 ` Andreas Röhler
2017-09-10 18:26 ` Alan Mackenzie
2017-09-09 9:44 ` Dmitry Gutov
2017-09-09 10:20 ` Alan Mackenzie
2017-09-09 12:18 ` Dmitry Gutov
2017-09-10 11:42 ` Alan Mackenzie
2017-09-10 11:36 ` bug#22983: [ Patch ] " Alan Mackenzie
2017-09-10 22:53 ` Stefan Monnier
2017-09-10 23:36 ` Dmitry Gutov
2017-09-11 11:10 ` Stefan Monnier
2017-09-12 0:11 ` Dmitry Gutov
2017-09-12 22:12 ` Richard Stallman
2017-09-11 19:42 ` Alan Mackenzie
2017-09-11 20:20 ` Stefan Monnier
2017-09-11 0:11 ` Dmitry Gutov
2017-09-11 20:12 ` Alan Mackenzie
2017-09-12 0:24 ` Dmitry Gutov
2017-09-17 10:29 ` Alan Mackenzie
2017-09-17 23:43 ` Dmitry Gutov
2017-09-18 19:08 ` Alan Mackenzie
2017-09-19 0:02 ` Dmitry Gutov
2017-09-19 20:47 ` Alan Mackenzie
2017-09-22 14:09 ` Dmitry Gutov
2017-09-24 11:26 ` Alan Mackenzie
2017-09-25 23:53 ` Dmitry Gutov
2017-10-01 16:36 ` Alan Mackenzie
2017-10-04 20:07 ` Johan Bockgård
2017-09-17 11:12 ` Philipp Stephani
2017-09-19 20:50 ` Alan Mackenzie
2017-09-07 17:56 ` Alan Mackenzie
2017-09-07 20:36 ` Dmitry Gutov
2016-03-19 23:16 ` Vitalie Spinu
2016-03-19 23:00 ` Vitalie Spinu
2016-03-19 23:20 ` Dmitry Gutov
[not found] ` <mailman.7307.1457709188.843.bug-gnu-emacs@gnu.org>
2017-10-01 16:31 ` Alan Mackenzie
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=113082e0-f01b-c290-4e31-009a30f55759@yandex.ru \
--to=dgutov@yandex.ru \
--cc=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=spinuvit@gmail.com \
/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.