unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Stefan Kangas <stefankangas@gmail.com>,
	Dmitry Gutov <dgutov@yandex.ru>, Eli Zaretskii <eliz@gnu.org>
Cc: "monnier@iro.umontreal.ca" <monnier@iro.umontreal.ca>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: [External] : Re: Ugly regexps
Date: Wed, 3 Mar 2021 22:17:52 +0000	[thread overview]
Message-ID: <SA2PR10MB4474EF6074E0B136CCD32954F3989@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <CADwFkmnZCvR7U6p4+8TN2Ueu6aAdk3z6zyNaKcENrB6RFwgpPQ@mail.gmail.com>

> >> for a lot of people this won't be +1 thing to learn.
> >
> > See my previous message.  It _will_ be a +1 to learn,
> > in the context of Emacs, if people have to also learn
> > the Elisp syntax anyway, for interactive use.

sk> We could add an option to prefer ERE in interactive use.

Sure, if it were supported generally.

sm> WRT interactive regexp syntax, I'm still hoping someone will write
sm> a proper package that lets the user choose which regexp syntax to use.
sm> Currently `re-builder` has such a thing, but it should really apply
sm> "across the board", i.e. in `read-regexp`, in Isearch, and anywhere
sm> else we read regexps from the keyboard.

Sure, worth hoping.

And then have an option to express one's preference.

Or several options?  Depending on what's implemented,
maybe someone will prefer one thing for, say, Isearch
query-replace*, and completion, and another thing for
some other interactive uses?

[But since Emacs (not so wisely, IMO) forbids commands
from binding options, code couldn't just bind such a
variable when calling `read-regexp'.  `read-regexp'
could accept another arg for this, of course, but then
that too could, in a sense, override a user preference.]
 
> This is largely orthogonal to what we use in ELisp code.

In one sense, sure.  And especially if we're now talking
only about different regexp dialects, and not also about
alternative ways, such as RX, to enter/create a regexp.

But as I mentioned, I don't think it's orthogonal, in
practice, to what people actually use when coding Elisp.

I think they often code based on what they're used to
using, which, at least for now, is mostly the interactive
syntax (modulo backslashing, etc. for Elisp).  Use of
something like RX seems to be less common, so far.

And then there's the question, interactively, of choosing
one or another.

Often you use a very simple regexp for searching or
completion matching - even just a substring (no special
chars).  Less often you need a more complex regexp.

Will someone want to use something like RX for simple
patterns too?  Would going through some kind of
interactive RX dialog be cumbersome for something simple?
We'd want to make sure that any dialog to be defined
keeps the simple simple.  `(rx "abc")' is simple enough -
it should be possible to type just `abc', like we do now.  

(At least among regexp dialects, as opposed to something
like RX, use of simple-vs-complex patterns shouldn't make
any difference, from one dialect to another.)

BTW, I see this in (emacs) `Rx Notation':

  The ‘rx’ notation is mainly useful in Lisp code; it
  cannot be used in most interactive situations where
  a regexp is requested, such as when running
  ‘query-replace-regexp’ or in variable customization.

I guess that's just saying that an RX-based dialog isn't
available yet, not that it's inconceivable or couldn't
be useful.

  reply	other threads:[~2021-03-03 22:17 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03  0:32 Ugly regexps Stefan Monnier
2021-03-03  1:32 ` Stefan Kangas
2021-03-03  2:08   ` Stefan Kangas
2021-03-03  6:19     ` Eli Zaretskii
2021-03-03 20:46   ` Alan Mackenzie
2021-03-04 18:35     ` Stefan Kangas
2021-03-03  6:00 ` Eli Zaretskii
2021-03-03 15:46   ` Stefan Monnier
2021-03-03 16:30     ` Eli Zaretskii
2021-03-03 17:44       ` Stefan Monnier
2021-03-03 18:46         ` Stefan Kangas
2021-03-03 19:21           ` Eli Zaretskii
2021-03-03 19:50             ` Stefan Kangas
2021-03-03 20:16               ` Stefan Kangas
2021-03-03 19:50             ` Stefan Kangas
2021-03-03 19:58             ` Dmitry Gutov
2021-03-03 20:07               ` [External] : " Drew Adams
2021-03-03 20:31                 ` Stefan Kangas
2021-03-03 22:17                   ` Drew Adams [this message]
2021-03-03 22:32                     ` Stefan Monnier
2021-03-03 20:32                 ` Stefan Monnier
2021-03-04  5:47               ` Eli Zaretskii
2021-03-04 10:49                 ` Lars Ingebrigtsen
2021-03-04 11:25                   ` Mattias Engdegård
2021-03-04 11:28                   ` Alan Mackenzie
2021-03-04 14:11                   ` Eli Zaretskii
2021-03-04 14:25                 ` Dmitry Gutov
2021-03-04 14:50                   ` tomas
2021-03-04 15:04                     ` Dmitry Gutov
2021-03-05  5:45                       ` Richard Stallman
2021-03-05 11:47                         ` Dmitry Gutov
2021-03-06  5:11                           ` Richard Stallman
2021-03-04 15:05                     ` Dmitry Gutov
2021-03-04 15:11                   ` Eli Zaretskii
2021-03-03 19:32           ` [External] : " Drew Adams
2021-03-03  7:09 ` Helmut Eller
2021-03-03 14:11   ` Stefan Kangas
2021-03-03 16:40     ` Stefan Monnier
2021-03-03 15:49   ` Stefan Monnier
2021-03-03 12:17 ` Dmitry Gutov
2021-03-03 15:48   ` Stefan Monnier
2021-03-03 13:57 ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=SA2PR10MB4474EF6074E0B136CCD32954F3989@SA2PR10MB4474.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=stefankangas@gmail.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).