GNU bug report logs - #64574
[PATCH] Support not jumping to bol in beginning-of-defun

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Tue, 11 Jul 2023 18:16:02 UTC

Severity: wishlist

Tags: moreinfo, patch

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 64574 <at> debbugs.gnu.org
Subject: bug#64574: [PATCH] Support not jumping to bol in beginning-of-defun
Date: Tue, 11 Jul 2023 21:50:58 +0300
> From: Spencer Baugh <sbaugh <at> janestreet.com>
> Date: Tue, 11 Jul 2023 14:15:35 -0400
> 
> As mentioned in the commit, this default behavior by
> beginning-of-defun is undesirable in some languages and major modes.
> I'm thinking of OCaml in particular here, but it's also arguably
> unwanted in Python and C++ as well, where defs may be indented inside
> class definitions.  Let's let users and major modes make this decision
> on a case-by-case basis.

Such optional behavior is fine by me, but is there any evidence enough
people will want it?  Can you gather some feedback about that?

> +(defvar beginning-of-defun-go-beginning-of-line t

Why not defcustom?

And I would use a shorter name, like beginning-of-defun-go-bol.

> +  "If non-nil, `beginning-of-defun' runs `beginning-of-line' at the end.

This describes implementation, not the behavior.  It also assumes
everyone knows what exactly beginning-of-line does (think RTL text).

> +By default, `beginning-of-defun' jumps to the beginning of the
> +line with `beginning-of-line' after finding the start of the
> +defun.

I see no reason to tell in the doc string how exactly the function
goes to BOL.  It can even be a problem if at some future point we
decide to change the implementation.

> +For languages where defuns may be indented inside nested
> +structures like classes or modules, this behavior may be
> +undesirable.  Major modes for such languages can set this
> +variable to nil to avoid it.")

Not sure we should leave this to major modes and not to the individual
users.

Thanks.




This bug report was last modified 115 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.