all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Toshi Umehara <toshi@niceume.com>
Cc: emacs-devel@gnu.org,  Eli Zaretskii <eliz@gnu.org>,  jcubic@onet.pl
Subject: Re: [PATCH] Scheme-mode: Add support for regular expression literal
Date: Sat, 23 Mar 2024 16:57:07 -0400	[thread overview]
Message-ID: <jwv4jcw7jzl.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87msqpfz68.fsf@niceume.com> (Toshi Umehara's message of "Sat, 23 Mar 2024 11:40:47 +0900")

> 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 <monnier@gnu.org>




  parent reply	other threads:[~2024-03-23 20:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-23  2:40 [PATCH] Scheme-mode: Add support for regular expression literal Toshi Umehara
2024-03-23 14:28 ` Jakub T. Jankiewicz
2024-03-23 20:57 ` Stefan Monnier [this message]
2024-03-24  4:33   ` Toshi Umehara
2024-03-28 11:33     ` Jakub T. Jankiewicz
2024-03-28 12:40       ` Toshi Umehara
2024-03-28 23:43         ` Jakub T. Jankiewicz
2024-03-29  6:48           ` Eli Zaretskii
2024-03-29 11:09             ` Jakub T. Jankiewicz
2024-03-29 15:02               ` Toshi Umehara
2024-03-29 15:38                 ` Eli Zaretskii
2024-03-30  0:48                   ` Toshi Umehara
2024-04-01  6:17       ` Stefan Monnier
2024-03-30  7:59     ` Eli Zaretskii
2024-04-01  5:31       ` Stefan Monnier
2024-04-01  5:24     ` Stefan Monnier
2024-04-02  8:48       ` Toshi Umehara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv4jcw7jzl.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jcubic@onet.pl \
    --cc=toshi@niceume.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.