From: Eli Zaretskii <eliz@gnu.org>
To: Yuan Fu <casouri@gmail.com>
Cc: dmitry@gutov.dev, 64283@debbugs.gnu.org, mardani29@yahoo.es
Subject: bug#64283: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top
Date: Tue, 27 Jun 2023 14:01:21 +0300 [thread overview]
Message-ID: <83jzvpw4n2.fsf@gnu.org> (raw)
In-Reply-To: <A49C078B-60B8-45E0-9BD8-2D230EB7C124@gmail.com> (message from Yuan Fu on Mon, 26 Jun 2023 18:42:41 -0700)
> From: Yuan Fu <casouri@gmail.com>
> Date: Mon, 26 Jun 2023 18:42:41 -0700
> Cc: Eli Zaretskii <eliz@gnu.org>,
> Dmitry Gutov <dmitry@gutov.dev>,
> 64283@debbugs.gnu.org
>
> >
> > What I see is that, after 4489450f37deafb013b1f0fc00c89f0973fda14a,
> > defun movement may be subtly broken if beginning-of-defun-function does
> > not return non-nil when it found the beginning of a defun. One of the
> > affected modes is js-mode, but who knows if there are more out there.
> >
> > We could either revert 4489450f37deafb013b1f0fc00c89f0973fda14a, because
> > of the incompatibilities it may cause (Yuan, what is the bug it tries to
> > fix?), or maybe adjust js-mode so that it follows the documentation of
> > beginning-of-defun-function and returns non-nil when it found the
> > beginning of a defun. I've attached a patch that follows this second
> > approach, with some unit tests. It fixes the bug on my side.
> >
> > <0001-Make-js-beginning-of-defun-return-non-nil-on-success.patch>
>
> The original problem that I tried to solve is that sometimes end-of-defun-function was called when point isn’t at the beginning of a defun, contrary to what the documentation claims.
>
> I first find out about it when writing defun movement functions for tree-sitter, but if you revert the commit now tree-sitter defun functions wouldn’t break: they have change quite a bit since then and treesit-end-of-defun don’t need to be called at the beginning of the defun anymore.
Thanks.
Do you (or anyone else) see a problem with the alternative proposed by
Daniel? If not, I'd prefer not to revert at this stage, but instead
to apply the simple fix Daniel suggested.
next prev parent reply other threads:[~2023-06-27 11:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <m1o7l3d74m.fsf.ref@yahoo.es>
2023-06-25 13:05 ` bug#64283: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-25 13:38 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-25 15:05 ` Eli Zaretskii
2023-06-25 20:49 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-27 1:42 ` Yuan Fu
2023-06-27 11:01 ` Eli Zaretskii [this message]
2023-06-28 20:11 ` Yuan Fu
2023-06-29 5:41 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83jzvpw4n2.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=64283@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=dmitry@gutov.dev \
--cc=mardani29@yahoo.es \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.