From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: VanL Newsgroups: gmane.emacs.bugs Subject: bug#31953: feature request - `highlight-rx` interactively Date: Tue, 19 Nov 2019 23:34:53 +1100 Message-ID: References: <87ftiksvyq.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="16152"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (berkeley-unix) Cc: 31953@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Nov 19 13:36:12 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iX2jr-00044V-93 for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Nov 2019 13:36:11 +0100 Original-Received: from localhost ([::1]:44730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iX2jq-0003RA-0p for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Nov 2019 07:36:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56835) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iX2jj-0003PB-Dk for bug-gnu-emacs@gnu.org; Tue, 19 Nov 2019 07:36:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iX2ji-0000u6-C3 for bug-gnu-emacs@gnu.org; Tue, 19 Nov 2019 07:36:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37909) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iX2ji-0000tz-8X for bug-gnu-emacs@gnu.org; Tue, 19 Nov 2019 07:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iX2ji-0007Mu-3F for bug-gnu-emacs@gnu.org; Tue, 19 Nov 2019 07:36:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: VanL Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Nov 2019 12:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31953 X-GNU-PR-Package: emacs Original-Received: via spool by 31953-submit@debbugs.gnu.org id=B31953.157416691628271 (code B ref 31953); Tue, 19 Nov 2019 12:36:02 +0000 Original-Received: (at 31953) by debbugs.gnu.org; 19 Nov 2019 12:35:16 +0000 Original-Received: from localhost ([127.0.0.1]:46730 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iX2iy-0007Lv-DK for submit@debbugs.gnu.org; Tue, 19 Nov 2019 07:35:16 -0500 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:35089) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iX2iu-0007Lh-IC for 31953@debbugs.gnu.org; Tue, 19 Nov 2019 07:35:13 -0500 X-Originating-IP: 193.119.97.187 Original-Received: from vogel.localnet (193-119-97-187.tpgi.com.au [193.119.97.187]) (Authenticated sender: van@scratch.space) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 1E0A0C001C; Tue, 19 Nov 2019 12:35:08 +0000 (UTC) In-Reply-To: <87ftiksvyq.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 18 Nov 2019 23:42:05 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:171969 Archived-At: >> 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))) > ;; exit-minibuffer inserts the converted regexp to the minibuffer > ;; 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 > ;; exit-minibuffer inserts the converted regexp to the minibuffer > ;; 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.