GNU bug report logs - #31953
feature request - `highlight-rx` interactively

Previous Next

Package: emacs;

Reported by: Van L <van <at> scratch.space>

Date: Sun, 24 Jun 2018 07:48:02 UTC

Severity: wishlist

Full log


Message #53 received at 31953 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Van L <van <at> scratch.space>
Cc: 31953 <at> debbugs.gnu.org
Subject: Re: bug#31953: feature request - `highlight-rx` interactively
Date: Mon, 18 Nov 2019 23:42:05 +0200
> 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.




This bug report was last modified 5 years and 215 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.