Subject: Re: bug#75876: 29.2; warning "docstring has wrong usage of unescaped single quotes" in easy-mmode.el

From: Eli Zaretskii <[email-masked]>
Date: Sun, 26 Jan 2025 21:32:12 +0200

> Date: Sun, 26 Jan 2025 18:58:12 +0100
> From:  "R. Diez" via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> 
> I am getting the following warning in 'dtrt-indent-global-mode':
> 
> dtrt-indent.el:208:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
> 
> The author of package dtrt-indent.el says the warning is incorrect:
> 
> https://github.com/jscheid/dtrt-indent/issues/79#issuecomment-2614031451
> 
> I do now know much Lisp myself, but I suspect the warning probably actually comes from macro 'define-globalized-minor-mode' in easy-mmode.el, because that macro apparently does have a docstring without proper quoting.
> 
> I am reporting this bug here because easy-mmode.el says it is part of Emacs.

This is because the mode function is defined as lambda:

  (define-globalized-minor-mode dtrt-indent-global-mode dtrt-indent-mode
    (lambda ()
      ;; javascript-mode is an alias for js-mode, so derived-mode-p does not
      ;; detect it is derived from 'prog-mode (Emacs bug #46331: remove once
      ;; Emacs >= 28.1 can be assumed)
      (when (derived-mode-p 'prog-mode 'text-mode 'javascript-mode)
	(dtrt-indent-mode)))

If you load the file and invoke describe-function, it says:

  (dtrt-indent-global-mode &optional ARG)

  Toggle Dtrt-Indent mode in all buffers.
  With prefix ARG, enable Dtrt-Indent-Global mode if ARG is positive;
  otherwise, disable it.

  If called from Lisp, toggle the mode if ARG is ‘toggle’.
  Enable the mode if ARG is nil, omitted, or is a positive number.
  Disable the mode if ARG is a negative number.

  Dtrt-Indent mode is enabled in all buffers where ‘(lambda nil (when
  (derived-mode-p ’prog-mode ’text-mode ’javascript-mode)
  (dtrt-indent-mode)))’ would do it.

And there you see that nonsense with the lambda and the unescaped
quotes.

Stefan, any comments?