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 18:17:57 +0800 Message-ID: References: <0e97aad3-ca78-8a5a-2ecf-2e4f5205477d@easy-emacs.de> <0ece9c42fd90dd5e62ef@heytings.org> 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="30241"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Gregory Heytings Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 23 12:20:21 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 1mTLq1-0007d0-EE for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 23 Sep 2021 12:20:21 +0200 Original-Received: from localhost ([::1]:39602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTLpz-0008UV-Cp for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 23 Sep 2021 06:20:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTLnx-0008T6-GF for help-gnu-emacs@gnu.org; Thu, 23 Sep 2021 06:18:14 -0400 Original-Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]:35749) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mTLns-0002lD-VO for help-gnu-emacs@gnu.org; Thu, 23 Sep 2021 06:18:12 -0400 Original-Received: by mail-qk1-x72d.google.com with SMTP id c7so20466341qka.2 for ; Thu, 23 Sep 2021 03:18:08 -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 :cc; bh=xHg2ucv3E7SFypO4lH+bxplgh+UsRagtmfQJWBOagt0=; b=UphR/2yeKzKDkPBprZ8kmKpO51r+CTF70l0/wUW6Rr3UFSyO/ImkokTumh8cBbR+2S xFSkm6UZ9y+iK6kH/i7HwAS0+S8lc5ivdZtEjIKUYmHaO5U0Rp3BdpMXvmh+1ZCwu69M NYCGGe9pojCDXDM46kj6mHJ1kN8pmCqYLZhTXf3FRuxz8RoNV0t4HcTCdaCZZE3zNyX+ pNXEMyGDM+oIuZF4P+j+KZ1IjooGwC45LUy1VqHkgSl5OcBnPeTfol9uA5XH64mpYHOx T5dm1NQZZG++jZWfukH6zdWp4nijwQAa8bgGJdY1ycoX9xN9gCNb7tHl6gPtjaQV6NZN SBrQ== 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:cc; bh=xHg2ucv3E7SFypO4lH+bxplgh+UsRagtmfQJWBOagt0=; b=0MDA+FCI4T6tRS0DIkn6wl+YrSqSEg/BbnltRYXfQzh5ax/jm8jj7lAmTw1FPHXs7e ODQ/EOm28RdWm2FtXckJb1GCjTNxXfOzkm4PDqmjEkwGNmgWjoYWTCTcCe8nRtA6H18+ 5cSG7ea/ZhwbGspYKQHDr8ydrEyoq6aEg9AyOZZ29slhMY2VxHAEvWpAb78I3kgSL6I3 xZWoskxBXRDHEWFgHZWC2An2Dm5R2V7ZbZnS1CV7OAV5k+h1X1wnGrzoJCNJvA4wdc1w CX6MLXtDzRhBG4Yl3khUia/DNJy3vZU6Kky9rE1TrYFeO1U769AlPw6NDDugtmnIh3d5 JVyw== X-Gm-Message-State: AOAM530EdehJbjwPQ4ck9GmEwFtxyCrUcxJGIrB8FfR4cNSkF4phKi6m VWDU0m5mzCA4E2uRs1GrqEcAL8pIROnWYRu56kTcVPLRD56oCg== X-Google-Smtp-Source: ABdhPJyQSsnNWOXLFgtAnBK3DeSX07kLh2tVkkIhUZnuXF9C1I53OgKYPiTjFee/jvh/F8gg8XAQmnTH1INUu7D2hWg= X-Received: by 2002:a25:2408:: with SMTP id k8mr4616781ybk.103.1632392288122; Thu, 23 Sep 2021 03:18:08 -0700 (PDT) In-Reply-To: <0ece9c42fd90dd5e62ef@heytings.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::72d; envelope-from=hongyi.zhao@gmail.com; helo=mail-qk1-x72d.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:133178 Archived-At: On Thu, Sep 23, 2021 at 6:11 PM Gregory Heytings wrote: > > > > > > But how to increase/decrease in steps that are not equal to 1? > > > > And this is exactly the point of macros: you can easily define another > macro with the parameters you now need. E.g. if you want to multiply the > numbers by 2 you just have to change > > (insert (format "%d" (1+ (number-at-point)))) > > into > > (insert (format "%d" (* 2 (number-at-point)))) > > Of course, if this is something you regularly need, it's better to use a > defun, or to record the macro in your init file by copy-pasting the result > of M-x insert-kbd-macro. I'm not familiar with this usage, could you please give a concise example based on the question discussed here? HZ