如何找到已加载的 .emacs 文件?
如何让 emacs 告诉我它已加载的 .emacs 文件的位置?
我的情况很简单,当我执行 sudo emacs 时,它会加载一个与我的主目录中的文件非常不同的 .emacs 文件。 我可以通过在我自己的 .emacs 文件上执行 Mx eval-buffer
来解决这个问题,但这是很多额外的步骤,而且它似乎并没有清除任何 .emacs 文件中的愚蠢绑定已加载。 如果有的话,我只是想找到 .emacs 文件并删除一些陌生人绑定(cn、cp、ca 都反弹到奇怪的东西)
我的主要问题仍然是,如何让 emacs 告诉我的位置它已加载的 .emacs 文件?
How do I get emacs to tell me the location of the .emacs file it has loaded?
My situation is simply when I do sudo emacs
, it loads up a very different .emacs file than the one in my home directory. I can get around with by doing M-x eval-buffer
on my own .emacs file, but that's a lot of extra steps, plus it doesnt seem to clear out the goofy binds in whatever .emacs file is being loaded. If anything, I'd simply like to find the .emacs file and remove some of the stranger binds (c-n, c-p, c-a all rebound to strange stuff)
My main question is still, how do I get emacs to tell me the location of the .emacs file it has loaded?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用的是 Linux,您可以尝试此操作来查看 emacs 在启动时打开了哪些文件。
If you are on Linux, you could try this to see what files are opened by emacs when it launches.
使用的初始化文件存储在变量“user-init-file”中。 要查看此使用“describe-variable”(第 v 章),请输入“user-init-file”,它将显示所使用的文件。
The init file used is stored in the variable 'user-init-file'. To see this use 'describe-variable' (C-h v), type in 'user-init-file' and it will display the file used.
您可以尝试通过以下方式查看找到的文件:
~
被转换为HOME
环境变量的值。 Emacs 查找.emacs
,然后查找.emacs.elc
(字节编译版本),然后查找.emacs.el
,然后查找~ /.emacs.d/init.elc
和~/.emacs.d/init.el
。 此文档显示了替代方案。 它还取决于环境变量LOGNAME
和USER
。您还可以检查
*Messages*
缓冲区的内容 - 尽管您应该设置(setq message-log-max t)
(如果可以的话)以确保所有消息被保留。 在该缓冲区内有一些看起来像这样的行:这将显示加载了哪些文件。
您还应该查看 Find-Init文档显示了更多可以加载的文件,例如
site-start.el
,以及终端特定的初始化(对我来说是新的)。You could try to see what file is found by:
~
gets translated to the value of theHOME
environment variable. Emacs looks for.emacs
, then.emacs.elc
(the byte compiled version), then.emacs.el
, then~/.emacs.d/init.elc
and~/.emacs.d/init.el
. This documentation shows the alternatives. It also depends on the environment variablsLOGNAME
andUSER
.You can also check out the contents of the
*Messages*
buffer - though you should set(setq message-log-max t)
(if you can) to ensure that all the Messages are kept. Inside that buffer there are lines that look like:which will show what files were loaded.
You should also check out the Find-Init documentation that shows even more files that can be loaded like the
site-start.el
, and terminal specific initialization (new to me).