From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.help Subject: Re: Emacs: adding 1 to every number made of 2 digits inside a marked region. Date: Mon, 27 Sep 2021 12:59:26 +0200 Message-ID: References: <878rzj7xt8.fsf@web.de> <87o88esthh.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29521"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 27 13:00:55 2021 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 1mUoNS-0007UB-2y for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 27 Sep 2021 13:00:55 +0200 Original-Received: from localhost ([::1]:34784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUoNQ-0003s4-Gq for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 27 Sep 2021 07:00:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUoMI-0003rr-NS for help-gnu-emacs@gnu.org; Mon, 27 Sep 2021 06:59:43 -0400 Original-Received: from mail-oln040092073016.outbound.protection.outlook.com ([40.92.73.16]:32422 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUoM7-0008Ib-80 for help-gnu-emacs@gnu.org; Mon, 27 Sep 2021 06:59:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rhlcvce21o5R7u3BYNuM0wndipUd/iWuAf4pa/XEwJE+YxoTqtnJBczGposVh2rT6QFLwgQvlQ8/sjqZVFhvp74NH/iuxceiZrr63ccAvpE2daqECI+lIMC2yVH95zeEunVKqIAsiqJqgKKF4lEvchHGztAaXZpNthBBZNUCk+asvk/M2WkwcRh6uphXhyiqWcA6sDcKJh0p76g757gvg/LPvlFIZdt16i6d5DOpSvXm7aLbeJOrULm0f06pOaBkqFQTSGiFunJjBaXtXJqiTlDelB2QU6r8bXydWlohwyYtvfFWvcR7gLRyEMfZ9vnW1r2fmnNQKLiq/WOuGvU1GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Fpa97AZArf3rCOOHWEuxNyV4FqQKUch8Suf7/2e7+jo=; b=ZCLJMHhwDEDZLj7RxEiPh6TgMTvWRWWDCsrZ/V9euLz5utOM8J5bv69Wg4P/ir1QKHzVF7AOEHIAKihWDy/b4CT9yXjzWrbhywEax8c5mqjMJYp4r66uCDre/DX9bZpZXI+eQLgJ3CmP7ZQerl26wTBquxlRJgEA4fL5FTt3lMue5saYs/x9jiiTvIGpen9rOiieVv0fwFZCrw81zw9kasX63/dGfqDtPxmbIo2vRjfbYsEuJFKE1P56DGNS3Z9e//bz3kvqHqTQWKNgW+iyt+DSssRqYURTxRj2z2QxnjX6PWhMuLNkiKHcna4DDvrQ00KTTJk4USCtBEfUlX93RQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fpa97AZArf3rCOOHWEuxNyV4FqQKUch8Suf7/2e7+jo=; b=axob0cOlLbXi23XmoSV0WRk6KQlv7NPMX8cOct+OJvCG8p/Wlp5jHTPTGXohpBFNtXYNVbrDTD1LA+CGVRISFXiQMGlgdxB14IHW0xhOgMlAqR62MDWnmDsjxCT65D01fFd7+GQUlEpDy0cF7+fxAQhlZecCBzsoXrEakOCnHhYPlaHI2P/CgsObWRL6vfePkCXbgF1qnkOhPrs5Ble9cxedurFTrX7D7EWCfsVppqtPSpxup9x577COxVrzJ441HtXPB6nG7m9JhDxMn1Nc7f8HH1+ggQfjqUXh0uEFOr2jiNPKEle4iCuCAq9p6BxckQkAi9dVDvmJyCOnvakJBA== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM0PR09MB3921.eurprd09.prod.outlook.com (2603:10a6:208:1a1::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.15; Mon, 27 Sep 2021 10:59:28 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc%9]) with mapi id 15.20.4544.021; Mon, 27 Sep 2021 10:59:28 +0000 In-Reply-To: <87o88esthh.fsf@zoho.eu> (Emanuel Berg via Users list for the's message of "Mon, 27 Sep 2021 03:22:02 +0200") X-TMN: [In4FMKEhGW3dM9b634QYbi0MEhVJ6YFY] X-ClientProxiedBy: HE1P192CA0006.EURP192.PROD.OUTLOOK.COM (2603:10a6:3:fe::16) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87fstqnv1t.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by HE1P192CA0006.EURP192.PROD.OUTLOOK.COM (2603:10a6:3:fe::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Mon, 27 Sep 2021 10:59:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc503a00-2add-4ea8-d970-08d981a5e041 X-MS-TrafficTypeDiagnostic: AM0PR09MB3921: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AKS9yQfxPBoco0RQdxfKcF66bi1pB7pLUoMYsDIEgPuVor29pVn/TaNm0Oc7fjRjB7rrWQT2+pk1GbmzCsFys3+rPR/cvLtmHjSXeqRfI6agPNdZY/xFFC/j2Oaft7re36dT1Op2nuaDlRH/qjJxfgBcSB1uOWfOnrPI+nNhdCddFuUqqHcDOOs3GOa+NIrldPcaGU9+MHx+PiYX/+UlCKS3cC43f6mE+26U12OmvIDrS2Oc/48XM/TRfnScS5nNTy7aiZaT+7B0mp0DOC/zZmvKCiR9YILrzD0EtbY/716nI1xo94QGY8n+EImsIAysKeOYVa8wkWFN7nPX9LMRAGC2FP1qqMa2JAWmpX7C/1HxDx77SjMGZtt8Y2QkUcbzM+CfqjlhqOxz5L4OGNi8kPYct9SpHHE5w7dLVToaDfxb98WMN+WXIvy2AbYGYCPO X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T0Cs1qqTnf4EGf8jQ3YT35zlDYRss7T+F8oyGwklaIDMb4b4WtiCG6DCQPICSbyM+8o8o4QeHPB+M/AClBB5yCq2Av8OgeME5fvXOKiIUnxTXFsgmh1SoKmdyZUcUJtpqEQSYwPeB6+7kxoIDO/YLg== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: cc503a00-2add-4ea8-d970-08d981a5e041 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2021 10:59:28.6035 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR09MB3921 Received-SPF: pass client-ip=40.92.73.16; envelope-from=arthur.miller@live.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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.23 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:133290 Archived-At: Emanuel Berg via Users list for the GNU Emacs text editor writes: > Arthur Miller wrote: > >> | some | 34 | | >> | word | 30 | | >> | another | 38 | | >> | thing | 59 | | >> | to | 39 | | >> | say | 10 | | >> | here | 47 | | > > Her you go: > > (defun inc-all (&optional beg end) > (interactive (when (use-region-p) > (list (region-beginning) (region-end)) )) > (let ((bg (or beg (point-min))) > (ed (or end (point-max))) ) > (save-mark-and-excursion > (goto-char bg) > (while (re-search-forward "[[:digit:]]\\{2\\}" ed t) > (replace-match > (format "%d" (1+ (string-to-number (match-string 0)))) ))))) Ah no, not really; you are parsing region, that is not what I wanted there. There is org api to do this.