简体   繁体   English

emacs如何编译文件并编辑?

[英]How does emacs compile the file and edit it?

There is this feature in emacs. emacs 中有此功能。 Whenever you compile your code (filename: hello.cpp ) run the program and then you edit your code then emcas will store you previous unedited code in another file named hello.cpp~ .每当你编译你的代码(文件名: hello.cpp )运行程序然后你编辑你的代码时,emcas 会将你以前未编辑的代码存储在另一个名为hello.cpp~的文件中。 hello.cpp~ will always contain first code you compile and whenever you write you edit your code in emacs it will produce file name .#hello.cpp . hello.cpp~将始终包含您编译的第一个代码,每当您编写代码时,您都会在 emacs 中编辑您的代码,它将生成文件名.#hello.cpp It automatically remove .#hello.cpp when you save that code but hello.cpp~ will remain same.当您保存该代码时,它会自动删除.#hello.cpp但 hello.cpp~ 将保持不变。 .#hello.cpp file contain info. .#hello.cpp文件包含信息。 such as username@DESKTOP-FN20BRU.13000:1597860074.例如用户名@DESKTOP-FN20BRU.13000:1597860074。 So anybody can please explain me this working process of emacs?所以有人能解释一下emacs的这个工作过程吗?

Emacs does the following when you edit a file filename Emacs 在编辑文件文件名时执行以下操作

  • # : when you modify the file (in memory), Emacs creates a # file (on disk) and keeps updating it with your changes, until you save the edited version. # :当您修改文件(在内存中)时,Emacs 会创建一个#文件(在磁盘上)并根据您的更改不断更新它,直到您保存编辑的版本。 This draft, on disk, can be recovered in case Emacs or the computer crash before you had time to save your changes.如果 Emacs 或计算机在您有时间保存更改之前崩溃,则可以在磁盘上恢复此草稿。

  • ~ : as soon as you save the edited version, Emacs renames first your old version on disk (the one when you opened Emacs) adding a trailing ~ to the filename giving filename~ (it does this only the first time you save within the current session), then it overwrites filename with the modified version, and finally removes the # draft on disk. ~ :一旦你保存编辑的版本,Emacs 首先重命名磁盘上的旧版本(打开 Emacs 时的那个),在文件名后面添加一个~给出文件名~ (它只在你第一次保存当前文件时这样做session),然后它用修改后的版本覆盖文件名,最后删除磁盘上的#

Then, when you make further changes, another # file is created, etc.然后,当您进行进一步更改时,会创建另一个#文件,依此类推。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM