Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs buffer undo limit

Tags:

emacs

matlab

I get this warning in my matlab-shell buffer when I print alot to stdout:

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.

My emacs looks like this: enter image description here

I really don't need any undo in the matlab-shell which is the right buffer. Is there a way to disable this warning? Note that the left buffer is a MATLAB script which means that the major mode is MATLAB, and certainly undo should not be disabled there.

like image 240
rowman Avatar asked May 24 '13 10:05

rowman


2 Answers

As that warning message says (or used to say?):

You can disable the popping up of this buffer by adding the entry (undo discard-info) to the user option warning-suppress-types, which is defined in the warnings library.

That is:

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

(That will of course just disable the warning, not the undo data collection itself.)

like image 99
legoscia Avatar answered Sep 27 '22 19:09

legoscia


Your question is a little ambiguous, but assuming you're saying that you have no need to undo things in this buffer, then you can disable the undo system on a per-buffer basis:

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.

So you can call M-x buffer-disable-undo RET interactively, or if you're sure about it, you could add this to a hook function for the mode in question.

Edit:

So based on the extra information in the question comments, I would suggest this:

(add-hook 'matlab-shell-mode-hook 'buffer-disable-undo)
like image 24
phils Avatar answered Sep 27 '22 20:09

phils