Emacs 29 Byte Compile Unescaped Single Quote Warning

By Xah Lee. Date: . Last updated: .

emacs 29, byte compile problem on single quote

emacs 29, if your function's Docstring contains a single quote e.g.

some 'name

, you need to replace them by

some \\='name

else the doc string wont show correctly, and in emacs 29 you get a compiler warning.

Warning: docstring has wrong usage of unescaped single
    quotes (use \= or different quoting)
emacs 29 compile single quote 2023-08-03 BRqbT
emacs 29 compile single quote 2023-08-03 BRqbT

This is a major problem introduced by Alan Mackenzie. Emacs Lisp Doc String Curly Quote Controversy (2015)

Solution

Emacs 29 NEWS Documentation on the Compiler Single Quote Error

*** Byte compilation will now warn about some quoting mistakes in docstrings. When writing code snippets that contains the "'" character (APOSTROPHE), that quote character has to be escaped to avoid Emacs displaying it as "’" (LEFT SINGLE QUOTATION MARK), which would make code examples like

    (setq foo '(1 2 3))

invalid. Emacs will now warn during byte compilation if it sees something like that, and also warn about when using RIGHT/LEFT SINGLE QUOTATION MARK directly. In both these cases, if these characters should really be present in the docstring, they should be quoted with "\=".

Emacs Text Quoting Conversion in Docstring

Emacs, Byte Compile