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: antlr-mode.el - need some support by python.el Date: Wed, 18 Feb 2015 17:29:41 +0200 Message-ID: <54E4AFE5.1070208@yandex.ru> References: <54E40954.7000706@yandex.ru> 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 1424273402 4732 80.91.229.3 (18 Feb 2015 15:30:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Feb 2015 15:30:02 +0000 (UTC) Cc: "=?UTF-8?Q?Fabi=c3=a1n_E.Gallina?=" , "emacs-devel@gnu.org" To: "Wedler, Christoph" , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 18 16:30:01 2015 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 1YO6Zd-0004Jl-AK for ged-emacs-devel@m.gmane.org; Wed, 18 Feb 2015 16:30:01 +0100 Original-Received: from localhost ([::1]:51494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO6ZX-0006oc-Lc for ged-emacs-devel@m.gmane.org; Wed, 18 Feb 2015 10:29:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO6ZS-0006l4-Sx for emacs-devel@gnu.org; Wed, 18 Feb 2015 10:29:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YO6ZO-0003gy-TP for emacs-devel@gnu.org; Wed, 18 Feb 2015 10:29:50 -0500 Original-Received: from mail-wg0-x22b.google.com ([2a00:1450:400c:c00::22b]:48579) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO6ZO-0003gh-Fq for emacs-devel@gnu.org; Wed, 18 Feb 2015 10:29:46 -0500 Original-Received: by mail-wg0-f43.google.com with SMTP id z12so1875251wgg.2 for ; Wed, 18 Feb 2015 07:29:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=jxWMRu4wM47p9LAbVpskCnMYXrd/uCl78dwkia8pcds=; b=FB6FjetaKl3C6Nb1sFxhbhssyR0IRnYTd5MFDw/jzwEm6ihLrVDa6wzVq1hYmiVoM3 ErlFqElHANXAldbBAErW5vSJ7Ezc1stGM/+KmcUrJYu5LdNB+UnnKU4j2G1pZ64uWKvW Ley7Zzj89xc0X0q6aGzmXXfv21F51kVRmLLb1o+INd9CfHpacWM9t2+2NkBVvikW/Fcs i/n+sjmvaR+xqqYiganO6zxz+zbvWqweg9OXKYG4DXRgquebDP/mOG91bhpEyhGooRZC 335GXLZPyQ7alURrU93xJRE7D2ZvywvX465lEVWq4u46cEilqrdBHDEb8vN4bD1DQ86H o2TQ== X-Received: by 10.194.184.83 with SMTP id es19mr2486393wjc.93.1424273385887; Wed, 18 Feb 2015 07:29:45 -0800 (PST) Original-Received: from [192.168.1.2] ([82.102.93.54]) by mx.google.com with ESMTPSA id dt7sm19850490wib.19.2015.02.18.07.29.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Feb 2015 07:29:45 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Thunderbird/36.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::22b 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:183252 Archived-At: On 02/18/2015 02:22 PM, Wedler, Christoph wrote: > Well, if the indentation calculation in python-mode needs some context > information which might be outside the visible part of the buffer, it > must call `widen', right? Of course, Python does that inside a > `save-restriction'. Well, I say it shouldn't, until we have a better `widen'. >> And/or someone could try and solve the long-standing problem of >> separating "visibility" narrowing and "functional" narrowing. > > To be honest, I do not fully understand what you mean here, or how it > would solve the problem. Some `widen' calls mean `don't go beyond this region', and some mean `don't show me anything beyond this region'. Indentation code would undo the latter kind, and the multi-mode code would use first kind. > Cross-command-wise, there is one narrowing. It is used for restricting > some editing operations ("functional"?) and the visible part of the > buffer. Yes, the problem is it does both. > If we would have two narrowings, then the "functional" should > always be a subset of the "visible" narrowing (and the "functional" > should be made somehow detectable for the user by a different background > color). Otherwise, things would get very confusing for the user. > > Then, for python-mode not to call widen itself, the "functional" region > must be widened, which would imply a "visible" widen with the condition > above. In other words, pyhon users could not use narrowing when they > want to get a correct indentation. I believe it will be in reverse. Though many editing commands will have to respect the "visible" narrowing, instead of "functional". >> LEFTMOST-COL, likewise, can by added by the calling function. No need to >> make the submode's indentation function be aware of it. > > As Stefan has mention, it would first require that the mode not just > indents the line, but also has a function which returns the correct > indentation. Not necessarily: you also can adjust the indentation after the submode applies it. > Even if we have this, things are not that easy - we start with the > non-Python case: > - some indent calculation return the correct indentation based on the > indentation of previous lines - here, I won't have to add anything > (given that I calculate the correct index of the first SUB-line myself, > which I can do), except sometimes for top-level constructs > - some indent calculation return the correct indentation based on the > syntactic context - here, I would have to add LEFTMOST-COL Currently, I'm using this trick: narrow, then add LEFTMOST-COL at the beginning of the region. In the end, remove them. But using `line-indentation-function' would avoid it, too.