【问题标题】:Emacs buffer undo limitEmacs 缓冲区撤消限制
【发布时间】:2013-05-19 22:18:32
【问题描述】:

当我将大量打印到标准输出时,我在 matlab-shell 缓冲区中收到此警告:

Warning (undo): Buffer `*MATLAB*' undo info was 12268000 bytes long.
The undo info was discarded because it exceeded `undo-outer-limit'.

This is normal if you executed a command that made a huge change
to the buffer.  In that case, to prevent similar problems in the
future, set `undo-outer-limit' to a value that is large enough to
cover the maximum size of normal changes you expect a single
command to make, but not so large that it might exceed the
maximum memory allotted to Emacs.

我的 emacs 看起来像这样:

我真的不需要在正确的缓冲区matlab-shell 中进行任何撤消。有没有办法禁用这个警告?请注意,左侧缓冲区是MATLAB 脚本,这意味着主要模式是 MATLAB,当然不应该在此处禁用撤消。

【问题讨论】:

  • 那么*MATLAB* 缓冲区处于哪种模式?我可以看到较浅的文字是“M-Shell”。我猜是matlab-shell-mode,但如果你使用C-h m,那么你可以告诉我们。
  • @phils,你猜对了。这是matlab-shell模式。左右模式不一样吗?
  • 它们有什么不同吗?一种是帮助编辑特定语言的源代码的模式,另一种是与外部运行进程交互的模式。尽管两者都与 MATLAB 相关,但这两个活动几乎没有共同之处。
  • @phils,谢谢。我不明白star_MATLAB_star 在正确的缓冲区上意味着什么。和MATLAB模式有什么关系。
  • 不,这是缓冲区名称,就像“frequency_response.m”是左侧窗口中缓冲区的名称一样。文件访问缓冲区以其正在访问的文件命名(但如果您打开具有相同文件名的多个文件,则为“唯一”)。像 *MATLAB* 这样的非文件缓冲区的名称通常以星号开头和结尾(我实际上不确定这是否是文档化约定,但它显然是为了防止与实际文件发生命名冲突)。

标签: matlab emacs


【解决方案1】:

正如警告信息所说(或过去所说?):

您可以通过添加条目来禁用此缓冲区的弹出 (undo discard-info) 到用户选项warning-suppress-types, 在warnings 库中定义。

即:

(add-to-list 'warning-suppress-types '(undo discard-info))

(这当然只会禁用警告,而不是撤消数据收集本身。)

【讨论】:

    【解决方案2】:

    您的问题有点模棱两可,但假设您说您不需要撤消此缓冲区中的内容,那么您可以在每个缓冲区的基础上禁用撤消系统:

    buffer-disable-undo is an interactive compiled Lisp function in `simple.el'.
    
    (buffer-disable-undo &optional BUFFER)
    
    Make BUFFER stop keeping undo information.
    No argument or nil as argument means do this for the current buffer.
    

    所以你可以交互地调用 Mx buffer-disable-undo RET ,或者如果你确定它,你可以将它添加到相关模式的钩子函数中.

    编辑:

    所以根据问题 cmets 中的额外信息,我建议这样做:

    (add-hook 'matlab-shell-mode-hook 'buffer-disable-undo)
    

    【讨论】:

    • 我更新了问题。 buffer-disable-undo 部分回答了这个问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-16
    相关资源
    最近更新 更多