unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: uzibalqa <uzibalqa@proton.me>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: Apply replacement on word occurring at point using a lisp function
Date: Fri, 12 Aug 2022 23:37:56 +0300	[thread overview]
Message-ID: <Yva6JBCuMtwSvFZ+@protected.localdomain> (raw)
In-Reply-To: <olWTCEGliuV02Z-GcXqpgy4J6XtvWWj9F6dCwwNsBWqupud8x3QTpSE0_u0HzMt3g0Yk2JYHa4Lu-19qxwBi4Hjufa9A7-a3yfmXu6L-9-w=@proton.me>

* uzibalqa <uzibalqa@proton.me> [2022-08-12 23:29]:
> This is what I want to do
> 
> "cognize" changed to "knize"
> "collect" to "klect"
> "corrupt" to "krupt"
> "cumulatively" to "kulatively"

How I read it, you wish to change some words, I understand above statement.

> Meaning that the initial matches of words as defined in regex are
> replaced with the letter `k'.

The last above statement is contradictory to your explanation above.

If there are just few words, then you could use this:

(defun my-get-them ()
  (let* ((point (point)))
    (goto-char 1)
    (replace-regexp "cognize" "knize")
    (replace-regexp "collect" "klect")
    (replace-regexp "corrupt" "krup")
    (replace-regexp "cumulatively" "kulatively")
    (goto-char point)))

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



  reply	other threads:[~2022-08-12 20:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12 19:48 Apply replacement on word occurring at point using a lisp function uzibalqa via Users list for the GNU Emacs text editor
2022-08-12 20:24 ` Jean Louis
2022-08-12 20:28   ` uzibalqa
2022-08-12 20:37     ` Jean Louis [this message]
2022-08-12 20:59       ` uzibalqa
2022-08-13 10:24         ` Jean Louis
2022-08-13 14:17           ` uzibalqa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yva6JBCuMtwSvFZ+@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    --cc=uzibalqa@proton.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).