emacs-devel
[Top][All Lists]
Advanced

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

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


From: Filipp Gunbin
Subject: Re: Don't move to eol in end-of-defun?
Date: Thu, 04 Aug 2022 17:58:08 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin)

On 04/08/2022 00:04 -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. ]]]
>
>   > Yes, that will be the behavior.  This post and example were about moving
>   > over the braces vs. moving into them, and <4> will really be on blank
>   > line between defuns.
>
> We may be partly miscommunicating.  With other languages, such as
> Lisp, C-M-e moves to the blank line after the defun from _anywhere_
> inside the defun.  (Except in weird cases, such as this,
>
>     (defun foo (a b)
>       x y z))
>
> where the extra closeparen after the defun means the only valid place
> to stop is before the extra closeparen.)
>
> You're planning to break that rule, right?
>
> I think that this rule behavior will be useful in other languages too;
> maybe breaking it is not a good idea.

No-no, I don't intend to break it.

Returning to my example:

class C <1>{<2>
  void foo() {
  }<3>
}<4>
<5>
class D ...

We're at point <1>.  I'd like C-M-e to go to <5> (in my first email I
said <4>, but that was my inaccuracy; it will be <5> except in weird
cases like you showed).

We have nested defuns here.  When we're at <1>, we're "in class C's
declaration", and C-M-e should move to after its end.  But currently
end-of-defun will first unconditionally move to eol (<2>), where the
context is different: now we're "before foo()'s declaration", and C-M-e
should move to <3>, which it does.  The knowledge about nested contexts
and their boundaries is provided by my mode, in
beginning/end-of-defun-function.

I just want to make movement to eol conditional, with default value
meaning "like before", to not break anything.

Filipp



reply via email to

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