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 03:03:16 +0200 Message-ID: References: <878rzj7xt8.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7617"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: help-gnu-emacs , Hongyi Zhao To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 27 03:04:08 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 1mUf3v-0001pL-F6 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 27 Sep 2021 03:04:08 +0200 Original-Received: from localhost ([::1]:50380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUf3t-00005U-Ul for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 26 Sep 2021 21:04:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUf3M-0008U3-DF for help-gnu-emacs@gnu.org; Sun, 26 Sep 2021 21:03:32 -0400 Original-Received: from mail-oln040092074047.outbound.protection.outlook.com ([40.92.74.47]:5289 helo=EUR04-DB3-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 1mUf3B-00055Q-FX for help-gnu-emacs@gnu.org; Sun, 26 Sep 2021 21:03:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DdQtFAh8SrreLwH+R5ELwN2YvqaIWtzpZO6Rs3Muecj+jcmiove/gHeEwqwxuiHOJaezndY/NssJSpJnNxQoEYjmvAZjVhFGdAviK5XbNLD8FG+cGjXJ0ihkiUR1Hjfz7sDsiaAAl048jaiS+C1hlQaKtSeY61dOA8PE41xdmKOy0UbXZnqZqlunQTEAJ9TmDEHOiqXEzeBM+zxdySYHCS1piFyahCYdz4Pr4cEPYS8qaS5vqhLIMx6TyxbnyxobiU60jyeIPB7HGtRj5z38k2XoR/9mngO8AuTtqtkNFWa2Rcy0D21yhvAL6BE48RViH4l/RBLFOlOeInU8X2aubA== 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=lprjkfSO9ZkEg3poj2MmfkFOcdBrZMi8VLzqMoqsrMY=; b=Qu4u31FsOtuZk9MhILBLt2+B97Ymebg8FGsTXNiZCi1q22ATEfCuy5e78Y279dx1v7vWJBGJTl0kUVm+L8s1XZHm3fcpZSTbEYmr0hEIAcmMqycHfo4t4kkfQr+9WAPneKKVConG/sH5dITig+ZbNxix/co6obPLsSeklNGfClVB4wMpW/zspYGWcjcLXQWd00zszB0HdIQMZiSybTpRjdmdUhA5obD7uHOPNjwTfabHY13DU3tsGB1sHrcHyM+lTQdw8KI0XCLaBt2NZCcuqvwsylLH0oTQ/fE6E851+6Bc2UYoDZnyotdNKdL1nv7bPADmASKOEUdQ8BTxFmwoaA== 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=lprjkfSO9ZkEg3poj2MmfkFOcdBrZMi8VLzqMoqsrMY=; b=cASdPpc4eff02G9GHdcKOFcQRfHrMf7Pbip5ZxM4aEm2YoDcIRusqrXE9P0iPZEU+UIa9ZPVQyQtJExtL/oOPqGECRJbOgI5Pxpj0f/V9c1AapiVjON49MP3Blf0LFyrN+NZ5neLoVbWFrQUtgvOMujUeAYQ9SaZPNnG2oGzH7AeJtM3/RzYZqQt1L6kgKKAYaOgE1OBK/zErR8yaXCwPDAyfC1gOl0OlPiEEQ0iYSCPEwOyId6Q1k7AmWU3B1QlyJTApJUMWw4EaqEIRjwTJqC+7FByna9Wfn7ZjFdF6y3Dtu3zCBkX/KJfa+73dMRjHwOOd1BzkxjT4S2kNpRBQA== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM9PR09MB4849.eurprd09.prod.outlook.com (2603:10a6:20b:2d7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14; Mon, 27 Sep 2021 01:03:18 +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 01:03:18 +0000 In-Reply-To: <878rzj7xt8.fsf@web.de> (Michael Heerdegen's message of "Mon, 27 Sep 2021 00:54:11 +0200") X-TMN: [5zlEEo0XiuuQc79VUOxdiMFicKnkCYNm] X-ClientProxiedBy: HE1P190CA0012.EURP190.PROD.OUTLOOK.COM (2603:10a6:3:bc::22) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87r1dade3v.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by HE1P190CA0012.EURP190.PROD.OUTLOOK.COM (2603:10a6:3:bc::22) 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 01:03:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dcade6ff-dc5a-44cb-995c-08d981529794 X-MS-TrafficTypeDiagnostic: AM9PR09MB4849: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PX3QrgMurznRUh6HAdj6Ed4+M6DYwHZfiq5m0FiBp8td55I7lJZ6SOX73sioV9ePc7aY2s0LoAU1sQwNLesJxZmEaZbL+efLFec16jPPeNGtQlpolmIZlyDRdAwCyhps9csSzjllgFyEfgJTKbVxRvkN9qqyrYAlM1oQa5oi29Czso3W/0uXevLpYw+7Rl4x9eTxm5c6pBHf5/BRQGU3sa3ngcRkwnx3PN+fsfHPNzTwoEOVQ+uKm7QwO8GBFmtM2OGM7DgwOrSEyJkeLViCyCd0KG0adBdF4QPcDmvzhb27EerySFvdLG6qajtlqngnhTRYvv2TOZfs/w4v7uSwkzwfj2PBURifhRU55DtFZE0qgmUJzGe8dT2b8wl6VebAege1Z9k1ifEx7vqW78uDANkCG8BtRSMiIqqMkjgmvc+6mwbSTOeeD1Yni8ahSEXb X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zerDueI/Fa4bJmmipPatG/1mScwjSmM+9jJku5aL+rW0uFjt2K36vaiUfx+tTk+UVrqgv/Hfzr52dfwyYAsIj+oAqE98H+AAaJ4I2SjG8DJ5m+SHzK9pCneZWjpk/LPz0kDYXvSo6oasQt221HlAIA== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: dcade6ff-dc5a-44cb-995c-08d981529794 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2021 01:03:18.4236 (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: AM9PR09MB4849 Received-SPF: pass client-ip=40.92.74.47; envelope-from=arthur.miller@live.com; helo=EUR04-DB3-obe.outbound.protection.outlook.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, 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:133275 Archived-At: Michael Heerdegen writes: > Hongyi Zhao writes: > >> Imagine I've got the following in a text file opened under Emacs: >> >> some 34 >> word 30 >> another 38 >> thing 59 >> to 39 >> say 10 >> here 47 >> >> and I want to turn into this, adding 1 to every number made of 2 digits: >> >> some 35 >> word 31 >> another 39 >> thing 60 >> to 40 >> say 11 >> here 48 > > You might want to give Calc a try for such things. It doesn't perfectly > handle the editing part though since it doesn't know about rectangle > commands (AFAICT - at least for insertion). > > So here is how I would do it: > > - mark the rectangular region spanning the numbers > - `C-x * r': this will grab the number column as a matrix and pop up > Calc > - `1 RET +': will add 1 to all entries > > You now have the result as a matrix. What you have to do now manually > using conventional rectangle commands is to kill the original numbers > from the buffer (they are already marked, so `C-x r k'), and then kill > and yank the numbers as rectangle from the Calc buffer. > > Calc also allows to add numbers in a row or column in any buffer in a > similarly easy way. The Calc tutorial has some examples doing such > things. > > Michael. And I was of course wrong :-) And sent mail again by misstake ... :-) Time for the sleep