GNU bug report logs - #49592
28.0.50; lisp-current-defun-name and non-standard defuns

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Fri, 16 Jul 2021 02:55:02 UTC

Severity: normal

Found in version 28.0.50

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 49592 <at> debbugs.gnu.org
Subject: bug#49592: 28.0.50; lisp-current-defun-name and non-standard defuns
Date: Thu, 04 Aug 2022 18:31:22 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> 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.

This function is documented as:

(defun lisp-current-defun-name ()
  "Return the name of the defun at point, or nil."

There is no defun at point in this situation, so perhaps it would make
sense to return nil here?  But this is also used by add-log, so perhaps
which-func should just use something completely different and more
strict.  I.e., skip back to the top-level form, and then use the edebug
spec to pick out the name?





This bug report was last modified 2 years and 325 days ago.

Previous Next


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