emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rx.el sexp regexp syntax


From: Robert Pluim
Subject: Re: rx.el sexp regexp syntax
Date: Thu, 31 May 2018 10:57:03 +0200

Richard Stallman <address@hidden> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > > The clearer representation of structure is not the same thing as
>   > > verbosity.  rx does both, but they are not the same thing.  We could
>   > > envision making the structure more or less equally clear without
>   > > making the patterns so long.
>
>   > It's not clear to me how you'd do that. 
>
> I don't see a specific way either, but someone might come up with a way.
> I'm suggesting this as a topic of investigation.
>
>   > and frankly being able to write 'bos' rather than remembering '\\`' or
>   > 'symbol-start' rather than '\\_<' is a net win in my eyes.
>
> I agree, as regards those.  On the other hand, those strings might not
> be the best.  Maybe 'text<' and 'sym<' would be better.  We could
> have a series of keywords, XYZ< and XYZ>, which would be as systematic
> as now or more so, and shorter too.

What we have now is [be]o[lstw], which covers lines, strings, and
words. The only thing missing is symbols, which is easily fixed like
so [1]:

diff --git i/lisp/emacs-lisp/rx.el w/lisp/emacs-lisp/rx.el
index 8059bf2a6e..833321cd7b 100644
--- i/lisp/emacs-lisp/rx.el
+++ w/lisp/emacs-lisp/rx.el
@@ -170,7 +170,9 @@ rx-constituents
     (word-boundary     . "\\b")
     (not-word-boundary . "\\B")        ; sregex
     (symbol-start       . "\\_<")
+    (boS               . "\\_<")
     (symbol-end         . "\\_>")
+    (eoS               . "\\_>")
     (syntax            . (rx-syntax 1 1))
     (not-syntax                . (rx-not-syntax 1 1)) ; sregex
     (category          . (rx-category 1 1 rx-check-category))

Footnotes: 
[1]  Iʼm only half joking




reply via email to

[Prev in Thread] Current Thread [Next in Thread]