all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 39972@debbugs.gnu.org, Philipp Stephani <p.stephani2@gmail.com>
Subject: bug#39972: 28.0.50; which-function no longer returning current Java method in Emacs 27
Date: Thu, 21 May 2020 17:42:11 +0000	[thread overview]
Message-ID: <20200521174211.GA12036@ACM> (raw)
In-Reply-To: <835zcp5knl.fsf@gnu.org>

Hello, Eli.

On Thu, May 21, 2020 at 19:15:42 +0300, Eli Zaretskii wrote:
> > From: Philipp Stephani <p.stephani2@gmail.com>
> > Date: Thu, 21 May 2020 17:56:16 +0200
> > Cc: 39972@debbugs.gnu.org

> > Do you think you could push these patches onto the release branch, as
> > this appears to be a regression?

> The fixes (especially the one for which-func) are too risky for the
> release branch.  Is it possible to come up with something simpler for
> emacs-27?

See below.

> What change(s) caused the regression, exactly?

class Foo {
    void bar() {
    // body      <============== Point is here.
    }
}


Traditionally, the function which-function (in which-func.el) has tried a
row of methods to find the current function, stopping after finding the
first non-null result.

Emacs 26's CC Mode's value of add-log-current-defun returned nil, after
which which-function tried querying the imenu structures, which worked
OK.

emacs-27's CC Mode's value of add-log-current-defun now returns the top
level function, "class Foo".  which-function no longers proceeds to the
imenu stuff.  "class Foo" is here the result returned by which-function.
This is not OK.

master's CC Mode's value of add-log-current-defun now returns "bar".

The remainder of the recent patch to which-function ensures that if
add-log-current-defun IS ACTUALLY CALLED and returns nil, this nil
becomes which-function's result.  There were previously problems where
add-log-current-defun had returned nil because point was outside any
function, yet imenu would later return a spurious function name.

> Is it possible to come up with something simpler for emacs-27?

I think the change (in master) to CC Mode's value of
add-log-current-defun could be put into emacs-27 on its own.  This should
be safe.

The patch which made this change (bug #39972) was:
5989432d15feb4439e759d2c0e28233ca22a7604
"CC Mode: Fix bug #39972, by fixing c-display-defun-name for nested
defuns"
Date:   Wed May 20 19:02:26 2020 +0000.

What do you say to putting this into emacs-27?

-- 
Alan Mackenzie (Nuremberg, Germany).





  parent reply	other threads:[~2020-05-21 17:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-07 13:07 bug#39972: 28.0.50; which-function no longer returning current Java method in Emacs 27 Philipp Stephani
     [not found] ` <mailman.2226.1583586546.2412.bug-gnu-emacs@gnu.org>
2020-03-08 11:33   ` Alan Mackenzie
2020-05-20 19:13     ` Alan Mackenzie
2020-05-21 15:56       ` Philipp Stephani
2020-05-21 16:15         ` Eli Zaretskii
2020-05-21 17:24           ` Philipp Stephani
2020-05-21 17:26             ` Philipp Stephani
2020-05-21 19:15             ` Eli Zaretskii
2020-05-21 17:42           ` Alan Mackenzie [this message]
2020-05-21 19:14             ` Eli Zaretskii
2020-05-21 20:19               ` Alan Mackenzie
2020-05-22  5:58                 ` Eli Zaretskii
2020-05-22  9:58                   ` Alan Mackenzie
2020-05-23 19:12                     ` Philipp Stephani
2020-04-19 14:03 ` Alan Mackenzie

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=20200521174211.GA12036@ACM \
    --to=acm@muc.de \
    --cc=39972@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=p.stephani2@gmail.com \
    /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.