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: Syntax tables for multiple modes [was: bug#22983: syntax-ppss returns wrong result.] Date: Mon, 21 Mar 2016 16:29:57 +0200 Message-ID: References: <20160311151512.GD2888@acm.fritz.box> <20160311212410.GG2888@acm.fritz.box> <73903215-f94b-e194-7bfe-0d6350c95769@yandex.ru> <20160311221540.GH2888@acm.fritz.box> <2c301ec9-041d-9172-d628-479062314b23@yandex.ru> <20160314151621.GF1894@acm.fritz.box> <874mc2dqtk.fsf@gmail.com> <87egb5cpmg.fsf@gmail.com> <87a8lsd4j3.fsf@gmail.com> <328c7461-62c6-4228-f622-626349613a1d@yandex.ru> <87fuvkf1gx.fsf@gmail.com> <87y49bewum.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1458570624 21357 80.91.229.3 (21 Mar 2016 14:30:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Mar 2016 14:30:24 +0000 (UTC) Cc: Alan Mackenzie , Stefan Monnier , emacs-devel To: Vitalie Spinu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 21 15:30:19 2016 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 1ai0qW-0000LF-CX for ged-emacs-devel@m.gmane.org; Mon, 21 Mar 2016 15:30:16 +0100 Original-Received: from localhost ([::1]:58187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai0qV-0001zX-N4 for ged-emacs-devel@m.gmane.org; Mon, 21 Mar 2016 10:30:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai0qN-0001w1-Ei for emacs-devel@gnu.org; Mon, 21 Mar 2016 10:30:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ai0qH-0004oY-Lv for emacs-devel@gnu.org; Mon, 21 Mar 2016 10:30:07 -0400 Original-Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:34706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai0qH-0004oM-Ez for emacs-devel@gnu.org; Mon, 21 Mar 2016 10:30:01 -0400 Original-Received: by mail-wm0-x232.google.com with SMTP id p65so153965968wmp.1 for ; Mon, 21 Mar 2016 07:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=SJj16B9j8COJvmFbYEfeZl9P85kCU8jGDLs6CiOU0r4=; b=ufxkmadwUIJdJxEBpoJXV8naTkLPOndm8SZUlimC9++l8VwglrUZh4GPFKqo9ImfW6 0fPD5BDR2FF3zP3A9kQWTvRQK+nd026I2Y4iwRhIvFtEqlPJwAoOkArYccFHxZ/fjwF0 Q1LcsUlDqBYZ0ICKxb/2W4bR9XkAr/L4nRR+cabf33mCsWdznIbOMEMcbuF98zpKr2gj W8Ls7LvPEl77GSdxoE05Xlut51HWSnId172vTv61/JRZ27y+RrZSDsx4KEhjn0QFR78x xvQo3lJ7m6GOLzQ86Ai+XA39VSj+GUfa3B8VWwXUP/S/pGp0YSuwoAyXAiqiKZuWtf/k aGUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=SJj16B9j8COJvmFbYEfeZl9P85kCU8jGDLs6CiOU0r4=; b=fz5Z96Khrt3U/ytnT7qoL3wNzMuu1s1GH/KO/N/3ZYhMDeBBh7uX3yYDC6NgzJFCpS IXv0TRwVdS4+YBQZs9RdfZE9PYdcqbD0F7z7Hy5ByAFzTRHvudjm/43oqI4nSQlbBpiO CJfsVQ5ZTPl/Ki4tyYGrIjIAV4hv+dWOFzblX4XDtoTqnp6hUbQtb3Jhd3CwNEZEC18/ LKKtIJd3lKnh8Pthz0gntpKna9w2lSOlhVtEJdGV1OzBL/Ye6A4iq0JV3Wcj6pJ/9/VD KLnUn4g3DKSK4sfvZLpjXJJm+fB3+A8Fp4YK+BrvWq0gz7LY6HvDZ4I0vjg0GuKlxkV0 sHjA== X-Gm-Message-State: AD7BkJL1j1VyOrrcTX7h2si9vfoavBjuHUp/+E3nZyvmDeO4hreLJcxci5jK7NO+T2OjQw== X-Received: by 10.28.238.210 with SMTP id j79mr14726867wmi.23.1458570600834; Mon, 21 Mar 2016 07:30:00 -0700 (PDT) Original-Received: from [192.168.1.2] ([185.105.175.24]) by smtp.googlemail.com with ESMTPSA id i2sm25664809wje.22.2016.03.21.07.29.58 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 21 Mar 2016 07:29:59 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 In-Reply-To: <87y49bewum.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::232 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:201997 Archived-At: On 03/21/2016 04:20 PM, Vitalie Spinu wrote: > It might be good to not include these (prog-indentation-context including) in > emacs 25 release. Of course, none of them. But nor should we put BEFORE-STRING into master until we understand that we really need it, and how to use it. >>> Performance is not a primary concern for indentation. Correctness and conceptual >>> cleanness is at a much higher stake here. My hope is that generic helper >>> functions can be optimized to re-use same temp buffer for multiple invocations >>> of calculate-indent-function. > >> So, how about trying my alternative proposal first? > > Sorry. What proposal do you mean? """ Instead, if you want to know what indentation an inner mode would return if STRING-BEFORE was before it, insert that string into the buffer (while inhibiting undo history). Call the indentation function, then remove the string. """ Same with AFTER-STRING. The multi-mode package itself would do that. >>> Right. Those stale values won't occur in multi-modes because both syntax-ppss >>> and parse-partial-sexp will always operate on same hard-narrowed regions. > >> We could only be sure of that for syntax-ppss calls in facilities that the >> multi-mode handles specially, like font-lock, syntax-propertize and >> indentation. Not so with any other functions the user could call. > > I assume that multi-mode engine is advising syntax-ppss which I think it should. Very well, that's an option. Having syntax-ppss-dont-widen (or making syntax-ppss respect hard-widen-limits) should be sufficient for it.