News for hackers. Stuff that matters.
Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by chipotle_coyote on Friday August 06, 2021 @04:44PM (#28092541)
> Admittedly, I haven't tried modern distributions like spacemacs and DOOM Emacs, but it's a bit hard for me to imagine that you won't need to come face to face with "emacsism" at some time.

Speaking from the experience of someone who has repeatedly bounced off Emacs for going on two decades now, you absolutely will. :)

> When I want to sort a few lines in a region and immediately discover that I can just call "sort-lines", because of course I can, I know that I'm not going to bother waiting for some other editor to catch up in all those little things.

This sort of "little thing" is, perhaps ironically, why I keep going back to BBEdit, at least for my technical writing work: it has a whole lot of these little "multipurpose tool" commands for text manipulation -- and, because they're in old-school Mac menus, they're discoverable. Thinking about it, that's one of the main reasons I bounce off both Emacs and Vim: it's not that I can't figure out the basics or even the, er, intermediates; it's that so much of the advanced stuff is relatively opaque. I am sure that there is probably a command in both Emacs and Vim that equates to, for instance, "find all lines matching this regex that occur more than once in this document, delete them, and copy them to a new document" (a task which sounds like I am making it up, but I swear I have had to do on multiple occasions in my current role). But I am also sure that it is not as easy as selecting "Text > Process Duplicate Lines..." and checking "Delete duplicate lines", "Leaving one" and "Match using pattern".

Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by anyfoo on Friday August 06, 2021 @04:53PM (#28092618)
Top of my head, I am pretty sure that I can do that with a "keyboard macro" involving list-matching-lines, and delete-matching-lines (that is literally what the commands are called). "Keyboard macro" by the way is a good and a bad name at once: It does not fully describe the vastly more powerful feature, as it is much more semantic than just repetition of keystrokes, but at its surface it looks like that and helps you get started.

If anyone reading this hasn't used keyboard macros in emacs, try it out the next time you do something repetitive. It's amazing how it can simplify those tasks. "C-x (" to start defining one, "C-x )" to end it, "C-x e" to run it, which conveniently also ends definition if you want to use it right away. Of course you can do things like "M-5 C-x e" to run it 5 times.

But I do get your point: Things are probably much less discoverable in emacs, unless you are relatively proficient in it already maybe. You need to switching into a "programmer" mind fairly quickly, while BBedit probably just lets you do powerful stuff through simple UI.

Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by zrail on Friday August 06, 2021 @09:18PM (#28094780)
Once you've hit C-x e once you can keep bouncing e to repeat the macro as well.
Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by anyfoo on Friday August 06, 2021 @09:46PM (#28094926)
Thanks for the reminder. I knew that once, but completely forgot about it!
Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by frosted-flakes on Saturday August 07, 2021 @05:39AM (#28097225)
Using non-standard notation for describing keyboard shorcuts doesn't help.
Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by anyfoo on Saturday August 07, 2021 @02:21PM (#28100700)
This is the notation that emacs has been using forever, and also displays to the user, so every user should be well comfortable with it. It even says “Press C-x C-c to exit emacs” at startup.
Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by frosted-flakes on Saturday August 07, 2021 @02:47PM (#28100868)
It's still non-standard, and is yet another barrier to adoption.
Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by opan on Saturday August 07, 2021 @06:22PM (#28102422)
I found it handy and I often use it outside of emacs as well when describing shortcuts to people. Mainly C-something for ctrl.
Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by taeric on Friday August 06, 2021 @07:15PM (#28093891)
With modern autocomplete for commands, discovering commands in emacs has never been easier. "M-x sort" will show you all fuzzy completions of that commands basically instantly.

The flow you just mentioned I think looks nigh identical.

Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by chipotle_coyote on Friday August 06, 2021 @08:16PM (#28094357)
Even the current version of Emacs doesn't do fuzzy completion for M-x commands, just start-of-token completion; out of the box the completion is a little basic. I know there are packages which make this a lot better, but you have to know about the packages. :)

Even so, the "sort lines" example works well with even the out-of-the-box completion. But, Emacs sometimes has its own language for things. If I didn't know the keyboard commands for "make region uppercase" and "make region lowercase" (which in fact I'd forgotten, although they're pretty trivial), then as far as I could tell the best way I could find them would be: Google. Inside Emacs, I could type "M-x up" and get the correct "upcase-region", but if I'd typed "M-x upp", I'd be out of luck. And Emacs-ese for "lowercase" is "downcase"; I wouldn't have guessed that at all!

So I'm not sure the flow looks nigh identical for that many cases like this. The way I remember learning Emacs basics many years ago was actually through menus. Looking at Emacs's menus now, in v27.2, they're...kind of eclectic? The basics are there, but a lot, well, isn't. BBEdit is admittedly somewhat at the other extreme, with possibly just too damn much in its menus, but that does make a lot of its functionality very easily discoverable.

At any rate, I should be clear that I think this is a mild knock against Emacs; I bounce off it in part because of this relative lack of discoverability, and also because it just seems like it takes a lot of effort relative to most other editors to set up comfortably. The flip side of that is that, as the "Lock-In Effect" article notes, once you do have it set up the way you like it, you are probably never going to have any motivation to switch. That is absolutely not a knock -- it's configurable and extensible in a way nothing else is.

Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by flurie on Friday August 06, 2021 @08:40PM (#28094505)
> Even the current version of Emacs doesn't do fuzzy completion for M-x commands, just start-of-token completion; out of the box the completion is a little basic. I know there are packages which make this a lot better, but you have to know about the packages. :)

This is not quite true.

The minibuffer, which is what vanilla Emacs uses for M-x command completion, has a set of completion styles, ordered by preference. You can find the full set of completion categories supported by Emacs in the variable completion-styles-alist. Among those is one called flex, which allows for full fuzzy matching between provided tokens.

This is not a default minibuffer completion style, but it provided without additional packages. One would add it by adding it to the list of completion styles used by the minibuffer as specified by the variable completion-styles. I recommend trying it out.

Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by chipotle_coyote on Friday August 06, 2021 @09:52PM (#28094961)
Interesting! It still doesn't quite shake my suspicion that the best documentation for Emacs is "find somebody else who knows more about Emacs than you do," but to be fair that's not unique to Emacs. :)
Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by flurie on Friday August 06, 2021 @10:31PM (#28095157)
Honestly, I wouldn't have been able to tell you this two weeks ago. I know all this now because completions in a language I don't normally use felt off somehow, and figuring out the solution involved going deep on how Emacs handles completions. That ended up not being relevant to the root cause, which was a change in Doom causing snippets to be overvalued in LSP completion, but at least I know a lot more about vanilla completion methods now!
Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by yissp on Friday August 06, 2021 @09:56PM (#28094984)
This is a helpful tip, but I feel like it kinda reinforces the broader point about emacs's lack of discoverability. I've been using it for years and wasn't aware of this feature until today.
Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by Jtsummers on Friday August 06, 2021 @10:43PM (#28095222)

  M-x customize-apropos some-string
This is how I've discovered most things outside of just reading the documentation (and usually I go to the documentation once I find it). It's also helpful that the info pages in emacs are also searchable with:

  M-x info-apropos some-string
Both are kind of firehoses, but C-s inside the resulting buffer can usually narrow it down pretty quickly.

I'd like to know what other editors have a discovery system like this built-in.

Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by taeric on Friday August 06, 2021 @08:45PM (#28094540)
TIL. Planning to play with that in the near future. Thanks!
Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by taeric on Friday August 06, 2021 @08:22PM (#28094393)
Right, I was assuming something like helm or ivy. I only have experience with helm.

I should also highlight that I think folks should lean on apropos way more than they typically do.

Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by chipotle_coyote on Friday August 06, 2021 @09:54PM (#28094972)
Apropos is definitely a great feature!
Re:The Emacs Lock-In Effect or the Emacs Sunk Cost Fallacy by ashton314 on Friday August 06, 2021 @07:26PM (#28093976)
I'll second this. Take a look at Vertico [1] and Consult [2] which really improve discoverability. Other nice packages (links found on the Vertico page) include Marginalia and Orderless.

[1]: https://github.com/minad/vertico

[2]: https://github.com/minad/consult