[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#31953: feature request - `highlight-rx` interactively
From: |
VanL |
Subject: |
bug#31953: feature request - `highlight-rx` interactively |
Date: |
Tue, 19 Nov 2019 23:34:53 +1100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (berkeley-unix) |
>> Towards the transition to rx from regexp
>> may I suggest `highlight-rx` for `highlight-regexp`.
>>
>> A usecase is to mark a region or string of few words
>> and to call `highlight-rx` which does a verbatim highlight.
>
> Nothing stops you from using rx in regexp commands already.
>
> The first example shows how to use rx to find all Lisp comments:
>
> M-s o ;; occur
> M-: ;; eval-expression, then type or yank the following rx:
> (insert (rx bol (* whitespace) ";" (* nonl)))
> <return> ;; exit-minibuffer inserts the converted regexp to the minibuffer
> <return> ;; exit-minibuffer uses this regexp
>
Ah, got it.
> The second example shows how to use rx to remove all Lisp comments:
>
> C-M-% ;; query-replace-regexp
> M-: ;; eval-expression
> M-p ;; previous-history-element inserts the previous rx from history
> <return> ;; exit-minibuffer inserts the converted regexp to the minibuffer
> <return> ;; exit-minibuffer uses an empty string as replacement
< ! ;; exit-minibuffer replaces all comments with empty string
>
> in 'emacs -Q' with (setq enable-recursive-minibuffers t)
> The same can be used for 'highlight-regexp' as well.
Thanks for the examples.