emacs - 如何 `' load-file'` 当前缓冲区的关联文件?

标签 emacs

How to 'load-file' the associated file for the current buffer?

编辑~/.emacs.d/init.el后,我想重新加载它,所以我发出命令M-x load-file

问题是,有时提示符会在远离 ~/.emacs.d 的目录中启动,例如 C:/Users/...

为什么这个起始位置会改变,以及如何快速加载当前缓冲区的关联文件?

最佳答案

如果当前选定的窗口正在显示正在访问您要加载的文件的缓冲区,那么您应该能够使用:

M-x 加载文件 RET RET

如果您没有在提示符下输入文件名,

load-file 将加载访问的文件。

请注意,您不需要删除默认值(这是一个目录路径);只需输入 RET

即使您已执行某些操作来更改缓冲区的default-directory(在这种情况下,提示符处的默认值实际上可能不是所访问文件的父目录),情况也是如此。当您只输入 RET 时,Emacs 使用 buffer-file-name 的绝对路径,使得 default-directory 变得无关紧要。

关于emacs - 如何 `' load-file'` 当前缓冲区的关联文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38845827/

相关文章:

emacs - XHTML:如何高亮匹配标签?

bash - Emacs shell 命令输出 "cannot set terminal process group"和 "no job control in this shell"

linux - 使用 elisp,如何在 emacs 终端仿真器中启动、发送 key 和停止命令?

python - Emacs:使用 pdbtrack (python.el)

emacs - elisp 变量定义。 "defvar bh/organization-task-id"这样的变量名中的斜杠有什么作用

emacs - 如何在 emacs 中为新文件设置默认行终止符?

emacs - 使用 emacs -q -l 时将钩子(Hook)添加到默认模式

emacs - Emacs 中的代码完成

emacs - 删除一个单词而不将其添加到 Emacs 中的终止环中

emacs - 更改某些面孔后如何正确对齐 Emacs 日历的布局?