From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Sean Devlin <spd@toadstyle.org>,
Helmut Eller <eller.helmut@gmail.com>,
Stefan Monnier <monnier@iro.umontreal.ca>,
59345@debbugs.gnu.org
Subject: bug#59345: 28.2; peg.el: syntax-class PEX does not advance point
Date: Mon, 28 Nov 2022 14:40:20 -0800 [thread overview]
Message-ID: <874jui1z57.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87r0xnj9sl.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Mon, 28 Nov 2022 08:58:18 -0800")
[-- Attachment #1: Type: text/plain, Size: 724 bytes --]
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
>> Helmut Eller <eller.helmut@gmail.com> writes:
>>
>>> >> In version 1.0 of peg.el, there is a PEX to match the syntax class of
>>> >> the character at point. I expected it to advance the point after
>>> >> recognizing the correct class, but it seems that it does not.
>>
>>> Yes, looks like an oversight.
>>> [...]
>>> I may be the original author (long ago), but the current maintainer is
>>> Sefan Monnier.
>>
>> Ok, thanks for confirming, Helmut. Then I CC Stefan.
>
> I'm finally getting around to adding this package to core, so I'll
> stick myself in the Cc.
I guess the fix would look like the attached?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: peg_syntax_class.diff --]
[-- Type: text/x-patch, Size: 586 bytes --]
diff --git a/peg.el b/peg.el
index 0e4221eeb7..3f86a0bf19 100644
--- a/peg.el
+++ b/peg.el
@@ -588,7 +588,9 @@ of PEG expressions, implicitly combined with `and'."
(cl-defmethod peg--translate ((_ (eql syntax-class)) class)
(let ((probe (assoc class peg-syntax-classes)))
- (cond (probe `(looking-at ,(format "\\s%c" (cadr probe))))
+ (cond (probe `(when (looking-at ,(format "\\s%c" (cadr probe)))
+ (forward-char)
+ t)
(t (error "Invalid syntax class: %S\nMust be one of: %s" class
(mapcar #'car peg-syntax-classes))))))
next prev parent reply other threads:[~2022-11-28 22:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 23:49 bug#59345: 28.2; peg.el: syntax-class PEX does not advance point Sean Devlin
2022-11-18 6:16 ` Michael Heerdegen
2022-11-28 8:32 ` Helmut Eller
2022-11-28 8:55 ` Michael Heerdegen
2022-11-28 16:58 ` Eric Abrahamsen
2022-11-28 22:40 ` Eric Abrahamsen [this message]
2022-11-28 22:50 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-29 9:46 ` Michael Heerdegen
2022-11-29 16:11 ` Eric Abrahamsen
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=874jui1z57.fsf@ericabrahamsen.net \
--to=eric@ericabrahamsen.net \
--cc=59345@debbugs.gnu.org \
--cc=eller.helmut@gmail.com \
--cc=michael_heerdegen@web.de \
--cc=monnier@iro.umontreal.ca \
--cc=spd@toadstyle.org \
/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.