Skip to main content

Questions tagged [undo]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
67 views

How to skip undo changes made by a certain function?

The goal is to prevent the possibility of undoing some automatic text additions into buffer. So far I tried to solve it by: (defun skip-undo (orig-fun) (let ((buffer-undo-list t)) (...
0 votes
0 answers
25 views

Save `*Help*` buffer navigations as undo steps

The built-in help system reuses the same *Help* buffer for each help "page" you look at. Help buffers have their own limited analog to undo: "back" and "forward" links in ...
0 votes
1 answer
94 views

Undo one specific line in a text file within Emacs

Usually when doing the normal undo it will undo all code changes since you went into insert-mode (for me it's evil-undo). I was wondering if it were possible to implement a function that will only ...
12 votes
4 answers
5k views

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. ...
0 votes
2 answers
84 views

How to bind org-agenda-undo to C-z when cua-mode is enabled?

By default, C-_ runs the command undo (found in global-map). It also runs org-agenda-undo when in Agenda view. As I use cua-mode, I undo changes with C-z. My issue is that it doesn't work in Agenda ...
0 votes
1 answer
61 views

How to bring the deleted region back if I abort yanking with `M-y`?

I have the following configuration in my init.el: (use-package delsel :demand t :config (delete-selection-mode +1)) When I do yank-pop with M-y while a region is selected, it deletes the ...
5 votes
3 answers
978 views

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 ...
1 vote
2 answers
143 views

How to impliment a “with-undo-collapse” macro using change group feature?

Recently emacs has a feature undo-amalgamate-change-group which can be used to merge multiple actions into a single undo step. How can this be used to make a with-undo-collapse macro similar to this ...
1 vote
2 answers
99 views

Why isn't the jch's "with-undo-collapse" macro an emacs built-in yet?

I wondered why the jch's with-undo-collapse macro (or something like that) isn't an emacs built-in yet. Is it safe enough? Is there a built-in alternative? I mean something that can be applied like ...
0 votes
0 answers
43 views

Is it valid to have undo steps that only move point?

Recently I found a package vundo has a bug with undo steps that only move point (cursor). This only happens rarely and I'm not sure how to re-create this situation. Although this works with emacs undo ...
1 vote
1 answer
703 views

Doom Emacs single keystroke undo

How can I have single keystroke undo using Doom Emacs with Emacs 27.2? I have already tried multiple suggestions on this site, so far none work. Perhaps Doom Emacs is the problem, or maybe it's that ...
1 vote
1 answer
97 views

How to revert org-ctrl-c-tab in Org?

I accidentaly pressed the keys C-c C-i which executed the command org-ctrl-c-tab. According to the self-documentation: org-ctrl-c-tab is an interactive and byte-compiled function defined in org.el.gz. ...
0 votes
0 answers
18 views

Undo insertion and deletion in one step when undoing overwrite of selection

Undoing the insertion of a character while the region is active (and delete-selection-mode is non-nil) requires two steps: the first to undo the insertion and the second to restore the deleted region. ...
2 votes
1 answer
127 views

Replacement in loop as a single undo item in buffer-undo-list?

I have this loop: (catch 'QUIT (while (search-forward-regexp "\\([^\n\\]\\(?:\\\\\\\\\\)*\\|^\\(?:\\\\\\\\\\)+\\)%.*\n" nil t) (save-excursion (let ((...
3 votes
1 answer
6k views

How to assign the undo command to the Ctrl-z key binding?

I have added: (global-set-key (kbd "C-z") 'undo) to my ~/.emacs file. But still when I press Ctrl+z nothing is undone even when I've had GNU Emacs open for a while and done several things ...
1 vote
1 answer
216 views

Avoid query to recover `buffer-undo-list`

Every time I commit via Magit before the buffer COMMIT_EDITSMSG is opened I get the question buffer-undo-list is not empty. Do you want to recover now? (yes or no) I'm guessing this is coming from an ...
0 votes
0 answers
43 views

Make undo during I-search revert last call to ding

Entering a failing search string during I-search triggers a call to ding(). If this happens during a macro recording that ding when the macro is being played will abort the macro which in turns ...
19 votes
3 answers
1k views

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 ...
3 votes
1 answer
275 views

Can redo be made to stop once the most recent state has been reached?

Using emacs vanilla undo, I'd like to undo a series of operations, then hold a key to redo only the operations I just undid, and only those operations. This use case for example: Hold undo key, copy ...
5 votes
2 answers
1k views

How can I prevent undo after redo? [duplicate]

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 ...
1 vote
1 answer
336 views

Possible to use emacs-undo/redo without keyboard-quit? (Ctrl-G)

Having run into a bug with undo-tree, I'd rather use emacs default undo. Mapping undo to undo-only and redo to undo. This requires pressing Ctrl-G then undo to effectively redo an operation. Is ...
3 votes
1 answer
452 views

Restore emacs' default undo/redo behavior in spacemacs

I've recently moved to spacemacs and it seems that they've adopted a different undo package (undo-tree) which I don't like since it does not push the undo actions back onto the history stack. I would ...
2 votes
1 answer
105 views

How to prevent undo steps being freed while undoing?

As I understand it, undo operations (namely undo and undo-only) are regular Emacs operations which add to the undo history. An issue with this is undoing adds to the size of the undo data, which ...
0 votes
0 answers
93 views

Pulse text inserted, changed or removed when undoing and redoing

I heard about pulse.el recently on r/emacs and thought of using it to highlight the chunks of text inserted, removed or changed on undoing and redoing edits, just like evil-goggles used to do: There'...
0 votes
1 answer
55 views

How to end text-insert undo segment after cursor jump (caused by mouse)?

Coming from vim into (evil-mode) spacemacs, I sometimes get frustrated that undo segment is not ended when a mouse-caused cursor movement occurs. An example : While I am inserting text, touchpad gets ...
2 votes
1 answer
808 views

No further undo information

I'm getting the "no more undo" message all too often, even I made changes that should be there in the history. This is seriously breaking my workflow. This is my .emacs https://github.com/skrat/dots/...
0 votes
4 answers
4k views

how can I get Emacs kill-ring to behave like a simple clipboard buffer?

How can I get Emacs to behave the same as other programs for copy/paste (i.e. OpenOffice, Microsoft Word, etc.)? I want to simplify the kill-ring so that it behaves like a simple clipboard. I find it ...
0 votes
0 answers
142 views

How to access buffer history/history of the document at any given time?

I looked up the manual, and it says that the history in a buffer is stored in buffer-undo-list variable. I printed out this variable to see what the contents are, but they don't seem to be making much ...
0 votes
0 answers
40 views

undo-tree: remove the current node

I just want to erase history here - the very last entry. This shouldn't be dangerous, right? I figured I need to somehow transform (undo-tree-current buffer-undo-tree) and pass that to undo-tree-snip-...
1 vote
2 answers
680 views

Remap redo to C-S-/

I do not like the standard keybinding to redo so I would like to customise it. How can I remap redo to C-S-/? I am not able to find any solution in internet.
0 votes
2 answers
91 views

How to break the undo chain from a function call? (not Ctrl-G)

When undoing you can press Ctrl-G to redo. This runs keyboard-quit which signals quit. However this isn't convenient because as far as I know you can't run commands after keyboard-quit. Is there a ...
4 votes
0 answers
218 views

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 ...
2 votes
1 answer
196 views

Is it possible to group series of changes under single undo step?

I am writing template insert function for a file format that needs to keep header counter updated. I'd like that undo operation removes not only in place template changes but also corresponding ...
4 votes
1 answer
241 views

change how much undo-tree-undo undoes [duplicate]

In particular, I am using undo-tree-undo. When I type a few words in a line, and undo, all those words disappear. Same thing happens when I type a function name and screw up a couple of symbols in ...
3 votes
1 answer
557 views

Remove unsaved text in Emacs

Is there a way to remove unsaved text and get back the latest saved state of a file in Emacs without using undo? Like this: | a - write some text to save | b - save the file | c - add some text to ...
5 votes
1 answer
551 views

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)
4 votes
1 answer
104 views

Check if current user undoing/redoing?

Is there a way so that the Emacs are able to tell if the current user is undoing/redoing in the current buffer? Here is the task I want to accomplish, I have add a hook to after-change-function, it ...
6 votes
3 answers
790 views

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. ...
2 votes
1 answer
130 views

Problem redoing with yasnippet

I have had a problem with undoing lately, which seems rather dangerous and has almost lost me work. At first I thought it was due to undo-tree, so I deactivated that. But it persists and now I ...
0 votes
1 answer
41 views

Is quiting arbitrary mode possible?

How to exit arbitrary mode x, as it seams for my particular case undo-tree-mode there is no undo-tree-mode related option for undoing it, it there a general solution?
5 votes
2 answers
406 views

atomic undo blocks [duplicate]

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 ...
2 votes
0 answers
51 views

How to prevent undo from operating on invisible text/regions?

Q: how can I prevent undos of invisible text? I use org-mode and outline-minor-mode in virtually every buffer, and leave text folded (invisible) unless I'm explicitly working on it. Sometimes I hide ...
1 vote
0 answers
82 views

How do you create a custom undo?

I have a package that creates overlays as annotations. Part of the functionality is to delete annotations too. It turns out neither of these seems to be undoable. I.e. if you add an overlay to text, ...
5 votes
1 answer
125 views

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 ...
39 votes
6 answers
6k views

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....
2 votes
1 answer
3k views

redo (ctrl+y) undo

I normally undo with ctrl+_ with other editors there is a redo operation normally associated with ctrl+y. is there an emacs equivalent? In general what is the best way to handle an "undo tree"?
1 vote
1 answer
98 views

Cleaning the buffer-undo-list of unwanted entries

When multiple-cursors is deactivated, I would like to remove from the buffer-undo-list all entries that look like this: (apply activate-cursor-for-undo 40) (apply deactivate-cursor-after-undo 38) ...
4 votes
2 answers
1k views

How to reset undo history?

I often did undo too much, then redo it. I noticed I have default undo position in my mind. I think C-x C-s is helpful but not enough, because it just indicate modified or not, so the buffer is still ...
6 votes
1 answer
472 views

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 ...
4 votes
0 answers
102 views

undo-tree tree manipulation/cherry picking?

Is it possible to cherrypick changes from different branches in undo tree? For example say I make a change call it change1. I then undo, and make a change, call it change2. I then undo, and make a ...