From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: Select/highlight and *copy* matches of some regex Date: Tue, 28 Jun 2022 06:42:37 +0200 Message-ID: References: <82a978f3-e974-4d8f-b87e-5707ffec0b5b@www.fastmail.com> <87pmitvn8x.fsf@rub.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aaIAUqsByfaSdSzM" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20924"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 28 08:27:35 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o64hD-0005HM-Ib for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 28 Jun 2022 08:27:35 +0200 Original-Received: from localhost ([::1]:50994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o64hC-0002fJ-AT for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 28 Jun 2022 02:27:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o633j-0007fw-KF for help-gnu-emacs@gnu.org; Tue, 28 Jun 2022 00:42:43 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:37260) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o633h-0006p7-6E for help-gnu-emacs@gnu.org; Tue, 28 Jun 2022 00:42:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:To:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=tDlYcIrsWFA/adzEvqAnFkHrjkT4OPUreuOBE4D5iHc=; b=jdN4kZ8q/XID9LmyabFxUhy7ts k/aqTz7yG6fIW9kFQDD8kD8PRDZ1kmwxmvG7CgK4QpJHe980e5sH1U91lgscNf+yW2NiMiX2pG6qp P6OvC71rPj+j5gdGH0u06jNwA3X/Fy48FAM7Z/fmlkfmY6WKJ+IPWNjLoYZUgpdKWgtQUhY4hADXj WZx/plmYLSdcae1GiDs6pQLtTcHnOmz11wVia2ikuUlmGJNssYtH01kXhSbWV99FCALv4v/NcdkYr 9DKUg4e697OH6CZ8dzxcu45YmSwyNqkS+M5RwfKUi2u2hOurl/9ta6wqwdm/WHihVAGaPmU1t50fq ZcWQh7pA==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1o633d-0006so-5X for help-gnu-emacs@gnu.org; Tue, 28 Jun 2022 06:42:37 +0200 Content-Disposition: inline In-Reply-To: <87pmitvn8x.fsf@rub.de> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:138148 Archived-At: --aaIAUqsByfaSdSzM Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 27, 2022 at 10:56:46PM +0200, Stephen Berman wrote: > On Mon, 27 Jun 2022 17:52:48 +0200 Joost wrote: >=20 > > Hi all, > > > > I've been looking for at least an hour for something that my Sublime-us= ing > > colleagues seem to be able to do out of the box... Highlight all matche= s of > > some regex in the current buffer and then copy/kill *all* of those matc= hes so > > that you can yank them in a new buffer. > > > > The first part, highlighting all matches, is not a problem. But I haven= 't > > found a way yet to then extract all matches. >=20 > Is this (suitably tweaked) good enough? >=20 > (let ((matches "")) > (while (re-search-forward "lang=3D.." nil t) > (setq matches (concat matches (match-string 0) "\n"))) > (kill-new matches)) Nifty :) You'll end up with one big string of all concatenated matches. But it's a start. Cheers --=20 t --aaIAUqsByfaSdSzM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCYrqGtwAKCRAFyCz1etHa RhAuAKCAlzsxQtegFmbN/iW5H7/lCoxRwACfcLLFpciE6kk0eNEUDHnQX9HHvms= =ExpG -----END PGP SIGNATURE----- --aaIAUqsByfaSdSzM--