all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Convert some Latex expressions in Emacs.
Date: Wed, 18 May 2022 01:45:20 +0200	[thread overview]
Message-ID: <87fsl7n2pb.fsf@web.de> (raw)
In-Reply-To: CAGP6POJx_psqM+n-fBa743QURGRotfi_RsAgiiQCaNyogUkVWQ@mail.gmail.com

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?


Michael.




  parent reply	other threads:[~2022-05-17 23:45 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 [this message]
2022-05-18  0:23           ` Hongyi Zhao

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=87fsl7n2pb.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=help-gnu-emacs@gnu.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.