为所有活动缓冲区重新加载.emacs [英] Reload .emacs for all active buffers
问题描述
已经有一个问题如何重新加载 .emacs
文件更改后。
A question already has been asked how to reload a .emacs
file after changing it.
提出的解决方案是使用 Mx加载$ / code $或$ code>更改区域的Mx eval区域RET
The proposed solutions were to use M-x load-file
or M-x eval-region RET
on the changed region.
这些解决方案会影响我的其他开放缓冲区有没有办法为所有打开的缓冲区重新加载 .emacs
文件?
Neither of these solutions affect other open buffers for me. Is there a way to reload the .emacs
file for all open buffers?
我还应该注意到, code> Mx加载文件由于那个答案。
I should also note that the M-x load-file
does not have the desired effect for reasons outlined in the comments to that answer.
推荐答案
你的.emacs文件是一个全局配置,只被评估一次。它不会单独应用于每个缓冲区。
Your .emacs file is a global configuration that gets evaluated once only. It does not get applied to each buffer individually.
如何实际实现您想要的是真正取决于这些.emacs更改的内容。一些精灵只会在第一次被评估时生效;或当缓冲区改变主要模式时;或加载文件时;等等...
How you actually achieve what you want is really going to depend on what those .emacs changes are. Some elisp will only take effect the first time it is evaluated; or when a buffer changes major modes; or when a file is loaded; etc, etc...
如果要重新加载部分或全部文件缓冲区, ibuffer
很简单:
If you want to reload some or all of the file buffers, ibuffer
makes that pretty easy:
- Mx
ibuffer
RET 启动ibuffer(我建议将其绑定到 Cx Cb )。 - / f 。 RET 按文件名regexp
。
进行过滤,以匹配任何文件名 - m (在
[default]
)标记所有已过滤的缓冲区。 - V (大写)以恢复所有标记的缓冲区。
- M-x
ibuffer
RET to start ibuffer (I recommend binding this to C-xC-b). - /f.RET to filter by filename regexp
.
so as to match any filename. - m (on
[default]
) to mark all filtered buffers. - V (uppercase) to revert all marked buffers.
或者您可以替换步骤2 + 3与 Mx ibuffer-mark-by-file-name-regexp
RET 。
RET 。您可能希望将该命令绑定到 * f :
or you could replace steps 2+3 with M-x ibuffer-mark-by-file-name-regexp
RET .
RET. You may wish to bind that command to *f:
;; Bind `ibuffer-mark-by-file-name-regexp' to *f
(eval-after-load "ibuffer"
'(define-key ibuffer-mode-map (kbd "* f") 'ibuffer-mark-by-file-name-regexp))
type * ch 以查看默认绑定的所有其他 ibuffer-mark - *
命令。
type *c-h to see all the other ibuffer-mark-*
commands which are bound by default.
这篇关于为所有活动缓冲区重新加载.emacs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!