From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Chen Zhaoyang Newsgroups: gmane.emacs.devel Subject: Escape syntax in docstrings Date: Thu, 23 Mar 2023 15:46:12 -0500 Message-ID: <87edpfnqln.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21936"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Cancel-Lock: sha1:j68Xu7o/lgDTExuhgaEUSQT7VRo= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 23 21:47:24 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pfRqG-0005Ol-5E for ged-emacs-devel@m.gmane-mx.org; Thu, 23 Mar 2023 21:47:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfRpO-00061t-QM; Thu, 23 Mar 2023 16:46:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfRpN-00061e-Qh for emacs-devel@gnu.org; Thu, 23 Mar 2023 16:46:29 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfRpK-0007Sh-78 for emacs-devel@gnu.org; Thu, 23 Mar 2023 16:46:29 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1pfRpG-0003cX-B8 for emacs-devel@gnu.org; Thu, 23 Mar 2023 21:46:22 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304739 Archived-At: 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 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