From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Evan Aad Newsgroups: gmane.emacs.help Subject: Re: How to search inside a region that has just been used as the target of a replace operation? Date: Fri, 27 Jan 2023 16:35:57 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7059"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "help-gnu-emacs@gnu.org" To: Anders Munch Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 27 15:36:49 2023 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 1pLPqT-0001jK-Ip for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 27 Jan 2023 15:36:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pLPps-0006Xe-MK; Fri, 27 Jan 2023 09:36:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLPpr-0006XI-0V for help-gnu-emacs@gnu.org; Fri, 27 Jan 2023 09:36:11 -0500 Original-Received: from mail-yw1-x1130.google.com ([2607:f8b0:4864:20::1130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pLPpp-0006tj-9W for help-gnu-emacs@gnu.org; Fri, 27 Jan 2023 09:36:10 -0500 Original-Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-50e7a0f0cc8so7161547b3.2 for ; Fri, 27 Jan 2023 06:36:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=oOt+7yiN+/4kJJSGSpyPO+5YnZeD/eegpJ3ur79WGVU=; b=qpn8lqv6z+26BWSJ2ldCn0g1JIveN5fs3re2SRNaX2I5NGyokZWD1wRkASFZP2ssJB Yp0FGfMKRqfOl1ItVeLK2HoXw0ZGDeYBdThBCQOYCawE5thULJv6mrcOt043ERpzJq1R V+KKlTxTh28y+MJeRmfCukFpNgra2VNHZgmVWRnOxpE63ILRhoqAdnsn8UalGJeKp4KS CfpeqpQuEz0JJNugKGvb+4G/9zjeRQIXhjeR+TDCzVMkzBNtRu6+xJUQbQUZluF59cIH h8ayoR6BSQl8BbIDlmaski2E+hE6XIUd5adlM5pz2wGNM15eDRVzDkDhXcITd1rjqiGl ZvRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oOt+7yiN+/4kJJSGSpyPO+5YnZeD/eegpJ3ur79WGVU=; b=DwQ8FnSlbUlOdtf9DnHALmob2/OgZ4SH30p5lXU/nvexXWR1ly1jSE9h98XllOnn3e EwTjFGsEY8w6KiVsMqpvoOqjFc0Kn0xIJCVU0SXw1nNi9q+EmeUCQgIPPWP4cCKhpoxP qoPwNmqUeA38vFNfNv04XQMtQFhpVWygsM180l6OhmILHmf7ByR+HyR76MHZbhdywHmI o8Z5iBFGAnmMjnXZerd6GYRwUiCWTZG3gqI0fDJMeH5VJhqZAArdyj+AyNQF6SvLlzno qsumyFvIuSPvjd4G/EsRYh3rS75SU+BUyLyzLVBEG/5h1q1vn0wtwlvaB2ilANFC8tk+ MEjQ== X-Gm-Message-State: AFqh2kq9VK0emdwTdgGWiyMaoNWaL2b2HEc93ymyMz7bEJp1OEX/nwtl EJc/9kwQuL4TeQj8ofWJNbX3QK17tYw4h2nqYoWv3Bo5 X-Google-Smtp-Source: AMrXdXvk5tTaRww6QZzbZi1hkGRz6hSd+GuuauzxDVFZh0LqlvJdgj5Mw6Wywx25QFa3S5BerGXYjXbc5D20RnmTFL4= X-Received: by 2002:a81:5253:0:b0:501:f4d5:e3fe with SMTP id g80-20020a815253000000b00501f4d5e3femr2424122ywb.221.1674830168213; Fri, 27 Jan 2023 06:36:08 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::1130; envelope-from=oddeveneven@gmail.com; helo=mail-yw1-x1130.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142537 Archived-At: Another solution is to save the position of the point in a register prior to performing the replacement: 2.5 (Add the following between steps 2 and 3 of the scenario described in the original question:) C-x r SPC p (This saves the position of the point in the register p. Any other character can be used in lieu of 'p'.) 4. C-x C-x (This moves the point to the beginning of the region established in step no. 2. 5. C-SPC (This sets the mark at the position of the point.) 6. C-x r j p (This moves the point to the position saved in the register 'p'. The region's content is now "BcB". 7. M-x replace-string, B, b. (The buffer's content is now "AbcbD", as desired.)