5 ms·
Weird place to vent. But I find it so interesting that Emacs in all it's wisdom does not have (to me) acceptable undo behavior. Sometimes when I want to undo a
by cies 8y ago
Weird place to vent. But I find it so interesting that Emacs in all it's wisdom does not have (to me) acceptable undo behavior. Sometimes when I want to undo a bit, it undoes so much that I have to do a few seconds of copy-pasting.
- grumph 8y agoYou should try undo tree (http://www.dr-qubit.org/undo-tree.html http://www.dr-qubit.org/undo-tree.html), it's a must have extension which brings proper undo-redo and a tree visualisation of history with diffs and many other options.
- anon1253 8y agoundo-tree is great! I use it like a "mini git", it supports branches/forks, so I can usually just try something in any order and easily go back to where I want to be. I use it in combination with Evil (vim) bindings, and everything works like a dream.
- rcthompson 8y agoI'll second the recommendation to use undo-tree. If your undo history is going to be tree-like, which it is in Emacs, then you might as well be able to visualize and manipulate that tree directly.
- martincmartin 8y agoTrying it out for the first time. Love this line in the docs: "The only downside to this more advanced yet simpler undo system is that it was inspired by Vim."
- agumonkey 8y agoUndo has many weird sides but what you describe rarely happen to me, if at all
- tombert 8y agoI still haven't figured out how the undo-direction works in emacs. It feels like half the time I'd inadvertently end up redoing.
- antoineMoPa 8y agoIf you did an undo in the history, it will look like a redo. So if you just did a bunch of undos, it will feel like redoing, but you are actually removing changes made by your undo.
- easytiger 8y agoit treats the undos as new changes to the buffer, and adds ;; them to the history:
- livebsd 8y agoWell, it's a true full "undo" behavior. It's a bit annoying at times because edits are not grouped, but you can see your entire editing history when you're undoing: no edit is ever lost in this manner. As typical in emacs, this is not the only undo behavior you can have. undo-tree behaves very similarly to vim by default, but still preserves the entire editing history (with branching), which is visible graphically with "C-x u".
- mrighele 8y agoI too find the undo behavior quite confusing. I don't know the implementation, but I guess it is because by default instead of unwinding the stack of operations it does something like doing the opposite action. This means that sometimes you may redo an operation by mistake: for example - Paste 5 time the same line - Press undo 3 times: removes 3 lines - Move the cursor by one character - Press undo 2 times: instead of removing 2 lines it adds back 2 It would be better if the two operations (undo/redo) would be distinct.
- rusk 8y agoBasically "Undos" become actions that you can later "Undo". It's very weird. I accept that it means you never loose a change but it does feel a bit like boiling the ocean to produce some salt ... that said, it's an "alternative approach" that does have its merits. I like that about emacs, it challenges your assumptions and makes you think! As much concept art as a tool in itself.
- todd8 8y agoThe undo system is confusing if you are accustomed to undo/redo in practically every other piece of software, but it does make sense (in its own kind of way). See the documentation for the undo commmand[1]. Emacs undo is powerful albeit with more cognitive load to use. I have occasionally had to take over the controls for new emacs users while pair programming because the undo, while logical and consistent, doesn’t work as it does in other software. Each consecutive sequence of undo commands, once interrupted by any command that is not an undo is considered itself to be an atomic undoable change. This means that there is no need for a redo command, just stop undoing and the last undo sequence can be undone. Because emacs has a large undo limit you can keep undoing even past sequences of undos back to the original edit points of the file’s history. That probably made no sense if you haven’t already mastered it, but another way to think of it is that edits and undos produce a branching tree of all the history of changes being made to the file. The entire tree of changes can be navigated with one command (undo) because that command makes a traversal of the tree, kind of like a post-order tree traversal. This is sufficiently confusing in practice that seeing the nanigation through the tree via the popular undo-tree emacs package helps a lot. I use the undo-tree command when I want to get to a version of the file not on the current main line of edits. [1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Undo.html#Undo https://www.gnu.org/software/emacs/manual/html_node/emacs/Un...
- martincmartin 8y agoThanks for the tip! Despite using emacs for decades, I never properly read the undo docs. I'll try binding the undo keystroke to "undo-only", and a redo to normal undo definition, to see if I can get something approximating undo/redo semantics.
- bitexploder 8y agoAnyone that wants to use emacs seriously has to learn a about the kill ring. Something like Helm kill ring is great. It lets you go way back in time and re-pasted killed things.
- kiaulen 8y agoThe problem with this is I'm a web dev and I can't really do all my work in emacs. For backend people you can live entirely in emacs. Once you hit the frontend you have to start interacting with a browser. That's why I always get a clipboard manager and have my editor kill (cut) to the clipboard. Then I can hit C-V and get a popup menu (similar to helm kill ring, navigable both with mouse and keyboard) with the last 100 or so things I've cut/copied.
- cup-of-tea 8y agoThat's odd, I find the default undo to be perfect. Never had a problem with it. What do you mean by "undo a bit"? A bit of typing? For that I use M-backspace, not undo. Undo is for reverting commands really. Like kill line, oops, undo.
- rusk 8y agoMy gripe is that I only just discovered the other day it chokes on large files, and even the vlfi (very large files) extension is quite cumbersome. I was quite dismayed to tell you the truth!
- dmortin 8y agoEmacs usually doesn't choke on large files, but it chokes on very long lines. E.g. SQL dumps and such.
- dfox 8y agoThere are two separate issues at play here: Emacs' redisplay algorithm is not very efficient if you have very long lines. On the other had on old emacs versions (before 23 IIRC) this was significantly worse as it also had weird UX implications (C-p/C-n working in terms of logical, as opposed to displayed, lines and unability to sanely display lines that are longer than width*height of window). Other problem is that the gap-buffer data structure is very suboptimal when you start to move the point by multi-MB offsets (which in emacs' case imcludes operations like scrolling to the other end of buffer using scrollbar) as it involves doing memmove() of this multi-MB block of memory.
- simias 8y agoI can understand being confused by emacs' undo but I don't understand what copy-pasting has to do with it. If you undo too much then you can effectively "re-do" by stopping your undo sequence (simply moving the cursor around for instance) and then undo your undoing? A big advantage of emacs' tree-like undo is that you never lose any part of your history unlike a naive linear undo sequence. Like in this Firefox edit box for instance, if I type a word, undo it then type an other word I can't go back to the state I was in before I undid the first word. With Emacs I can usually restore any previous state my buffer was in (within the limits of the size of the undo buffer that is).
- deleted 8y ago[deleted]
- henry_flower 8y agotry redo+: https://www.emacswiki.org/emacs/redo+.el https://www.emacswiki.org/emacs/redo+.el
- hellofunk 8y agoEmacs provides comprehensive building blocks for any kind of undo/redo system you could want, while providing it's very basic example implementation of undo/redo. Many other packages exist that focus on different ways to do this.
- deleted 8y ago[deleted]
- db48x 8y agoIf you really want to bake your noodle, try undo-tree-mode some time.