5 ms·
The terminology comes from Emacs: https://www.emacswiki.org/emacs/KillingAndYanking https://www.emacswiki.org/emacs/KillingAndYanking https://www.gnu.org/softw
by jks 5y ago
The terminology comes from Emacs:
https://www.emacswiki.org/emacs/KillingAndYanking https://www.emacswiki.org/emacs/KillingAndYanking
https://www.gnu.org/software/emacs/manual/html_node/emacs/Killing.html https://www.gnu.org/software/emacs/manual/html_node/emacs/Ki...
The basic idea is that your clipboard ("kill ring") can contain many entries, so you can kill several lines (or words, sentences, functions, what have you) and then yank them back at other locations. Yanking copies the most recently killed text, but you can use another command to replace it with previous entries until you find the right one. Thus you don't have to fear losing the clipboard while performing intermediate operations.
Readline-type libraries typically implement a small subset of the Emacs kill-ring features, so you really need to try Emacs to appreciate the full range of the concept.
- nine_k 5y agoFor instance, the kill ring allows you to easily move around two words in different parts of a long command. - Move cursor to the first word, kill it with Alt+D (aka M-D). - Fearlessly move the cursor to another word, kill it, too. - Now move where you want to put the first word back, because it's nearby. Press Ctrl+Y, oops, it shows the second word. Never mind, press Alt+Y, and it pastes the first word on its place. - Now move elsewhere where the second word belongs. Ctrl+Y pastes (yanks) the first word again, the most recently used. Alt+Y changes it to the second word, the second most recently used. This way you may have quite a few fragments in the ring and juggle them, repeat them, several different fragments, without the need to copy again and again.
- savolai 5y agoThanks. I suppose I would have to see this in practice to be able to understand and appreciate it. My memory is limited so it doesn't seem worth the trouble to learn such a niche system. Still there's something intriguing about it as someone who tries to keep one's mind open about different design systems. As a ui/ux designer what strikes me with these legacy systems is there seems to be no fluent support system in place for learning them. And even after you've learned, no visibility to support long term memorization. Also, I suppose there is no clear visual panel to support memory as to what's actually in the ring but you kinda have to just browse it one by one with shortcuts, as I understand the above? Do the terms kill/yank seem appropriate to others? It seems that there is a slang context I'm missing there that might make the terms more intuitive.
- nine_k 5y agoPeople 40 years ago were no less smart than ourselves, but the machines they had in their disposal were much, much less mighty. Coding discoverability features into them was often very hard, especially with relatively slow terminals of the day. They relied on manuals instead. Now we have inherited these technologies, but there is often no reasonable way to modernize their UX in the discoverability department, because of key assumptions made decades ago. All we can use now is still manuals; `man bash`, search for the READLINE section, and read the extensive explanation of the riches hiding there. You can search by regexp, so ^READLINE will bring you right to the section, but again there is no affordance to show you that a regexp is acceptable. And yes, I think nobody thought through the terms kill / yank; their authors just picked some metaphors 40 or more years ago, because they were building a tool for themselves and their colleagues in a computer department of a university, all engineers used to weird abstractions. The world is very different by now.
- jks 5y agoIn modern Emacs versions the top of the kill ring can be found in the Edit menu, and there are other packages to help navigate it: https://www.emacswiki.org/emacs/BrowseKillRing https://www.emacswiki.org/emacs/BrowseKillRing I agree that the ancient terminology is a problem with Emacs. People who are used to Emacs don't want to change it, but it is alien to all new users. Funnily enough, in vi (a competing old text editor that predates current UI standards) "yank" means "copy". Another example is "window" and "frame", which mean the opposite that you would think if you have used any modern windowing system. A similar problem (that is not strictly about terminology) is the way "undo" works. It is more powerful than the standard undo/redo system, but it can be very confusing when you encounter it the first time. Repeated "undo" commands work the way they do in other programs, but once you run any other command, the undo operations go in the undo history just like other commands and are themselves undoable, so the way to cancel an undo operation (which is called "redo" in many other programs) is to type some character and then run "undo" twice.
- nine_k 5y agoEmacs gives you a pretty pampered experience. The subthread started with a discussion of the shell command line, and its Emacs-like editing mode, which remains quite Spartan in its affordances: if you don't know the keys, nothing will hint or guide you. (With Emacs as my daily driver, I greatly miss its uniformity of window management even in environments that look like its spiritual successors, like VSCode.)