bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#69387: 30.0.50; A string shouldn't be both a docstring and a return


From: Eshel Yaron
Subject: bug#69387: 30.0.50; A string shouldn't be both a docstring and a return value
Date: Sun, 25 Feb 2024 18:33:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Stefan,

Stefan Monnier writes:

> Package: Emacs
> Version: 30.0.50
>
>
> Currently, ELisp defines
>
>     (lambda (blabla) "Help!")
>
> as a function that returns "Help!" *and* whose docstring is "Help!".
> As seen in commit eeb89a5cb292bffe40ba7d0b0cf81f82f8452bf8, it can be
> a source of annoyance as well.
>
> I cannot remember finding source code which makes use of this "feature".

vc-mode kind of abuses of this feature:

--8<---------------cut here---------------start------------->8---
(defun vc-mode (&optional _arg)
  ;; Dummy function for C-h m
  "Version Control minor mode.
This minor mode is automatically activated whenever you visit a file under
control of one of the revision control systems in `vc-handled-backends'.
VC commands are globally reachable under the prefix \\[vc-prefix-map]:
\\{vc-prefix-map}")
--8<---------------cut here---------------end--------------->8---

Here the assumption is that the string is used as a doc string, which
indeed leads to unexpected results, see Bug#65092.


Best,

Eshel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]