Subject: Re: bug#54343: 28.0.91; find-function goes to a wrong place for erc

From: "J.P." <[email-masked]>
Date: Sat, 12 Mar 2022 19:09:30 -0800

Lars Ingebrigtsen <[email-masked]> writes:

> Hm...  it would be nice if it hit the defgeneric instead.  But you can
> have a defmethod without a defgeneric...

Right. To my surprise, it seems there are over 300 such instances of the
"without" variant in the Emacs tree.

So, currently, we have

| defgeneric | defmethod | Old | New | Example                  |
|------------+-----------+-----+-----+--------------------------|
| yes        | no        | g   | g   | xref-backend-definitions |
| no         | yes       | m   | m   | delete-instance          |
| yes        | yes       | g   | m   | xref-location-marker     |

Whereas you're saying we should want

| yes        | yes       | g   | g   | xref-location-marker     |

I think simply adding "generic" to this union

  (: "cl-def" (| "un" "method" "generic"))

may do the trick. IOW

  -cl-\\(?:defun\\|defmethod\\)\\|\
  +cl-\\(?:defun\\|defgeneric\\|defmethod\\)\\|\

appears to work in cursory testing.

>> P.S. OK to install #53617 duplicate checks in erc--switch-to-buffer?
>
> Skimming that bug report, it's not clear to me what the issue was there?

Just a benign optimization involving some culling of redundant code in
`erc--switch-to-buffer'. This email contains the latest version, with a
slightly revised commit message:

  https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-01/msg02081.html

Thanks.