Skip to main content

Questions tagged [undo]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
2 answers
353 views

Any way to cancel C-q quoted-insert?

Is there a way to cancel the quoted-insert that begins when I press C-q? Sometimes when I mean to press C-w, I miss and hit the Q key instead of the W key. Trying to cancel C-q with C-g inserts a ...
amacleod's user avatar
  • 133
2 votes
1 answer
77 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)) (...
Herman's user avatar
  • 57
0 votes
0 answers
27 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 ...
mtraceur's user avatar
  • 576
0 votes
2 answers
91 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 ...
crocefisso's user avatar
  • 1,449
0 votes
1 answer
62 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 ...
Mehdi Khawari's user avatar
0 votes
1 answer
118 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 ...
Finbar Cowan's user avatar
0 votes
0 answers
45 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 ...
ideasman42's user avatar
  • 9,027
1 vote
1 answer
756 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 ...
gdonald's user avatar
  • 167
1 vote
1 answer
99 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. ...
Pedro Delfino's user avatar
0 votes
0 answers
20 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. ...
Arch Stanton's user avatar
  • 1,727
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 ...
Nordlöw's user avatar
  • 527
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 ...
user90726's user avatar
  • 173
3 votes
1 answer
467 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 ...
oneself's user avatar
  • 341
0 votes
0 answers
95 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'...
Arch Stanton's user avatar
  • 1,727
1 vote
1 answer
231 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 ...
Nordlöw's user avatar
  • 527
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 ...
user6609's user avatar
0 votes
0 answers
159 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 ...
NobleSiks's user avatar
  • 101
0 votes
0 answers
41 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-...
user3496846's user avatar
2 votes
1 answer
106 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 ...
ideasman42's user avatar
  • 9,027
1 vote
2 answers
146 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 ...
ideasman42's user avatar
  • 9,027
5 votes
0 answers
229 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 ...
ideasman42's user avatar
  • 9,027
3 votes
1 answer
277 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 ...
ideasman42's user avatar
  • 9,027
0 votes
2 answers
92 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 ...
ideasman42's user avatar
  • 9,027
1 vote
1 answer
343 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 ...
ideasman42's user avatar
  • 9,027
2 votes
1 answer
846 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/...
skrat's user avatar
  • 143
2 votes
1 answer
214 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 ...
gavenkoa's user avatar
  • 3,502
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 ...
Gabriele's user avatar
  • 1,680
4 votes
1 answer
257 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 ...
user3496846's user avatar
3 votes
1 answer
566 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 ...
Asme Just's user avatar
  • 384
5 votes
1 answer
562 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)
jue's user avatar
  • 4,666
4 votes
1 answer
106 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 ...
Jen-Chieh Shen's user avatar
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 ...
Toothrot's user avatar
  • 3,284
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?
Error's user avatar
  • 101
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 ...
Dan's user avatar
  • 33.3k
1 vote
0 answers
83 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, ...
John Kitchin's user avatar
5 votes
2 answers
410 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 ...
izkon's user avatar
  • 1,908
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"?
Andrea Borga's user avatar
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 ((...
Gabriele's user avatar
  • 1,680
5 votes
3 answers
996 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 ...
tom4everitt's user avatar
1 vote
1 answer
101 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) ...
lawlist's user avatar
  • 19.4k
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 ...
m33lky's user avatar
  • 297
4 votes
2 answers
2k 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 ...
Kei Minagawa's user avatar
5 votes
1 answer
127 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 ...
Att Righ's user avatar
  • 775
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. ...
ideasman42's user avatar
  • 9,027
6 votes
3 answers
798 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. ...
achalk's user avatar
  • 589
1 vote
2 answers
703 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.
Nisba's user avatar
  • 915
4 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 ...
Josh Pinto's user avatar
6 votes
1 answer
474 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 ...
kjo's user avatar
  • 3,287
4 votes
0 answers
103 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 ...
Abraham P's user avatar
  • 201
1 vote
0 answers
95 views

Is there a package to search in history of changes?

While editing files, time to time I regret deleting some redundant parts which afterwards become necessary. Let's say you are writing a letter and first you explained your thoughts with redundantly ...
Dummy's user avatar
  • 19