From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Toshi Umehara Newsgroups: gmane.emacs.devel Subject: Re: Scheme Mode and Regular Expression Literals Date: Sat, 09 Mar 2024 11:59:10 +0900 Message-ID: <87sf105cw1.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="20814"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: jcubic@onet.pl Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 09 04:00:30 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 1rimwl-00054k-SL for ged-emacs-devel@m.gmane-mx.org; Sat, 09 Mar 2024 04:00:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rimvj-0007xN-MT; Fri, 08 Mar 2024 21:59:23 -0500 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 1rimvg-0007wy-O3 for emacs-devel@gnu.org; Fri, 08 Mar 2024 21:59:20 -0500 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rimve-0001uN-37 for emacs-devel@gnu.org; Fri, 08 Mar 2024 21:59:20 -0500 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 6DA875C004D; Fri, 8 Mar 2024 21:59:15 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 08 Mar 2024 21:59:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niceume.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to; s=mesmtp; t=1709953155; x=1710039555; bh=TeVNW39oA+p3BMTAWG 4TBncv7P3B8i13rtWR2/KpItk=; b=cuMl2NwO8YpNkt8MsTnCZDxDzqNL/56A8a dXlcCRS9FOSSk3WetTCmr6uAajdKQG+VhLQrxI41OE32nclE5g+xRrokX2FKH3V8 Rqh4jZ/0p+RGtsckpBYLdu8+TD3zeTQnB++yglO4gGOFrFz8cifl4j2WKYoYFdOZ M4tmF3AFY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1709953155; x=1710039555; bh=TeVNW39oA+p3BMTAWG4TBncv7P3B 8i13rtWR2/KpItk=; b=meDhGoAYv8wKiUuka7fEESPyuFDXCSWMo8UEUZUcR3q3 dJVgA2d1pRY32F0OrOaf6kDKTNvXOvde4PNvWPnwjNXFZjlKz8rVbTOXtqK8Ziqr ieAycn4imC+OEMuQdHNjm0vEMzEMkyvCVNeYCF3s0yWj0RrVx1ErBrmtP7cV5HDY bhY0RUCEg0KVxhXz6qKDOPzFiI2SESUD9wtgXEo1/VVZoCFFffrC+kumrbovI6pX gbl9Xj+QaZc86lbjubMLPBhS1dusJObb2Kk1gq/Ih93w5ijcIUaAihj9b2b7HKld 9g6uTQTJRm6JCCawYZM6WdGzMmJxQorJ3r9dHPMyFQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrieeigdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvvefujgffkfggtgesthdtredttd dttdenucfhrhhomhepvfhoshhhihcufghmvghhrghrrgcuoehtohhshhhisehnihgtvghu mhgvrdgtohhmqeenucggtffrrghtthgvrhhnpedtkedvgfefledtvdehffevuefghfffie ffgeevhedujeevjeekgeduvdelieejveenucffohhmrghinhephhgrthgvnhgrsghlohhg rdhjphenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe htohhshhhisehnihgtvghumhgvrdgtohhm X-ME-Proxy: Feedback-ID: iaf1147ca:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Mar 2024 21:59:13 -0500 (EST) In-Reply-To: 20240227154655.1f6057a0@jcubic Received-SPF: pass client-ip=66.111.4.27; envelope-from=toshi@niceume.com; helo=out3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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:316932 Archived-At: Regular expression literals as exist in Gauche Scheme does not seem to work in scheme mode. #/regexp/ is not dealt as a chunk. I looked for its solution on the Web, and reached this web page, https://ardggy.hatenablog.jp/entry/2015/11/24/143713 (in Japanese). The solution on the page overwrites syntax-propertize-function and adds a new rule for regular expression literals. I got a hint from it, and have tried to manage backslash slash ( \/ ) not to finish the literal and backshashes of even numbers (like \\\\ ) not to work as escapes. Currently, the following code in init.el works for me. #+BEGIN_SRC (add-hook 'scheme-mode-hook (lambda () (setq-local syntax-propertize-function (lambda (start end) (goto-char start) (funcall (syntax-propertize-rules ;; For #/regexp/ syntax ("\\(#\\)/\\(\\\\/\\|\\\\\\\\\\|.\\)*?\\(/\\)" (1 "|") (3 "|")) ;; For #; comment syntax ("\\(#\\);" (1 (prog1 "< cn" (scheme-syntax-propertize-sexp-comment (point) end))))) (point) end)) )) ) #+END_SRC Hope this helps. -- Toshi (Toshihiro Umehara)