unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chen Zhaoyang <chenzhauyang@gmail.com>
To: emacs-devel@gnu.org
Subject: Escape syntax in docstrings
Date: Thu, 23 Mar 2023 15:46:12 -0500	[thread overview]
Message-ID: <87edpfnqln.fsf@gmail.com> (raw)

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	other threads:[~2023-03-23 20:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 20:46 Chen Zhaoyang [this message]
2023-03-23 22:02 ` Escape syntax in docstrings Mattias Engdegård
2023-03-24 16:17   ` James Cloos
2023-03-24 21:17   ` Philip Kaludercic
2023-03-28 12:14   ` Robert Pluim
2023-03-28 12:27     ` Andreas Schwab
2023-03-28 15:23       ` Robert Pluim
2023-03-24  4:04 ` Ruijie Yu via Emacs development discussions.
2023-03-24  4:44   ` Chen Zhaoyang
2023-03-24 18:29     ` Eli Zaretskii
2023-03-24 19:58       ` Chen Zhaoyang
  -- strict thread matches above, loose matches on Subject: below --
2023-03-23 22:32 Chen Zhaoyang
2023-03-24 13:22 ` Mattias Engdegård
2023-03-24 15:58 ` David Ongaro
2023-03-24 17:22   ` Chen Zhaoyang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edpfnqln.fsf@gmail.com \
    --to=chenzhauyang@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).