From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Scheme-mode: Add support for regular expression literal Date: Sat, 23 Mar 2024 16:57:07 -0400 Message-ID: References: <87msqpfz68.fsf@niceume.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="3955"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org, Eli Zaretskii , jcubic@onet.pl To: Toshi Umehara Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 23 21:58:19 2024 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 1ro8RX-0000pL-CQ for ged-emacs-devel@m.gmane-mx.org; Sat, 23 Mar 2024 21:58:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ro8Qm-0001of-Tz; Sat, 23 Mar 2024 16:57:32 -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 1ro8Qk-0001o5-Sz for emacs-devel@gnu.org; Sat, 23 Mar 2024 16:57:31 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ro8Qf-0002nC-Gd; Sat, 23 Mar 2024 16:57:30 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 6D0411000FC; Sat, 23 Mar 2024 16:57:20 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1711227436; bh=Y40yljDDyHft++gH6Ji2yKVPLb8bcQgf9xzVgumKTXA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=dmpLvXHeG3TRIHs7AQ5pRLozoklU3R+kx2RIIPc5ct77HIfsh7P3WKwokG39X21Wm JBKzOehPAMkAvKnuUyIOsKabKAwFkgubLeo/bZi+x1Aq7MNd01aUwQB/pcua4vvt75 YfJP0YJ3ro0F8hrHU/AWfa4CXT9UAcDnnAEcEGp0J10hufxtR0oZ3RXEQ6K+D3h7oS 7YPZG1zQvcXXSjSTEL9SRph8F3meldQTw0vFG71MvsUaqDt1CKPixxRuychBnlueGX uXpWWwpH5CsFynKH14ZG6e21dyzQah9jGwwGmKACwgb8jLBr6mCTjNObFKTzEHiw2q RQV4U24V96sOg== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 5873810004A; Sat, 23 Mar 2024 16:57:16 -0400 (EDT) Original-Received: from alfajor (unknown [104.247.238.200]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1FBFB120403; Sat, 23 Mar 2024 16:57:16 -0400 (EDT) In-Reply-To: <87msqpfz68.fsf@niceume.com> (Toshi Umehara's message of "Sat, 23 Mar 2024 11:40:47 +0900") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham 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:317254 Archived-At: > This patch against 'scheme.el' enables scheme-mode to handle regular > expression literal #/regexp/ that is availabe in some Scheme > implementations such as GNU Kawa [1] and Gauche [2]. Thanks, I was preparing to install the patch but then noticed that I can't see your name in the list of people who signed the copyright paperwork. If indeed you haven't signed it yet, then we need you to sign that paperwork first. For that, please fill the form below and send it as instructed to the FSF so they can send you the relevant paperwork to sign. In the mean time, some comments on your patch: > (syntax-propertize-rules > ("\\(#\\);" (1 (prog1 "< cn" > - (scheme-syntax-propertize-sexp-comment (point) end))))) > + (scheme-syntax-propertize-sexp-comment (point) end)))) > + ("\\(#\\)/" (1 (when (null (nth 8 (save-excursion > + (syntax-ppss > + (match-beginning 0))))) > + (put-text-property > + (match-beginning 0) > + (1+ (match-beginning 0)) > + 'syntax-table (string-to-syntax "|")) > + (scheme-syntax-propertize-regexp > + (point) end) > + nil) > + ))) > (point) end)) The \\( and \\) around the # are there to create a subgroup 1, but you don't actually make use of this subgroup. So either: - Remove those \\( and \\) since they're not needed (and change the "(1" to "(0"), or - Replace (match-beginning 0) and (1+ (match-beginning 0)) with (match-beginning 1) and (match-end 1). > +(defun scheme-syntax-propertize-regexp (_ end) If you don't make use of the first arg, better remove it form here and from your callers. > + (let* ((state (syntax-ppss)) > + (within-str (nth 3 state)) > + (start-delim-pos (nth 8 state))) > + (when (and within-str > + (char-equal ?# (char-after start-delim-pos))) > + (while > + (and > + (re-search-forward "/" end t) > + (eq -1 > + (% (save-excursion > + (backward-char) > + (skip-chars-backward "\\\\")) 2)))) > + (when (< (point) end) This condition will be true when `search-forward` failed to find a slash before `end` (I suspect this is what causes the problems that Mattias saw). One way to fix the problem is to pass `move` rather than `t` as last argument to `search-forward`. Stefan Please email the following information to assign@gnu.org, and we will send you the assignment form for your past and future changes. Please use your full legal name (in ASCII characters) as the subject line of the message. ---------------------------------------------------------------------- REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES [What is the name of the program or package you're contributing to?] Emacs [Did you copy any files or text written by someone else in these changes? Even if that material is free software, we need to know about it.] [Do you have an employer who might have a basis to claim to own your changes? Do you attend a school which might make such a claim?] [For the copyright registration, what country are you a citizen of?] [What year were you born?] [Please write your email address here.] [Please write your postal address here.] [Which files have you changed so far, and which new files have you written so far?] [Additional people we should notify about the progress of the assignment.] Stefan Monnier