unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* regex edit mode
@ 2014-09-30 16:55 Sam Halliday
  2014-09-30 17:55 ` Igor Sosa Mayor
  2014-09-30 19:10 ` Marcin Borkowski
  0 siblings, 2 replies; 4+ messages in thread
From: Sam Halliday @ 2014-09-30 16:55 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,

It is sometimes confusing, when writing a regex in elisp, to remember all the escaping rules that are in play.

Does anybody on this list know of a minor mode that would allow the user to edit regexes so that escaping is not necessary, but for the escaping to occur "under the hood".

Imagine being able to place the point over a string containing a regex (which is using escapes) and then call an interactive function which makes the escape characters go away and if special characters are entered, the escapes are added automagically. When exiting the minor mode, the raw string with escapes would appear again.

It would be equally fantastic to be able to do this for other languages that have their own escaping rules: java/scala come to mind.

Just a thought. It would really brighten up my day if it were possible.

Sam


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: regex edit mode
  2014-09-30 16:55 regex edit mode Sam Halliday
@ 2014-09-30 17:55 ` Igor Sosa Mayor
  2014-09-30 18:18   ` Rasmus
  2014-09-30 19:10 ` Marcin Borkowski
  1 sibling, 1 reply; 4+ messages in thread
From: Igor Sosa Mayor @ 2014-09-30 17:55 UTC (permalink / raw)
  To: help-gnu-emacs

Sam Halliday <sam.halliday@gmail.com> writes:

> Hi all,
>
> It is sometimes confusing, when writing a regex in elisp, to remember all the escaping rules that are in play.
>
> Does anybody on this list know of a minor mode that would allow the
> user to edit regexes so that escaping is not necessary, but for the
> escaping to occur "under the hood".
>
> Imagine being able to place the point over a string containing a regex
> (which is using escapes) and then call an interactive function which
> makes the escape characters go away and if special characters are
> entered, the escapes are added automagically. When exiting the minor
> mode, the raw string with escapes would appear again.
>
> It would be equally fantastic to be able to do this for other languages that have their own escaping rules: java/scala come to mind.
>
> Just a thought. It would really brighten up my day if it were possible.

not exactly what you are looking for, but... do you know this function?

,----[ C-h f regexp-builder RET ]
| regexp-builder is an alias for `re-builder' in `re-builder.el'.
| 
| (regexp-builder)
| 
| Construct a regexp interactively.
| This command makes the current buffer the "target" buffer of
| the regexp builder.  It displays a buffer named "*RE-Builder*"
| in another window, initially containing an empty regexp.
| 
| As you edit the regexp in the "*RE-Builder*" buffer, the
| matching parts of the target buffer will be highlighted.
| 
| [back]
`----


-- 
:: Igor Sosa Mayor     :: joseleopoldo1792@gmail.com ::
:: GnuPG: 0x1C1E2890   :: http://www.gnupg.org/      ::
:: jabberid: rogorido  ::                            ::




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: regex edit mode
  2014-09-30 17:55 ` Igor Sosa Mayor
@ 2014-09-30 18:18   ` Rasmus
  0 siblings, 0 replies; 4+ messages in thread
From: Rasmus @ 2014-09-30 18:18 UTC (permalink / raw)
  To: help-gnu-emacs

Igor Sosa Mayor <joseleopoldo1792@gmail.com> writes:

> Sam Halliday <sam.halliday@gmail.com> writes:
>
>> Hi all,
>>
>> It is sometimes confusing, when writing a regex in elisp, to
>> remember all the escaping rules that are in play.
>>
>> Does anybody on this list know of a minor mode that would allow the
>> user to edit regexes so that escaping is not necessary, but for the
>> escaping to occur "under the hood".
>>
>> Imagine being able to place the point over a string containing a regex
>> (which is using escapes) and then call an interactive function which
>> makes the escape characters go away and if special characters are
>> entered, the escapes are added automagically. When exiting the minor
>> mode, the raw string with escapes would appear again.
>>
>> It would be equally fantastic to be able to do this for other
>> languages that have their own escaping rules: java/scala come to
>> mind.
>>
>> Just a thought. It would really brighten up my day if it were possible.
>
> not exactly what you are looking for, but... do you know this function?
>
> ,----[ C-h f regexp-builder RET ]
> | regexp-builder is an alias for `re-builder' in `re-builder.el'.
> | 
> | (regexp-builder)
> | 
> | Construct a regexp interactively.
> | This command makes the current buffer the "target" buffer of
> | the regexp builder.  It displays a buffer named "*RE-Builder*"
> | in another window, initially containing an empty regexp.
> | 
> | As you edit the regexp in the "*RE-Builder*" buffer, the
> | matching parts of the target buffer will be highlighted.
> | 
> | [back]
> `----

There's also rx, a mini lisp-language for regexp.  Visual-regexp on
github might be able to handle external regexp languages.

—Rasmus

-- 
Er du tosset for noge' lårt!




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: regex edit mode
  2014-09-30 16:55 regex edit mode Sam Halliday
  2014-09-30 17:55 ` Igor Sosa Mayor
@ 2014-09-30 19:10 ` Marcin Borkowski
  1 sibling, 0 replies; 4+ messages in thread
From: Marcin Borkowski @ 2014-09-30 19:10 UTC (permalink / raw)
  To: help-gnu-emacs


On 2014-09-30, at 18:55, Sam Halliday wrote:

> Hi all,
>
> It is sometimes confusing, when writing a regex in elisp, to remember all the escaping rules that are in play.
>
> Does anybody on this list know of a minor mode that would allow the user to edit regexes so that escaping is not necessary, but for the escaping to occur "under the hood".
>
> Imagine being able to place the point over a string containing a regex (which is using escapes) and then call an interactive function which makes the escape characters go away and if special characters are entered, the escapes are added automagically. When exiting the minor mode, the raw string with escapes would appear again.

Not exactly what you have in mind, but do you know M-x re-builder?

> Sam

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-30 19:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-30 16:55 regex edit mode Sam Halliday
2014-09-30 17:55 ` Igor Sosa Mayor
2014-09-30 18:18   ` Rasmus
2014-09-30 19:10 ` Marcin Borkowski

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).