From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#31953: feature request - `highlight-rx` interactively Date: Mon, 18 Nov 2019 23:42:05 +0200 Message-ID: <87ftiksvyq.fsf@mail.linkov.net> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="85560"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 31953@debbugs.gnu.org To: Van L Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 18 22:53:16 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 1iWoxO-000M3I-K6 for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Nov 2019 22:53:14 +0100 Original-Received: from localhost ([::1]:39888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWoxN-0005Bw-D2 for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Nov 2019 16:53:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40338) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWoxD-0005BP-Q4 for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:53:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWoxC-0008PX-Ow for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:53:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37558) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWoxC-0008PT-LZ for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:53:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWoxC-0005Id-H1 for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2019 16:53:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Nov 2019 21:53: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.157411395720339 (code B ref 31953); Mon, 18 Nov 2019 21:53:02 +0000 Original-Received: (at 31953) by debbugs.gnu.org; 18 Nov 2019 21:52:37 +0000 Original-Received: from localhost ([127.0.0.1]:46379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWown-0005Hy-FR for submit@debbugs.gnu.org; Mon, 18 Nov 2019 16:52:37 -0500 Original-Received: from brown.elm.relay.mailchannels.net ([23.83.212.23]:41670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWowl-0005Ho-Pt for 31953@debbugs.gnu.org; Mon, 18 Nov 2019 16:52:36 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id BB3E5341340; Mon, 18 Nov 2019 21:52:34 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a6.g.dreamhost.com (100-96-196-51.trex.outbound.svc.cluster.local [100.96.196.51]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 5150D3412CC; Mon, 18 Nov 2019 21:52:34 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a6.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Mon, 18 Nov 2019 21:52:34 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Keen-Daffy: 32c8f6fa4a0886ad_1574113954565_2678861086 X-MC-Loop-Signature: 1574113954565:439362198 X-MC-Ingress-Time: 1574113954564 Original-Received: from pdx1-sub0-mail-a6.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a6.g.dreamhost.com (Postfix) with ESMTP id 00340A7010; Mon, 18 Nov 2019 13:52:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=9eoDw/yyjeN1VmoXvwkjOu9Omxw=; b= XLU0zUzTl7d7T3mH4S/z0nvfAsb5g7qsJHcUQvgsRzHsYpuNwL5kvwAUwBfAtgG7 qyhhA+Tj0nitF8OyHd3EhgzS2lodE9pT/Jm8ffPfMtqhyvMar/BGNAfQOe77juK7 VcJr7NoRnQsQmmGHCpt5PuZxQrNoYnVrFurEKXiQM1s= Original-Received: from mail.jurta.org (m91-129-102-1.cust.tele2.ee [91.129.102.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a6.g.dreamhost.com (Postfix) with ESMTPSA id 8C407A7004; Mon, 18 Nov 2019 13:52:25 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a6 In-Reply-To: (Van L.'s message of "Sun, 24 Jun 2018 17:47:31 +1000") 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:171942 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 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.