复制区域操作的结果以杀死响铃

Ame*_*ina 2 emacs

我在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))))
Run Code Online (Sandbox Code Playgroud)

我想扩展这个功能,以自动复制(而不是杀死)结果到杀死环.我怎样才能做到这一点?

phi*_*ils 5

(kill-ring-save (point-min) (point-max))
Run Code Online (Sandbox Code Playgroud)