help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apply replacement on word occurring at point using a lisp function


From: uzibalqa
Subject: Re: Apply replacement on word occurring at point using a lisp function
Date: Fri, 12 Aug 2022 20:59:28 +0000

------- Original Message -------
On Friday, August 12th, 2022 at 8:37 PM, Jean Louis <bugs@gnu.support> wrote:


> * 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, I have written the words as examples.  But really wanted a general scheme 
for
replacements based on specified rules (e.g. initial matches of cog changed to 
k),
rather than using actual words.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]