Search code examples
emacselisp

replace-char in Emacs Lisp ?


Emacs Lisp has replace-string but has no replace-char. I want to replace "typographic" curly quotes (Emacs code for this character is hexadecimal 53979) with regular ASCII quotes, and I can do so with:

(replace-string (make-string 1 ?\x53979) "'")

I think it would be better with replace-char.

What is the best way to do this?


Solution

  • Why not just use

    (replace-string "\x53979" "'")
    

    or

    (while (search-forward "\x53979" nil t)
        (replace-match "'" nil t))
    

    as recommended in the documentation for replace-string?