2

我在 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))))

我会扩展此功能以自动将结果复制(而不是杀死)到杀死环。我怎样才能做到这一点?

4

1 回答 1

5
(kill-ring-save (point-min) (point-max))
于 2013-04-01T19:39:22.250 回答