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

时间:2013-04-01 19:24:56

标签: 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))))

我想将此功能扩展为自动复制(而不是杀死)结果到kill ring。我怎么能这样做?

1 个答案:

答案 0 :(得分:5)

(kill-ring-save (point-min) (point-max))