我在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。我怎么能这样做?
答案 0 :(得分:5)
(kill-ring-save (point-min) (point-max))