我想在Emacs中执行以下操作:将当前缓冲区保存到一个新文件,但还要保持当前文件处于打开状态。
当我执行C-x C-w时,将替换当前缓冲区,但是我想保持打开两个缓冲区的状态。是否可以在不重新打开原始文件的情况下进行操作?
最佳答案
我认为没有内置任何内容,但是编写起来很简单:
(defun my-clone-and-open-file (filename)
"Clone the current buffer writing it into FILENAME and open it"
(interactive "FClone to file: ")
(save-restriction
(widen)
(write-region (point-min) (point-max) filename nil nil nil 'confirm))
(find-file-noselect filename))
关于file - Emacs:将缓冲区写入新文件,但保持此文件打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5168262/