为所有活动缓冲区重新加载 .emacs [英] Reload .emacs for all active buffers

查看:39
本文介绍了为所有活动缓冲区重新加载 .emacs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已经有人问过一个问题如何重新加载<代码>.emacs 更改后的文件.

A question already has been asked how to reload a .emacs file after changing it.

建议的解决方案是在更改的区域上使用 M-x load-fileM-x eval-region 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?

我还应该注意到 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 更改是什么.有些elisp只会在第一次评估时生效;或者当缓冲区改变主要模式时;或加载文件时;等等等等...

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(我建议将其绑定到 CxCb).
  • /f.RET 按文件名正则表达式 . 过滤,以便匹配任何文件名.
  • 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.

或者你可以用 Mx ibuffer-mark-by-file-name-regexp RET 替换步骤 2+3. 返回.您可能希望将该命令绑定到 *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))

键入 *c-h 以查看所有其他默认绑定的 ibuffer-mark-* 命令.

type *c-h to see all the other ibuffer-mark-* commands which are bound by default.

这篇关于为所有活动缓冲区重新加载 .emacs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆