15 ms·
Emacs 26 Brings Generators and Threads
- cies 8y agoWeird 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.
- deleted 8y ago[deleted]
- deleted 8y ago[deleted]
- Theizestooke 8y agoAnyone know when the Windows builds will be available for download?
- smee0815 8y agoAn inofficial build is available here: https://www.reddit.com/r/emacs/comments/8n2wga/emax6420180529_261_final_released https://www.reddit.com/r/emacs/comments/8n2wga/emax642018052...
- rusk 8y agoI got it from here: http://alpha.gnu.org/gnu/emacs/pretest/windows/ http://alpha.gnu.org/gnu/emacs/pretest/windows/ It works flawlessly. I just dropped it (26.1) in on top of my existing setup and had to do nothing else and I'm working away on it right now. When I was downloading at least, I had to download it and the dependencies separately. The README says there should be a unified zip-file but it wasn't there at the time. Had some issues with Windows 10 refusing to merge the directories from the deps package so had to drop to a cygwin shell but it actually worked quite well even without the deps.
- sympodius 8y agoFlyspell in Emacs 26.1 seems to require a version of Aspell that is not officially available for Windows. I might need to put off the upgrade until I can attempt to compile a newer Aspell for Windows myself. "Error enabling Flyspell mode: (aspell release 0.60 or greater is required)"
- sympodius 8y agoIn case anyone else was facing this problem (and isn't too committed to Aspell as a backend for Flyspell), the version of Hunspell from ezwinports[1] (version 1.3.2 at time of posting) seems to be working with Emacs 26.1 on Windows. [1] https://sourceforge.net/projects/ezwinports/files/ https://sourceforge.net/projects/ezwinports/files/
- rusk 8y ago
- rusk 8y agoHere's what grinds my gears: That the cursor follows the visible buffer. It would be nice to be able to scroll to another part of a file and then just start typing and be back where I was ... I mean I could understand if this was an efficiency thing to do with scaling to large files due to a kind of a tiling memory model or something, but emacs doesn't even do that! It's not a huge deal I've learned to get used to using Ctrl+U-Space to get back to where I was. I read somewhere that somebody tried to implement what I'm talking about but never really got around to trying it cause it seems a little half-baked.
- rcthompson 8y agoNow I kind of want to try my hand at implementing this. I imagine an implementation would add a buffer-local variable holding the position of the point as of the last non-scrolling operation. This would be updated in post-command-hook, but only if the last command was not a scrolling command (which would probably have to be defined as a list of "blacklisted" commands that shouldn't change the point). This hook would also hide the cursor if the desired position of the point is off-screen and show it otherwise. Finally, a pre-command-hook would set the real point to the saved position unless the command about to be executed is a scrolling command or a mouse interaction (which should move the point to somewhere on-screen).
- hollerith 8y agoI've seen an implementation, but don't remember its name or how to find it again. If I remember, I'll send an email to the address on your resumue.
- rudolfwinestock 8y agoThe cursor stays in the viewport because, deep down, Emacs still thinks that it's outputting to a 1970s-era ASCII terminal. See this https://www.facebook.com/notes/daniel-colascione/buttery-smooth-emacs/10155313440066102/ https://www.facebook.com/notes/daniel-colascione/buttery-smo... “Internally, Emacs still belives it’s a text program, and we pretend Xt is a text terminal, and we pretend GTK is an Xt toolkit. It’s a fractal of delusion.” For years, James Gosling, author of the first version of Emacs that ran on Unix (the ancestor of GNU Emacs), has been begging people to stop using Emacs. Emacs is in a race, not against Vim, but against VS Code and Atom for which editor can be more easily customized. In the long run, it doesn't look good for Emacs.
- pilif 8y agoSeeing generators and threads being mentioned in the release announcement of a text editor feels a bit... strange. Then again, Emacs is closer to a LISP toolkit for building text editors than it is a text editor, so I guess it's not so strange after all.
- pjmlp 8y agoEmacs is an OS written in Lisp, with a text editor as sample application. :)
- signal11 8y agoAlso if you require good keybindings in the sample application, there's always viper :)
- zaphar 8y agoEvil mode is far far better than viper. Do yourself a favor and switch today.
- FPGAhacker 8y agoTo that end I like spacemacs. But it did incur enough of a startup penalty that have have shifted back to vim. I oscillate between them and vscode. I don’t use vim bindings in vscode though.
- xfer 8y agoRun it in daemon mode. startup time is not a thing for emacs.
- FPGAhacker 8y agoIt's not stable enough for me. Well, my plugins aren't. I need to be able to reset state periodically. Plus, I like to have separate instances of emacs with different groups of files from separate but related projects. I end up with a zoo of buffers commingled in daemon mode. It just doesn't fit how I work. I wish it had an image based startup scheme... freeze an image of emacs after init is done.
- nathell 8y agoI think this bit is a piece of wisdom: "I’m a firm believer that we should understand how things work underneath the hood so that we can make the most effective use of at them. No program should rely on the particulars of the iterator object internals for correctness, but a well-written program should employ them in a way that best exploits their expected implementation."
- VikingCoder 8y agoI love the Emacs OS, but I'm just not thrilled with the editor that comes default with it. Has anyone ported Visual Studio Code to run on Emacs OS yet?
- FPGAhacker 8y agoAll jokes aside, is it the ui if vscode that you prefer? I have a hard time nailing it down, but aside from configuration, I do like vscode. I might use it more if we weren’t stuck in an old version of rhel at work.
- harrygeez 8y agoThe dream is to have an Emacs with a modern UI like VSCode
- FPGAhacker 8y agoI think your best bet would be to start with vscode and work toward what you like about emacs. For me, the only thing emacs has going for it are the plugins. If I could get the plugins I use in VSCode I'd never look back. Mainly this comes down to CIDER. But a lot of people have put person-years of work into cider. And it's hard to imagine them embracing vscode. Rather than porting plugins or making an elisp interpreter, if I were passionate enough about it, I would look for a path to being able to run a bridge (as a vscode plugin) to a headless emacs. I have no clue how that would be done, but If I chose to believe it was possible, I would try to write an network based API to emacs as an elisp plugin to start, enabling other front ends as neovim does.
- KirinDave 8y agoThis is cool, but it's too bad folks here don't seem to have kept up with the evolution of iteratees/enumerators and free monadic computations (conduit/pipes/streaming) that other languages have pushed forwards as evolutions of the generator ideal. The net result for common iteration ops is quite nice, and has options for reasonable optimizations in the world of lisp where macros are real.
- j88439h84 8y agoCould you explain or link to more info please? Sounds interesting.
- chriswarbo 8y agoI thought the natural "successor" to generators was delimited continuations, rather than iteratees or free monads/algebraic effects. Do such streaming concepts map well to eager, imperative code? I've only encountered them in Haskell, where laziness makes stuff like co-induction/recursion trivial.
- KirinDave 8y agoCertainly for conduit the laziness sort of goes away since you must sink a source and unless you do that to some observable effect the entire result disappears and no work is done at all. But certainly iteratees as an independent went out of fashion when conduit and pipes came on scene.
- samatman 8y agoDoes anyone happen to know why e-lisp iterators stop on a magic `iter-end-of-sequence` instead of on `nil`? That doesn't seem Lispy.
- dang 8y agoProbably because the sequence might contain nil as an element, and you don't want to short-circuit the iteration when that's the case. For the same reason, it's the usual thing in Lisps to break on a sentinel value (defaulting to EOF or similar) when reading sexprs from a file. In cases where nil isn't a valid element, you can always specify nil as the sentinel.
- cobbal 8y agoA likely reason is that it makes it possible to iterate through a list like `'((1 2) () (a b c))`. If you have to do in-band signaling, make it something unique and obscure.
- kwoff 8y agoIn addition to the sentinel/in-band replies, they also put properties on that symbol: https://github.com/emacs-mirror/emacs/blob/81b5131e11fa96d32a1718c6e2ebf40994d7d281/lisp/emacs-lisp/generator.el#L569 https://github.com/emacs-mirror/emacs/blob/81b5131e11fa96d32... ( https://www.gnu.org/software/emacs/manual/html_node/elisp/Symbol-Plists.html https://www.gnu.org/software/emacs/manual/html_node/elisp/Sy... )
- Diobo1000 8y agoIn all honesty, the main selling point of Emacs for me isn't just how configurable it is but also how performant it is in different environments. Since VSCode uses Electron editing feels sluggish, high ram and cpu usage is expected, and there's a noticable latency between keypresses. While these may seem like trivial issues, they actually negatively impact my typing experience to a high degree. I'm currently using the Doom-Emacs distribution for Emacs and everything is working very well. I can use vim keybindings in addition to many other customizations and improvements with very little time invested in actually writing elisp. This is mostly because the developer of the distribution is passionate and optimizes his configuration for modern languages so there is very little needed to change. If VSCode or any other text editor managed to provide a fast yet highly configurable editing experience without draining my laptop battery instantly, I would immediately switch. So far, none have been able to meet this specification even though I have tried almost all of the common text editors. I'm hoping a project like the Xi text editor might one day actualize my desire.
- Pimpus 8y ago> While these may seem like trivial issues, they actually negatively impact my typing experience to a high degree. I don't think these are trivial issues at all. I do the majority of my computing work in a text editor so it's important to me that it's as performant as possible. Imagine if, in real life, there was a slight lag every time you sent a "command" (e.g. pick up coffee). It would drive you crazy. And yet a lot of developers think that lag is acceptable in software. (I say "developers" because a lot of non-developers I meet complain about software being frustrating to use, even if they may not consciously notice it is laggy.) People think I'm joking when I say this, but I'm so attuned to Emacs, especially when I'm in a flow state, that I can actually feel when the garbage collector kicks in. It totally throws me off. I have a bunch of optimizations set up, like running GC whenever I tab out of Emacs or am idle for 5 seconds, but sometimes I can still feel it. I hope Emacs makes some progress in this area -- I hear there's a Rust rewrite in the works :) > If VSCode or any other text editor managed to provide a fast yet highly configurable editing experience without draining my laptop battery instantly This is huge for me. I basically work by grabbing my laptop and sitting, standing, or laying wherever I feel like. I can't stand the idea of having an "office". So I'm acutely aware of when an application is running down my battery. Emacs is awesome in this regard because it has no noticeable energy usage, which boggles the mind when I think about how powerful it is as software. I honestly see no reason whatsoever to use anything else.
- jbirer 8y agoWhen is it getting it's own thread scheduler and bootloader?