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:02:34 +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="6339"; 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:03:49 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 1mUf3c-0001Pr-2u for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 27 Sep 2021 03:03:49 +0200 Original-Received: from localhost ([::1]:49674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUf3a-0007yC-So for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 26 Sep 2021 21:03:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUf2j-0007uA-3t for help-gnu-emacs@gnu.org; Sun, 26 Sep 2021 21:02:53 -0400 Original-Received: from mail-oln040092074049.outbound.protection.outlook.com ([40.92.74.49]:9184 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 1mUf2V-0004Or-TG for help-gnu-emacs@gnu.org; Sun, 26 Sep 2021 21:02:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C1zQE68Z3llWjtsKTbjhra37+nWNupTYlYpjty4tSs97Khrf+HHzH/s2X0XJOGLa3Bg174Li00JYBkgUR3QCnK22mBmd+xIr/f5fzg0SqL2fyp1li/2stPboOe/J4OYUDBLWAoVEQOtAt/HAGdpwGlYPwqTq/vrak8Fofvg0wlJ9KFHQ8EO+G6J4goo+Mjd2UrSi+zR303jSgXfvvK00TYq33CrTpd3sR/klcS0rPytE8G619xbMU8BsJEPRwGbp2VOvuUckgcDPpOpO/MC91hMHfPw9r2mgFwgON/XrvuwNjSMtonXjm0BywuqU0+xp4GsZnvyi8v71EqtR/he61g== 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=0pL0ZIKokxH1UErMIqgj3AJhJc6NjX5DglPIk7+2b/4=; b=RjDvBupIKNiYxDXhDgpumz5roNO5R0LbgjsZqWSfth1wDGyzQt3a/hFmBp1+PRL7Qt677fbqUNaNK8FQgC06WrNMt+F9GIa4ttzVn17r19OxnRj8YFOW5+P5OSj73YyAUClAfkXBLbqHfauozikd58m+b4mzDr0nboDO3H/J8f6bSZNejbfoZm/ERNLAUJejkJRR7/6hNOhTOvCJhcQGvZ8MrYA9OxCZcQunrtxxjOPujPCwybCyFRaf7tdjc1juR/lOLcDayi4ZdncXQui2ln1GDPbJsbGXkRIWsYF70oTnZTWVdPkdAf3xA/Vyk15O0TlPFmqyVMWnmbpTs1IxJA== 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=0pL0ZIKokxH1UErMIqgj3AJhJc6NjX5DglPIk7+2b/4=; b=POUnelDmlhlm2suynahvpoj7XVxuZMmfYrIoePKLhUYUYZM8LyLXRQkYmZewAPeWpA7ghHKaZlMpYtSKOONbpKjz/LfZlBh1bBXlgpvNZ6ZCCOl2HyJdTdMLadZmQgBrsFJYix3iURByoDutSCqRky7u5DJOL65rVEY7T4RLQ1SiMKS+LC2V9ONwi7R2ccjtrp8qNditym2o0aGX3SMUH40Zrsl2G1035qK6iW31yHnZod4y3/MLHAbjYQ+VmloJ/5w+45Tu+YECTiOR5Mf+3I5W+PPtMQypHMy7Z0hAFq58L5ui25G3iZZcc01c0BYIUih1MkeaiUuOMvhtZGqQ4A== 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:02:36 +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:02:36 +0000 In-Reply-To: <878rzj7xt8.fsf@web.de> (Michael Heerdegen's message of "Mon, 27 Sep 2021 00:54:11 +0200") X-TMN: [+UE7rpEmhtAFEAiYCGuNaM+aPNykaBnb] X-ClientProxiedBy: OL1P279CA0069.NORP279.PROD.OUTLOOK.COM (2603:10a6:e10:15::20) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87v92mde51.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by OL1P279CA0069.NORP279.PROD.OUTLOOK.COM (2603:10a6:e10:15::20) 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:02:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5893d8cd-eae4-48cd-1ced-08d981527eb7 X-MS-TrafficTypeDiagnostic: AM9PR09MB4849: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W96Q+QcPhYwugDXeNV8ln2RUI/XktdFwquELzt/DmLf135VmDmWwwQJhDq3FnSa1k2Hcib+13B61kpQ+ebQOS6Tq/8xqhwX171qCntUdO3YZ5dePWWLm5cPEdECojrtWUjRhNpO+3E5VOytUY8Tm3AvYda5C6YDkbSsoHq34Z9ZYDNBzswiIYIILFNDSZGsyCfT+Dkltl6YpDGpQXDmFfrz4mjQkKSgnAhhNEMMrfdaBjru8v4RBAHpRk4v7cawvo+h65vM+Y9VH40IDsHYMiw4LPel9I7IYW4n9ELImpyF+0ounHcLX1NnjC1qRrtJlM3aN+InfDCUlW/QWg7rz7MMpMGBMIeZBIia3h/ovsB6MTu1JM81g6TKRgWtQiRPeiBbTxE+YkqdJdiIm1mIzYZwSNwlgodT1X9szrhqFuRg7uWQWRAGcfjxwf+XlEKQA X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zxdrdcwek0GXp6fWvJF+wmb9SxOZxqA9eG81BduKEtaZBRURFYslpCushDwn9ZPban0AWG8+UWOSkGKa0BuvvET/UboRjOcbrh8elIFDpHcYlLfRBZuqXl1aGRfwg+eCnwaGPKhqK5tqEkYqWqXC/g== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 5893d8cd-eae4-48cd-1ced-08d981527eb7 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:02:36.6600 (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.49; 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:133274 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. Oh ... sent previous before I was done, forgott I wasnn't in org-mode :-) Anyway I am sorry for the noise. I thought it would be this easy: | some | 34 | | | word | 30 | | | another | 38 | | | thing | 59 | | | to | 39 | | | say | 10 | | | here | 47 | | #+TBLFM: $3='(apply '1+ $2);N'