Вопрос

What is the quickest way to replace multiple characters at once in emacs? For instance I would like to act on the region and replace 1 with a, 2 with b, ..., 9 with i.

Это было полезно?

Решение

You can stitch elisp into regex replacements (not sure if you can do the same with replace-string). For instance,

M-x query-replace-regexp \([1-9]\) \,(char-to-string (+ 96 \#1))

should replace single digits 1-9 with the letters a-i as appropriate.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top