[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#31953: feature request - `highlight-rx` interactively
From: |
Juri Linkov |
Subject: |
bug#31953: feature request - `highlight-rx` interactively |
Date: |
Mon, 18 Nov 2019 23:42:05 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) |
> 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
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
<return> ;; 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.