Questions tagged [undo]

62 questions
38
votes
6 answers

How to reopen just killed buffer, like C-S-t in Firefox Browser?

Sometimes I accidentally kill a buffer and want to reopen it, just like C-S-t to undo closed tab in Firefox, but there is no built-in command in Emacs, the defun undo-kill-buffer in http://www.emacswiki.org/RecentFiles : (defun undo-kill-buffer…
CodyChan
  • 2,599
  • 1
  • 19
  • 33
19
votes
3 answers

How to collapse undo history?

I'm working on an Emacs mode that lets you control Emacs with speech recognition. One of the problems I've ran into is that the way Emacs handles undo doesn't match how you would expect it to work when controlling by voice. When the user speaks…
Joseph Garvin
  • 2,061
  • 8
  • 21
17
votes
1 answer

Is there a 'local undo' extension for Emacs?

It happens quite often that I want to undo changes locally or line-wise. For example, when I change multiple lines in a source code and I want to revert only one of them, then I have to step through the entire undo tree to find the state I want to…
Lenar Hoyt
  • 1,163
  • 7
  • 25
12
votes
3 answers

How to modify a buffer without undo noticing?

Q: How do I insert/modify text in a buffer without undo noticing? Here's the use case. I have a comment block at the start of every file that, among other things, updates a timestamp for the most recent change to a file. I'd like to be able to…
Dan
  • 32,584
  • 6
  • 98
  • 168
12
votes
4 answers

Possible not to use undo-tree in evil mode?

Every so often I run into bugs in undo-tree, where I can't redo, with the following: primitive-undo: Unrecognized entry in undo list undo-tree-canary Links to references to this issue: Bug report. Bug report. Reddit thread. This is really bad and…
ideasman42
  • 8,375
  • 1
  • 28
  • 105
6
votes
1 answer

In undo history, how to separate abbrev expansion from self-insert?

Very occasionally, hit SPC during regular typing and get an unexpected abbrev expansion. What I usually do in this case is undo (which reverts the expansion and the inserted space) and then manually C-q SPC to add the space again. It would be really…
Malabarba
  • 22,878
  • 6
  • 78
  • 163
6
votes
3 answers

How can I implement Vim's `undo line` command in Emacs' evil-mode?

From the Vim User Manual: 02.5: There's a special version of the undo command, the "U" (undo line) command. The undo line command undoes all the changes made on the last line that was edited. Typing this command twice cancels the preceding …
achalk
  • 579
  • 4
  • 16
6
votes
1 answer

How to make interactive functions (simply) undoable?

This question refers exclusively to interactive functions that modify the contents of the current buffer. What does one need to do to ensure that a single execution of (undo), right after running the function, will fully undo all the changes it made…
kjo
  • 3,145
  • 14
  • 42
5
votes
2 answers

How can I prevent undo after redo?

I already know that to redo a change, I need to type something like C-g C-/. Why does it start to undo after all of the possible redos are done? Here is what I mean: Visit a new file. Type aa bb cc Type C-/ five times to undo the text. Type…
user90726
  • 173
  • 7
5
votes
1 answer

fine-grained undo

How to make M-x undo more fine-grained or sensitive? Example: say, I wrote: foo (bar baz) () then I M-x undo and receive: foo (bar but what I want to get after this undo is: foo (bar baz)
jue
  • 4,476
  • 8
  • 20
5
votes
1 answer

Why is the `buffer-undo-list` excluded from `(buffer-local-variables)`?

I am modifying desktop.el to support restoring the buffer-undo-list, and am push-ing that list at the tail end of the function desktop-buffer-info because the buffer-undo-list is not included in the output of the function buffer-local-variables. Q: …
lawlist
  • 18,826
  • 5
  • 37
  • 118
5
votes
2 answers

atomic undo blocks

Is it possible to wrap an arbitrary series of operations such that when a single undo command is issued, all of the wrapped operations are undone at once, rather than requiring multiple undos to undo them? For example, let's say I delete a line,…
izkon
  • 1,798
  • 10
  • 23
5
votes
3 answers

Undo region spacemacs

I really appreciate the undo in region command in standard emacs, where you can just mark a region and only changes made in that region are undone. This doesn't seem to work in the default spacemacs configuration. Is there a way to activate this?
tom4everitt
  • 173
  • 4
5
votes
1 answer

undo-tree output like git log

I just discovered undo-tree-mode and it's amazing. My use case is finding changes that I've made before so that I can re-apply them. However I'm having difficulty finding the changes I've made. Is there an easy way to get output like git log -p or…
Att Righ
  • 725
  • 4
  • 14
4
votes
0 answers

How to increse the number of undo steps stored by emacs?

Looking into undo, there are variables: undo-limit, undo-strong-limit, undo-outer-limit. While I can blindly set these to a big number and hope for the best.Whats a good rule of thumb for setting these values that matches it to an approximate memory…
ideasman42
  • 8,375
  • 1
  • 28
  • 105
1
2 3 4 5