this post was submitted on 16 Jul 2023
3 points (80.0% liked)
Emacs
2194 readers
1 users here now
Our infinitely powerful editor.
founded 4 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Hi, That's a surprising issue, especially if the scratch buffer is the only text buffer in which the
undo
doesn't work. Here is what I'm thinking right now:C-x C-q
.C-h k C-/
(for example, for checkingC-/
).undo
function directly withM-x undo
to see if you can get some meaningful error messages.I confirmed with both my personal config that uses
undo-tree
(great tool btw) and also in a default configuration of Emacs; both cases work fine toundo
in scratch.Hope any of that can help!
Cheers
Hello Sunoc.
read-only
, but it always start as so.undo
, emacs says "no undo information in this buffer" (searching for this didn't seem to give relevant information except something from 2006 and then something about specific of a table-spreadsheet that I don't use).From this and @ouigol@beehaw.org (I will relpy after this one) it looks that it may be my configuration, since I'm using vanilla emacs with my own configuration.
Anyway, thanks a lot for your time! :)
After checking the source, it looks like this error is triggered when the
buffer-undo-list
variable is equal tot
, which means the buffer is unmodified, or at least that this variable is not modified from thescratch
buffer.There is something else in the documentation of this variable: <If the value of the variable is t, undo information is not recorded.> Maybe you can try to fix your issue by forcing the
buffer-undo-list
variable tonil
for the elisp mode, as follow:(add-hook 'elisp-mode (lambda () (setq-local buffer-undo-list nil)))
I tried it but still no joy...
Looking at this issue I noticed 3 things that may help to pinpoint the origin...:
(setq-default major-mode 'org-mode)
was(setq default-major-mode 'org-mode)
. Both expressions seems indistinguishable in the resulted behavior.org-roam
mode (andread-only
mode), which is very strange, but can obviously be related and/or part of the problem. The org-roam section (my config is literate in org-mode) comes before this variables being set.What does this info may imply?
Okay, I could reproduce your situation by evaluating
This setup forces the scratch buffer to be in org-mode, apparently breaking most of the available keybindings for it, including the undo.
The value for the
initial-major-mode
should be kept aslisp-interaction-mode
, if your configuration requires to set it.Otherwise I would remove both of these lines all together and see if the default behavior brings back the scratch buffer to be in the expected
lisp-interaction-mode
again. The additional hook I provided in my previous post shouldn't be needed either.