[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Don't move to eol in end-of-defun?

From: Daniel Martín
Subject: Re: Don't move to eol in end-of-defun?
Date: Sun, 31 Jul 2022 01:40:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin)

Filipp Gunbin <fgunbin@fastmail.fm> 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 own
> beginning-of-defun-function / end-of-defun-function.

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´t know why you need to
implement your own end-of-defun-function in your package.

> OTOH, end-of-defun is documented to move to "next end of defun", and one
> could say that moving from <1> to <3> is just that.

The docstring is perhaps a bit confusing, but the Emacs manual and
glossary defines what end-of-defun does in each major mode more
precisely: It moves point to the end of the current defun.  When the
point is in between two defuns, the current defun is defined as the next
defun that follows the point.  So the expected navigation is <1> -> <4>,
<2> -> <3>, which is how the included java-mode works.

I'm not sure about the problem your solution is trying to fix.  Perhaps
I'm missing something.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]