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: [PATCH] Scheme-mode: Add support for regular expression literal Date: Thu, 28 Mar 2024 21:40:11 +0900 Message-ID: <6d79d884-e691-4223-be1b-ada141ad8f37@app.fastmail.com> References: <87msqpfz68.fsf@niceume.com> <20240328123354.17588d57@jcubic> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7739"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.11.0-alpha0-333-gbfea15422e-fm-20240327.001-gbfea1542 Cc: "Stefan Monnier" , emacs-devel@gnu.org, "Eli Zaretskii" To: "Jakub T. Jankiewicz" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 28 13:42:15 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 1rpp5A-0001oM-Pb for ged-emacs-devel@m.gmane-mx.org; Thu, 28 Mar 2024 13:42:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpp40-0000AH-RS; Thu, 28 Mar 2024 08:41:01 -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 1rpp3p-00008C-Hf for emacs-devel@gnu.org; Thu, 28 Mar 2024 08:40:51 -0400 Original-Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rpp3g-0001J6-4C; Thu, 28 Mar 2024 08:40:44 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 87AC53200A09; Thu, 28 Mar 2024 08:40:34 -0400 (EDT) Original-Received: from imap48 ([10.202.2.98]) by compute5.internal (MEProxy); Thu, 28 Mar 2024 08:40:34 -0400 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:references:reply-to:subject :subject:to:to; s=mesmtp; t=1711629633; x=1711716033; bh=frkoE5z WACJWpQqIs4BO4ro03e+tY/I1ZNN5LqSUAWw=; b=QOx0Jn2Rg1lA5g1XdrYR/Bj BibndSw+2y9O9WBnBMmWNJO06SRh5txkPHsqFGGzhsY4slcnyRcaVZQ6Tzp981ri 3Xkk9nMzITkVkCaz9X73dqcYY0pOtZP2jIg3LsnFLMUAkp4CWYHStJeel1CrfcF7 d2cMHVGBD+IzB0tB/5I0= 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:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1711629633; x=1711716033; bh=frkoE5zWACJWpQqIs4BO4ro03e+t Y/I1ZNN5LqSUAWw=; b=aR0ZoJu9A9U9RkJoD4eX82RI9dxdGBiSFBkBlh1FXcFv pAdckd/fvqAe6/P/0OFcuP1rjg2Featpzx43e+3nNezrYTiW9SZDP9FCvLP1Zhux QAmfPU8rGPz+dVW8hLKr+Xrvu1jz+YmnAh5RHmC2+YOUr7ZACdV0UtUWd7V+EjVR IggXTgoud9gHBnJJFIX0l+qXZY52axPDxPSw1oOar2lgHBlFrvsGdsSaJXdXpuEv NaozlihD2ZbWR7h2gq/Rv/PrpT9M3W2Gy8lW3XXe/i4ayfWHGDSN6lzLwxLzElOl uSpL1NAhaZJrVzJCf40p+27lIlOWPuR0XP/82F7MOg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudduledggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedfvfho shhhihcufghmvghhrghrrgdfuceothhoshhhihesnhhitggvuhhmvgdrtghomheqnecugg ftrfgrthhtvghrnhepgedttdffgefhieehtedvtdfhteeiveefveduueeggeffgffghfej tddtgeejgedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthhoshhhihesnhhitggvuhhmvgdrtghomh X-ME-Proxy: Feedback-ID: iaf1147ca:Fastmail Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id 1088C31A0066; Thu, 28 Mar 2024 08:40:32 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: <20240328123354.17588d57@jcubic> Received-SPF: pass client-ip=64.147.123.21; envelope-from=toshi@niceume.com; helo=wout5-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 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:317359 Archived-At: The code below, which works in init.el, corresponds to the updated scheme.el . Could you try it ? (add-hook 'scheme-mode-hook (lambda () (setq-local syntax-propertize-function (lambda (beg end) (goto-char beg) (scheme-syntax-propertize-sexp-comment2 end) (scheme-syntax-propertize-regexp end) (funcall (syntax-propertize-rules ("\\(#\\);" (1 (prog1 "< cn" (scheme-syntax-propertize-sexp-comment2 end)))) ("\\(#\\)/" (1 (when (null (nth 8 (save-excursion (syntax-ppss (match-beginning 0))))) (put-text-property (match-beginning 1) (match-end 1) 'syntax-table (string-to-syntax "|")) (scheme-syntax-propertize-regexp end) nil) ))) (point) end))))) (defun scheme-syntax-propertize-sexp-comment2 (end) (let ((state (syntax-ppss))) (when (eq 2 (nth 7 state)) ;; It's a sexp-comment. Tell parse-partial-sexp where it ends. (condition-case nil (progn (goto-char (+ 2 (nth 8 state))) ;; FIXME: this doesn't handle the case where the sexp ;; itself contains a #; comment. (forward-sexp 1) (put-text-property (1- (point)) (point) 'syntax-table (string-to-syntax "> cn"))) (scan-error (goto-char end)))))) (defun scheme-syntax-propertize-regexp (end) (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 'move) (eq -1 (% (save-excursion (backward-char) (skip-chars-backward "\\\\")) 2)))) (when (< (point) end) (progn (put-text-property (match-beginning 0) (match-end 0) 'syntax-table (string-to-syntax "|")) ))) ))