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, 01 Aug 2022 23:49:47 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15268"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) Cc: Daniel =?utf-8?Q?Mart=C3=ADn?= , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 01 22:50:43 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 1oIcN8-0003lg-Bl for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Aug 2022 22:50:43 +0200 Original-Received: from localhost ([::1]:43410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIcN6-0006c9-Pj for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Aug 2022 16:50:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIcMN-0005vl-JD for emacs-devel@gnu.org; Mon, 01 Aug 2022 16:49:55 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:46991) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIcML-0000AV-Do for emacs-devel@gnu.org; Mon, 01 Aug 2022 16:49:55 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 688BC5C0148; Mon, 1 Aug 2022 16:49:52 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 01 Aug 2022 16:49:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-transfer-encoding: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=fm3; t=1659386992; x= 1659473392; bh=pt7iJvOhoeNUVDieBkYF8aZnZW9omikvcsChzE8WIS8=; b=O 7BfG8wUWT8ag7KAMaynYU7UiDBRrVS/oa3JT6Ba6rAZpUFt1gladgkkCrfrvonk5 swurp/er3NYwuTwa1jjuGLbsgpFaBpEELZB4zYLZ/CRB9Hl7MxJhvqJtGckkuE5e vCzAufXU7lI+NHf5EQwIr+Ti0n+jQjnfs96GGPkuwyYqdl60VddaxuWdVCOX8LJ6 To2xnG+BfDR0HgmuF4NaYdMf6tr4AGqXSQnfnPm0H8iyNRf/DdFqEVGDe8Oac/1c gEQH2+3hA+ucynGMNy8+2P7BOu9uM+SHCx59wJGjpi7el19//s2LsqBEDnKu3cKJ GWj1ZNQ436xVxmeuB97GQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=fm3; t=1659386992; x= 1659473392; bh=pt7iJvOhoeNUVDieBkYF8aZnZW9omikvcsChzE8WIS8=; b=y KwCg/HnW/5nRoasxc/jFQsi2iHp9XYUvbd414jnNMLyVLrMmwdw1ftAOVgPJSXWZ ylAL7B8U0XG4jY+s8u4Jl46swUCoNNh5N5AAeRZMS1EsSW88Kiyv6t/kJVHcoVZa Glf/KVuB6tcfHyQqDw0ZUmppnlyqk0svkXFfLHI7QbHsSV5vsK6wbNROjBAhdUC+ lmaCLwp1rIRK7j+1v0QHeNlugWi7E54Kl+UGvq2yJXrUq6yVrlDkQJ8hU4fYCiB+ X4unEUKbBLsjGl5lobJ7/UVmFcHcdua3ep2jmyr4RCDAA8y6OY273KOo8mTvJhV+ TQXZsHsOreSCujdYqO/Xw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvddvfedgudehgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufgjfhgffffkgggtgfesthhqredttderjeenucfhrhhomhephfhi lhhiphhpucfiuhhnsghinhcuoehfghhunhgsihhnsehfrghsthhmrghilhdrfhhmqeenuc ggtffrrghtthgvrhhnpeefleefffetieetuedvtedtgfehgeevtefhueevjeehjeelueei gfevtdeihfeugeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehfghhunhgsihhnsehfrghsthhmrghilhdrfhhm X-ME-Proxy: Feedback-ID: id48c41f1:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 1 Aug 2022 16:49:51 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Mon, 1 Aug 2022 17:50:20 +0000") Mail-Followup-To: Alan Mackenzie , Daniel =?utf-8?Q?Mart=C3=AD?= =?utf-8?Q?n?= , emacs-devel@gnu.org Received-SPF: pass client-ip=66.111.4.26; envelope-from=fgunbin@fastmail.fm; helo=out2-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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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:292966 Archived-At: Hello Alan, On 01/08/2022 17:50 +0000, Alan Mackenzie wrote: > Hello, Filipp. > > On Mon, Aug 01, 2022 at 01:31:28 +0300, Filipp Gunbin wrote: >> On 31/07/2022 01:40 +0200, Daniel Mart=C3=ADn wrote: > >> > Filipp Gunbin writes: > >> >> In Java, it's a common style to have hanging parentheses: > >> >> class C <1>{<2> >> >> void foo() { >> >> }<3> >> >> }<4> > >> >> If we're at position <1> and press C-M-e, then it's logical to move to >> >> <4>, and that's what I implement in javaimp package, by defining my o= wn >> >> beginning-of-defun-function / end-of-defun-function. > > Be aware that end-of-defun-function is broken. Before calling e-o-d-f, > end-of-defun first moves point somewhere else and then calls it. That > somewhere else could easily be in a different function. Say if you have > > class C <1>{ <2>void foo () { > }<3> > }<4> > > and start at <1>, that somewhere else is likely to be <2> from where > your e-o-d-f will probably go to <3>. .. and that is exactly what I'm trying to prevent. >> > If I yank your sample program in a buffer in Java mode, with point at >> > <1>, C-M-e goes to <4>, as expected. So I don=C2=B4t know why you nee= d to >> > implement your own end-of-defun-function in your package. > >> I'd like to not rely on java-mode (part of cc-mode). > > Be further aware that in languages like Java, you can't do a fully > accurate job without scanning braces back to BOB. CC Mode has its own > c-end-of-defun function, which uses a cache of brace blocks, for the > reasons in this post (amongst others). You're welcome to take stuff > from it, if that might help. Of course, I already do context parsing (via syntax-ppss), it's in /packages/javaimp/javaimp-parse.el. That is, my code knows enough about context. I just need to prevent end-of-defun from messing with position. Thanks.