如何定义使用`replace-string`替换特定字符串的Emacs命令 [英] How to define an Emacs command that uses `replace-string` to replace a specific string

查看:319
本文介绍了如何定义使用`replace-string`替换特定字符串的Emacs命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要删除ascii字符0253,并在其中添加回车符。在emacs中我执行

I need to remove ascii character 0253 and add a carriage return in it's place. In emacs I do

M-x replace-string ý RET C-q C-j

Cq Cj添加回车符。我经常这样做,我创建一个自定义的defun会更好。

C-q C-j adds a carriage return. I do this often enough that I creating a custom defun would be much better.

这是我到目前为止

(defun remove-253 ()
   "Removes ASCII Character 0253 and adds a carriage return in it's place"
   (interactive)
   (replace-string "ý" .... not sure what to do next )
)

你的想法?

谢谢,

规范

推荐答案

这对我有用:

(replace-string "ý" "\n")

这篇关于如何定义使用`replace-string`替换特定字符串的Emacs命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆