GNU bug report logs - #39972
28.0.50; which-function no longer returning current Java method in Emacs 27

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Sat, 7 Mar 2020 13:09:02 UTC

Severity: normal

Found in version 28.0.50

Done: Philipp Stephani <p.stephani2 <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39972 <at> debbugs.gnu.org, Philipp Stephani <p.stephani2 <at> 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
Hello, Eli.

On Thu, May 21, 2020 at 19:15:42 +0300, Eli Zaretskii wrote:
> > From: Philipp Stephani <p.stephani2 <at> gmail.com>
> > Date: Thu, 21 May 2020 17:56:16 +0200
> > Cc: 39972 <at> 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).




This bug report was last modified 4 years and 359 days ago.

Previous Next


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