From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: web-mode.el Date: Sat, 16 Jun 2012 02:17:19 -0400 Message-ID: References: <4FD9F40C.90406@yandex.ru> <4FDA927D.50306@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1339827454 26465 80.91.229.3 (16 Jun 2012 06:17:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 16 Jun 2012 06:17:34 +0000 (UTC) Cc: cyd@gnu.org, lennart.borgman@gmail.com, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 16 08:17:31 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SfmKA-0002gr-4A for ged-emacs-devel@m.gmane.org; Sat, 16 Jun 2012 08:17:30 +0200 Original-Received: from localhost ([::1]:57835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfmKA-00061J-1E for ged-emacs-devel@m.gmane.org; Sat, 16 Jun 2012 02:17:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfmK6-000613-Pj for emacs-devel@gnu.org; Sat, 16 Jun 2012 02:17:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfmK4-00017z-Od for emacs-devel@gnu.org; Sat, 16 Jun 2012 02:17:26 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:42995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfmK4-00017v-JP; Sat, 16 Jun 2012 02:17:24 -0400 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q5G6HJ7R000387; Sat, 16 Jun 2012 02:17:19 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 889F2AE31D; Sat, 16 Jun 2012 02:17:19 -0400 (EDT) In-Reply-To: <4FDA927D.50306@yandex.ru> (Dmitry Gutov's message of "Fri, 15 Jun 2012 05:40:13 +0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4253=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4253> : streams <769209> : uri <1140520> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:150965 Archived-At: >>> 2) sgml-indent-line calls sgml-parse-tag-backward, which does >>> (re-search-backward "[<>]"), finds "<" and performs simple regexp check. >>> Thus,<% if a< 3 %> breaks indentation on following lines, until first >>> closing tag. >> I think we can treat this as a bug in sgml-indent-line, which should try >> and use syntax-ppss or something like that instead of regexps. > I wonder how that could be fixed exactly. parse-partial-sexp doesn't look > helpful, because it works with single characters, and sgml is concerned with > full tags. It also has to handle unclosed tags like
, some closing tags > are optional, and HTML 4 has self-closing tags. I think just checking after the regexp-match whether the match was found within a "comment" should do the trick, assuming we can get syntax-ppss (or some extension thereof) to treat "other modes" as comments. > If parse-partial-sexp just starts from (point-min), and then skips over > "comments", it will never visit submode regions this way, no? That's why we'd need to hook into syntax-ppss to run parse-partial-sexp on a chunk-by-chunk basis, maybe. Also parse-sexp-ignore-comments also affects (for|back)ward-sexp, as well as up-list, which are important building blocks for indentation algorithms. > Another thing to consider - having "visibility" into previous chunks of the > same submode may be more harmful than useful in some cases. That's OK: the low-level code can't know those things, but the higher-level code which handles the various chunks can treat different chunks differently. E.g. using narrow-to-region for chunks which need to ignore previous text. Stefan