Subject: bug#49592: 28.0.50; lisp-current-defun-name and non-standard defuns

From: Michael Heerdegen <[email-masked]>
Date: Fri, 16 Jul 2021 04:53:53 +0200

Hello,

consider a top-level expression like this (you might want to insert this
snipped into *scratch* for testing):

(progn
  ;; comment
  ;; about that
  (define-key ...)
  )

With `which-function-mode' enabled, more or less the complete expression
is shown in the mode-line (with newlines escaped) when moving into the
expression.

The reason: `lisp-current-defun-name' doesn't check for whether the
second subexpression of a top-level expression is still on the same line
- it just returns a string including everything (i.e. all comments) in
between.

Dunno what the best fix is.  In the above case returning something like
"(progn ...)" would be best, since the second subexpression is not even
a name (a symbol).

TIA,

Michael.

In GNU Emacs 28.0.50 (build 38, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2021-07-16 built on drachen
Repository revision: c5d6d45b48b2a4799ad1d27a2e7551113801b097
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
System Description: Debian GNU/Linux bullseye/sid

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB