emacs-devel
[Top][All Lists]
Advanced

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

Re: "Raw" string literals for elisp


From: Mattias Engdegård
Subject: Re: "Raw" string literals for elisp
Date: Thu, 9 Sep 2021 15:33:44 +0200

9 sep. 2021 kl. 13.36 skrev Stefan Kangas <stefan@marxist.se>:

>> I've used both Perl's /x and Python's re.X in raw triple-quoted strings 
>> extensively, and they are nowhere as nice as rx.
> 
> Agreed.  I mostly only pointed out that it exists for completion.

Yes, sorry -- it wasn't meant as a rebuttal to what you wrote.

It's also likely that regexps in the suggested "raw" string literals would be 
inferior to what Python and Perl offer for reasons Stefan Monnier already 
mentioned. The basic string regexp syntax would need a complete change to even 
come close -- and then we have two slightly different string regexp notations.

Anna, I'm ashamed for welcoming a new friendly contributor as Mr. No. In a weak 
attempt to compensate, here are some related areas in Emacs that might benefit 
from your energy and skill:

* [Easy] There is currently no build-in way to print the string " \t\r\n" 
exactly that way -- the best we can do (setting print-escape-newlines and 
print-escape-control-characters) is " \11\15\n" which isn't as readable. 
Introduce an option to the Lisp string printer so that common control 
characters print as their special backslash sequences: \t, \r, \b, \e, maybe \a 
and \e, maybe not \v.

* Improve interactive regexp use. Maybe a user could configure a preferred 
regexp syntax (standard Emacs, PCRE, rx, etc) to be used when doing interactive 
search and replace. It would also affect how regexps are displayed and edited 
in customisation dialogues; right now, they are often difficult to read. 
Ideally a user should be able to switch syntax during entry at any time and 
have the regexp translated. Can syntax colouring (font-lock) improve regexp 
entry and display?

I'm sure other people have more suggestions (and I have some more demanding 
items should you wish for something chewy.)




reply via email to

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