From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: web-mode.el Date: Sat, 16 Jun 2012 17:27:19 +0400 Message-ID: <4FDC89B7.3050907@yandex.ru> References: <4FD9F40C.90406@yandex.ru> <4FDA927D.50306@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1339853246 22310 80.91.229.3 (16 Jun 2012 13:27:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 16 Jun 2012 13:27:26 +0000 (UTC) Cc: cyd@gnu.org, lennart.borgman@gmail.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 16 15:27:25 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 1Sft2B-0008Jy-FW for ged-emacs-devel@m.gmane.org; Sat, 16 Jun 2012 15:27:23 +0200 Original-Received: from localhost ([::1]:59514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sft2B-0002iK-64 for ged-emacs-devel@m.gmane.org; Sat, 16 Jun 2012 09:27:23 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sft28-0002iF-Fx for emacs-devel@gnu.org; Sat, 16 Jun 2012 09:27:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sft26-0006VA-OX for emacs-devel@gnu.org; Sat, 16 Jun 2012 09:27:20 -0400 Original-Received: from forward14.mail.yandex.net ([95.108.130.92]:44647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sft23-0006Uh-HO; Sat, 16 Jun 2012 09:27:15 -0400 Original-Received: from smtp14.mail.yandex.net (smtp14.mail.yandex.net [95.108.131.192]) by forward14.mail.yandex.net (Yandex) with ESMTP id 211741981770; Sat, 16 Jun 2012 17:27:13 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1339853233; bh=kwzbSew2oS1fagk2aNTOyGffipIGFVJ2VddCpeT3l6g=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=ouXUAH0wIlICFIsPIWVrCaPElf88eLIBFlt7B3CWG722zANTW7EDrJYIMoblxT75d CzfqzMgrVZ8aCI/5/GJja8mLOwPuNkFKjl5xsomoSD4iMlT9BZBVnO0ZVS9c2W1ilr vpYATo3zRh/1rJ4WnYOqXMkiR4Hh0YbOd869tIP8= Original-Received: from smtp14.mail.yandex.net (localhost [127.0.0.1]) by smtp14.mail.yandex.net (Yandex) with ESMTP id D2FBE1B605F1; Sat, 16 Jun 2012 17:27:12 +0400 (MSK) Original-Received: from 98-87.nwlink.spb.ru (98-87.nwlink.spb.ru [178.252.98.87]) by smtp14.mail.yandex.net (nwsmtp/Yandex) with ESMTP id RCwSRQ3E-RCwGkeFB; Sat, 16 Jun 2012 17:27:12 +0400 X-Yandex-Rcpt-Suid: monnier@IRO.UMontreal.CA X-Yandex-Rcpt-Suid: cyd@gnu.org X-Yandex-Rcpt-Suid: lennart.borgman@gmail.com X-Yandex-Rcpt-Suid: emacs-devel@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1339853232; bh=kwzbSew2oS1fagk2aNTOyGffipIGFVJ2VddCpeT3l6g=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=NtNDa0FpTp/+V6iElNEy/qvPum63hrGsX4TA7LFWU7AcKVzvQr8ImW89Eiz9nHQB5 5re7tWyCAhgi2o2m7Lad/pMLaRqvDOxV0rVyAT91MICHiX7lSsMbNlwO9bfRcDlK4V gwnILz7ns3ocQm7ibLSi/3YF2rZbSn6modx06Llc= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 95.108.130.92 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:150971 Archived-At: On 16.06.2012 10:17, Stefan Monnier wrote: >>>> 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. That should work. Looks like currently it looks for comments with (search-backward), too. >> 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. Yes, well, except js-indent-line calls (widen) first thing, so (narrow-to-region) will not help.