From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: Emacs: adding 1 to every number made of 2 digits inside a marked region. Date: Thu, 23 Sep 2021 16:02:22 +0800 Message-ID: References: <878rzol51e.fsf@zoho.eu> 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="29085"; mail-complaints-to="usenet@ciao.gmane.io" To: Emanuel Berg , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 23 10:03:09 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 1mTJhF-0007PS-JW for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 23 Sep 2021 10:03:09 +0200 Original-Received: from localhost ([::1]:33720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTJhE-00055j-J9 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 23 Sep 2021 04:03:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTJgl-00055L-3z for help-gnu-emacs@gnu.org; Thu, 23 Sep 2021 04:02:39 -0400 Original-Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]:37388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mTJgi-0005Dp-1b for help-gnu-emacs@gnu.org; Thu, 23 Sep 2021 04:02:38 -0400 Original-Received: by mail-lf1-x12f.google.com with SMTP id i4so23189155lfv.4 for ; Thu, 23 Sep 2021 01:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=BS4IVMncoXpdxpRHTxbnS8TlS6VsC+aX7PtaKy4az34=; b=EE1QWylVd7WKot+R8QBcUtHOvrLfUbNcIugbQ4eUriLmkvLbZi+sCpeGvvizy9G+xs Q1slxqgeeNDgWZggpzZUrkJnNg1bj6K4MoYHfSFFu+QCzTzJTLFFS29UMP7G9+hjfkVl gbLqXAh1vuou68NQryMTtnVw0nMyA/5hDRiIDbMKdCUlfsnwfIqXcsKKDDqeLdMpISJo 2U3yTJ7oqGYJbcFroQP79FA6pU1QExDoG0t8MnUdt9Da/y/dxTwEzdSTSvZ4z0JGxrAw 65vLatHkjTh/3uHRimKv09CO88WAxXN0JGC7uFTFsY3io50H7vFyicaF4S250s22yTjv aqyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=BS4IVMncoXpdxpRHTxbnS8TlS6VsC+aX7PtaKy4az34=; b=tQ0UV2vZEMzE+duRdz28/w/N92G0X/2N+Q58KutdLE31wOMOKQDScJ/AH1t5e/+41q jw0wxmCKAmkGmlO1o8nTwvVq3kvD5ikBbszJVWwe3e9yD5mM/SLTgTVou4uz4LKR4OdJ mi4E8rI8Om7erMa/oLK/wZWkt5ZqAMWcAi3QBhDOKP4W81SBa8s/WvwOCtgFlzPwisak JqaIwU31qVMr/6fYglb4YE7Rm8vMwY+lcmd/Bn7dnj+g1mT766GJZJTlKzdPnaR0z6r4 mPYZLJhoBWAR/0WyDSk4C9T8Lcgzu+C+5sB6v1k6meStIqkXvrhRqGbdTfteVKmYHTz3 EK0g== X-Gm-Message-State: AOAM531dRtFkCRVpIUuBhlqwg5c8UWF88J+cZ1EtfEsQzCpqBExDBMG6 3MNJTJSiHah8x9I2hGqPfpk8iVezzTOujMcuWJo= X-Google-Smtp-Source: ABdhPJxU7fAOoQn4s5QtIel5ioZh1e11Rt8Ut23pVyn5NB5cXq51NVZXmnZ6CcJ8rMYpojo70WtiQDg2mWRpajxgqhY= X-Received: by 2002:a2e:8603:: with SMTP id a3mr3780184lji.142.1632384153653; Thu, 23 Sep 2021 01:02:33 -0700 (PDT) In-Reply-To: <878rzol51e.fsf@zoho.eu> Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=hongyi.zhao@gmail.com; helo=mail-lf1-x12f.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.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:133166 Archived-At: On Thu, Sep 23, 2021 at 4:38 AM Emanuel Berg via Users list for the GNU Emacs text editor wrote: > > Hongyi Zhao wrote: > > > Today, I stumbled on this interesting discussion [...] > > > > 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 [...] > > When I was still classified as a human being What do you mean by saying this? > I did something > similar and thanks to Emacs and that professional approach to > preparation that mini-expedition was concluded in > a semi-successful state since there were several survivors. > > Here is the URL to the file but I also yank it last: > > https://dataswamp.org/~incal/TENT > > tent 2515 > sleeping bag 1215 > sleeping pad 880 > Trangia 619 > comic book 580 > pillow 450 > science book 411 > drybag 305 > thermos 270 > powerbank 8000mAh 245 > water bottle 115 > toothpaste 110 > piece of cloth (big) 100 > knife 90 > sticky tape 90 > deodorant 75 > flashlight (3AAA) 73 > piece of cloth (small) 60 > flashlight (USB) 55 > vaseline 50 > toothbrush 15 > skin lotion 13 > comb 11 > spoon/fork 9 > pill case 9 > ------------------------------ > 8365g > > (defun digits-sum () > (interactive) > (save-excursion > (goto-char (point-min)) > (let ((sum 0)) > (while (forward-word) > (let ((number (number-at-point))) > (when number > (cl-incf sum number) ))) > (message "%s" sum) ))) > (defalias 'di #'digits-sum) > > ------------------------------------------------------------------------------- > > https://dataswamp.org/~incal/TENT > > -- > underground experts united > https://dataswamp.org/~incal