![](/img/trans.png)
[英]How to copy a region or a whole buffer to another buffer in Emacs without affecting the kill ring?
[英]Copy result of a region operation to kill ring
我在Emacs中有以下代码,该代码删除了突出显示区域中的换行符:
(defun remove-newlines-in-region ()
"Removes all newlines in the region."
(interactive)
(save-restriction
(narrow-to-region (point) (mark))
(goto-char (point-min))
(while (search-forward "\n" nil t) (replace-match "" nil t))))
我将扩展此功能以也将结果自动复制 (而不是杀死)到kill ring。 我怎样才能做到这一点?
(kill-ring-save (point-min) (point-max))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.