How do I rename an open file in Emacs?

后端 未结 11 1850
别跟我提以往
别跟我提以往 2020-12-07 07:03

Is there a way to rename an open file in Emacs? While I\'m viewing it? Something like save-as, but the original one should go away.

11条回答
  •  孤城傲影
    2020-12-07 07:41

    Yes, with dired mode, you can:

    • C-x d to open dired
    • RET to select directory of current file
    • C-x C-j (dired-jump to the name of the current file, in Dired)
    • R to rename the file (or dired-do-rename).
    • q to go back to the (renamed) file buffer

    The rename is equivalent to a shell mv, but it will also update any open buffers, and unlike mv it will not change the access and modify times on the file in the filesystem.

提交回复
热议问题