[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scheme Mode and Regular Expression Literals

From: Toshi Umehara
Subject: Re: Scheme Mode and Regular Expression Literals
Date: Sat, 09 Mar 2024 11:59:10 +0900

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.

(add-hook 'scheme-mode-hook
          (lambda ()
             (lambda (start end)
               (goto-char start)
                 ;; For #/regexp/ syntax
                  (1 "|")
                  (3 "|"))
                 ;; For #; comment syntax
                  (1 (prog1 "< cn"
                        (point) end)))))
                (point) end))

Hope this helps.

Toshi (Toshihiro Umehara)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]