emacs-devel
[Top][All Lists]
Advanced

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

Escape syntax in docstrings


From: Chen Zhaoyang
Subject: Escape syntax in docstrings
Date: Thu, 23 Mar 2023 15:46:12 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

Dear friends,

Since when did emacs become stricter when enforcing the escape syntax in
docstrings? On 27.1 (built by debian), this function evals to no error:

(defun slash-in-docstring ()
 "\x -> x"       
 nil)

but on 30.0.50, the above lisp function will get emacs to complain
`(error "Invalid escape character syntax")`. I believe this is a recent
change. I didn't build from the master branch for only about a week; I
recompiled my emacs yesterday from master and found out that
the lisp code ships with the HOL theorem prover broke on me in the
following two functions (their docstrings, rather, the functions
themselves are fine):

(defun hol-input-compose (f g)
  "\x -> concatMap F (G x)"
  (lexical-let ((f1 f) (g1 g))
    (lambda (x) (hol-input-concat-map f1 (funcall g1 x)))))

(defun hol-input-or (f g)
  "\x -> F x ++ G x"
  (lexical-let ((f1 f) (g1 g))
    (lambda (x) (append (funcall f1 x) (funcall g1 x)))))

The fix is trivial of course
(https://github.com/HOL-Theorem-Prover/HOL/commit/e9e9506209e82b8037b8a4066b7fd672e961c08a),
but going through the recent logs I don't quite find commits explicitly
about escape character in docstrings (I think commit b8e7061232f `Remove
recursion from character escape handling in reader` probably has
something to do with it, but I am not so literate in C).

I am aware that the agda project also uses slash to represent lambdas in
their elisp code
(https://github.com/agda/agda/blob/35bcdbc04e47e49a436b5a097312a672e0ad0074/src/data/emacs-mode/agda-input.el#L56,
courtesy of <ski> on #emacs):

(defun agda-input-compose (f g)
  "\x -> concatMap F (G x)"
    (lambda (x) (agda-input-concat-map f (funcall g x))))

Once this change lands in the next release, this lisp function will certainly 
break.

Can we document this change of behavior? 

-- 
Chen Zhaoyang




reply via email to

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