From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Filipp Gunbin Newsgroups: gmane.emacs.devel Subject: Re: Don't move to eol in end-of-defun? Date: Mon, 08 Aug 2022 17:29:50 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31763"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) Cc: Alan Mackenzie , emacs-devel@gnu.org To: Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 08 16:32:22 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oL3no-00081C-5T for ged-emacs-devel@m.gmane-mx.org; Mon, 08 Aug 2022 16:32:22 +0200 Original-Received: from localhost ([::1]:44810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oL3nm-0005qk-N7 for ged-emacs-devel@m.gmane-mx.org; Mon, 08 Aug 2022 10:32:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oL3lZ-0004Oa-94 for emacs-devel@gnu.org; Mon, 08 Aug 2022 10:30:01 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:37125) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oL3lX-0000p4-19; Mon, 08 Aug 2022 10:30:01 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 680C05C0199; Mon, 8 Aug 2022 10:29:54 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 08 Aug 2022 10:29:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1659968994; x=1660055394; bh=VcyM6BqdF4 TIJJZXgdlUEiFSwaOcxY7fJMplgtZ/7j8=; b=QGciEKHc4GngwwHhHpo+07Ur2l oVr3YE6W+57TqgiOSVN0SF6JWeWZnKYh1PAsuUBankwysj1+3gE5SVJ0MCkNRNum 7MCh/yyc7RG4hODHHduGvLF4rLeg7ZnBDnpU2rL5BcsPtwtoiRD6xOYSPaxO90Js ULCmMgS2Txm4/F6vmVOWEvtnM8TfPxlV25Y1IMzphAdmlhEhPmwhnBn8gLcHIwrX vD4cwAPNkcHhQKZTY3abNmoXqDwfdtoexXEckUrs0wH3xJmcVVbG2kR4apvubsQS BqU7iSAiUkjC8LA86L0plsvCMtkKg8miZ4cJoyzFE30dx3aX1fUw7B6ftUXQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1659968994; x=1660055394; bh=VcyM6BqdF4TIJJZXgdlUEiFSwaOc xY7fJMplgtZ/7j8=; b=hnJQn6IOYVhKWAWAaAG6RuiMG/PE/qVMjxtifyH+QONi 6JHC5LfHDYUClADaKqo/2FYx6nqRK1QU1Mj12YhnXCggJbaUCsv2Z7LnJx8p7tiS FIrOC6LXAkCzA+ydwyEV3sQ3VoINHu2AfgiQvrbdRTuAfo/iF2FkA5RNCY+20IbJ 9zepGKSy658BfAMcbfTx56gVEhHWsoEwqZpna0XoMkHt025aUxifrZrtFJlNaTEq BIeZKGgMYwo6Kp/WORUgklgkXs0Q2FCDKplTVcxkGEl4COU0o7i0A4QEXIhJ+nCy 2DYhkURmsOnLwYK7c+MxDDrECc2BkVrlzX8oc/P27Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdefkedgjeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufgjfhgffffkgggtsehttd ertddtredtnecuhfhrohhmpefhihhlihhpphcuifhunhgsihhnuceofhhguhhnsghinhes fhgrshhtmhgrihhlrdhfmheqnecuggftrfgrthhtvghrnhepfffhjeevieeiiedutefghe ffleeiveeffeeftdekleehledufeeuueduheevieffnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomhepfhhguhhnsghinhesfhgrshhtmhgrihhlrd hfmh X-ME-Proxy: Feedback-ID: id48c41f1:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 8 Aug 2022 10:29:53 -0400 (EDT) In-Reply-To: (Richard Stallman's message of "Sun, 07 Aug 2022 00:24:04 -0400") Mail-Followup-To: Richard Stallman , Alan Mackenzie , emacs-devel@gnu.org Received-SPF: pass client-ip=66.111.4.27; envelope-from=fgunbin@fastmail.fm; helo=out3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:293268 Archived-At: On 07/08/2022 00:24 -0400, Richard Stallman wrote: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > > The problem is that e-o-d moves point somewhere else _before_ it calls > > end-of-defun-function, and that somewhere else can easily be in a > > different (nested) defun. > > Is there a case which is incorrect _now_? If so, what case is it, > and what happens now in that case? Yes, my example from previous messages. > > I think Filipp is asking for the coding of end-of-defun to be revisited. > > Code can be changed if it is broken, but the question behind that > needs to be, "What is the right thing in this case?" It's not broken, but rather clearly wasn't intended for nested defuns. AFAICS, cc-mode overrides beginning/end-of-defun completely. In my mode, I implemented just beginning/end-of-defun-function, while using standard beginning/end-of-defun functions, and it works well except for this case (and, yes, one more rare bug during narrowing, I'm yet to investigate it). Currently cc-mode and my implementation for Java work differently: as Alan said, cc-mode goes outside the enclosing block, while I stay inside. I find it convenient to think about nested things in this way: C-M-a and C-M-e should behave as if we were narrowed to the current enclosing block, like if its contained methods/whatever were top-level. > > In these circumstances, for C-M-a to go to the outermost "defun" > > wouldn't be useful. > > Yes, we do need to be able to have outer groupings which we designate > as "does not count as a defun", so that things inside it which look like > defuns do count as defuns. > > This requires a way for the programmer to mark them so that C-M-a > mostly ignores them. > > However, any old nested function definition shouldn't be treated as a > defun. In Java, you can have "local" classes, these are classes defined and used inside a method: class C { void foo() { class D { void bar() { } } D d = new D(); ... } } So I chose to "honestly" parse & handle context right from the start. Filipp