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: Jean Louis
Subject: Re: Apply replacement on word occurring at point using a lisp function
Date: Fri, 12 Aug 2022 23:37:56 +0300
User-agent: Mutt/+ () (2022-06-11)

* 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 via email to

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