all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Hongyi Zhao <hongyi.zhao@gmail.com>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: Convert some Latex expressions in Emacs.
Date: Wed, 18 May 2022 08:23:32 +0800	[thread overview]
Message-ID: <CAGP6PO+PwMCM6m_9cJXng55F=f+zrUh5NLQch_GaBr_BG2ygSg@mail.gmail.com> (raw)
In-Reply-To: <87fsl7n2pb.fsf@web.de>

On Wed, May 18, 2022 at 7:45 AM Michael Heerdegen
<michael_heerdegen@web.de> wrote:
>
> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
> > I rechecked the description here [1], and still can't find any
> > difference. Why do you say they are different?
> >
> > [1] https://www.emacswiki.org/emacs/peg.el
>
> PEGs can match more "complicated" things than regexps can,
> e.g. mathematical formulas.  Theory here:
>
>  https://en.wikipedia.org/wiki/Parsing_expression_grammar
>
> Unlike regexps, a PEG contains a set of named "rules" (as know from
> formal grammars).  These are allowed to be recursive and interdependent.
> This also allows to describe a "matcher" in a more structured and
> better (human)readable way.
>
> peg.el is implemented in Elisp and has some additional features like
> executing Elisp code while matching is performed.
>
> Still, when familiar with regexps, PEGs also look familiar, as you have
> already noticed.
>
> But I mentioned this only because I noticed your academical background,
> and thought that somebody who likes GAP also might be interested in that
> approach.  If you just want to get things done, DON'T look at PEGs, use
> regexps (`query-replace-regexp', C-M-%) for now.
>
> Should not be hard to do: removing stuff works by replacing with the
> empty string.  You may want to know how to refer to the matched string
> and how to use Lisp expressions to calculate parts of the replacement
> string, that's explained here:
>
>   (info "(emacs) Regexp Replace")
>
> and the rest should be doable quite trivially.  Or do you have any
> concrete questions or problems?  Or should we spell some things out?

Got the idea and the specific practices, thank you for your comments.

>
> Michael.

Best,
Hongyi



      reply	other threads:[~2022-05-18  0:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16  3:25 Convert some Latex expressions in Emacs Hongyi Zhao
2022-05-16  4:49 ` Emanuel Berg
2022-05-17  0:02 ` Michael Heerdegen
2022-05-17  2:12   ` Hongyi Zhao
2022-05-17  2:22     ` Emanuel Berg
2022-05-17  3:23     ` Michael Heerdegen
2022-05-17  3:38       ` Michael Heerdegen
2022-05-17  3:44       ` Hongyi Zhao
2022-05-17  4:46         ` Emanuel Berg
2022-05-18  0:25           ` Hongyi Zhao
2022-05-17 23:45         ` Michael Heerdegen
2022-05-18  0:23           ` Hongyi Zhao [this message]

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='CAGP6PO+PwMCM6m_9cJXng55F=f+zrUh5NLQch_GaBr_BG2ygSg@mail.gmail.com' \
    --to=hongyi.zhao@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael_heerdegen@web.de \
    /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.