reddit / emacs
Coming from vim, emacs prompts too much in a way not all of the prompts can be disabled
LowCom · 2022-06-20 06:15
Here are a few examples.
Search and replace is a single command in vim. You type
:s/text/TextToReplace
and you are done.
The same command also also accepts regex without the need to have seperate command for that.
Emacs uses query search and replace which prompts 2 times for the main text and then the text to replace. And then if you want to use regex to replace, you have to use a different command.
Command to kill buffer prompts for which buffer to kill, although almost always you want to kill the current one.
:bd just kills the current buffer in vim.
Many alt-x commands prompt too much asking for each argument, instead of just allowing all the arguments to be entered in one line.
I know some of these can be customised and eliminated but this seems to be a general trend. I read that one of the vim design principles was to prompt user as little as possible allowing user to do much non interactively while emacs seems to encourage lot of spoon feeding to new/ begginer users.
Not to mention, settting the option of shorter prompts (y or n instead of yes and no), disabling some prompts made my emacs experience much better. Also disabling the splash screen, startup tutorial, and changing the scratch buffer message to something much shorter. All these changes had to be done to get a more elegant experience.
avindroth · 2022-06-20 06:26
I’ll just say that interactivity isn’t just for new users. This is obvious from UX standpoint, but take selectrum or marginalia. They effectively change the interface to make the experience much more pleasurable through hints. (Also just plain ‘interactive’ is one of my favorite features of elisp).
Neovim has an analogue to this (iirc, Telescope). It seems to be one of the most loved packages of neovim.
alternateved · 2022-06-20 06:30
Well, you gotta start somewhere.
I do not feel prompted too often. I do not use query and replace as a lot can be done much faster and less verbose with other tools (iedit, multiple-cursors, kmacros). For kill buffer I've remapped that binding to kill this buffer. And the rest feels just right.
I do appreciate that in almost every moment I could get an insight what particular keybinding does or what particular function needs.
SlowValue · 2022-06-20 07:59
> And then if you want to use regex to replace, you have to use a different command.
This gets even "worse", because there are all kinds of packages out there which modify search behavior. So eventually there are commands to search with Perl Regexps or Lisp-like Regexps and there are commands which use a completely redesigned UI, that's just awful many commands ...
But on the other hand Emacs gives you the opportunity to change its behavior to the way you like. And if there is nothing available it is easy to write a piece of code ....
> I know some of these can be customised and eliminated but this seems to be a general trend. I read that one of the vim design principles was to prompt user as little as possible allowing user to do much non interactively while emacs seems to encourage lot of spoon feeding to new/ begginer users.
Is Vims behavior the non plus ultra? Not for every one, I would say.
Emacs has a different philosophy, so what?
There are many Emacs commands, which I only use once per month (or less often), I'm glad I do not have to remember everything and Emacs (sometimes) guides me through. Stuff I use often is already modified (if it was not appropriate) by my own lisp code. Emacs is a tinkerers editor, you simply _make_ it behave the way you like, and that's easy. Create and publish your own modification package, for everyone who thinks like you and maybe (or maybe not) you'll find some accomplice to improve that.
> All these changes had to be done to get a more elegant experience.
It was easy to change those (after the inital learning curve), wasn't it?
xtifr · 2022-06-20 08:05
What's the big deal about being prompted? It doesn't make any real difference in how the command operates. You don't even have to *look* at the prompt if you don't want to! It makes things easier for newbies without *any* negative impact for experienced users!
Vi was optimized for a 300 baud modem, when a prompt could take a noticeable fraction of a second to appear, but it's been *many* years since I had to deal with 300 baud modems! Today, a prompt that blinks up instantaneously has *zero* impact on performance!
As for having both regex and plain search, well, sometimes regex is useful and necessary, and sometimes it's just plain annoying. Why *not* offer both? Not offering both is simply a sign that your program is inferior! (And that applies whether it's regex or non-regex you offer.) Also, separating the search string from the replace string allows you to have separate histories for each, which can often be *extremely* useful!
Now, you might *almost* have a point about `kill-buffer`, but you can make a special `kill-this-buffer` command if you want. But it only saves you a single keystroke, since `kill-buffer` *defaults* to killing the current buffer. I don't see the point. (And honestly, I rarely bother to kill buffers until there's enough of them piled up to justify using `list-buffers` or `ibuffer` for cleanup.)
b3n · 2022-06-20 11:41
In Vim you type `:` to start an ex command, and you are at a prompt to type in the command you want.
So in your Vim example, you type `:` to open up a prompt, then `b d RET` to kill the current buffer. In Emacs you type `C-x k` to open up a prompt, and then `RET` to kill the current buffer. A single prompt for each.
I mean if you really want to do it in a more ex-like way then just type `M-: (kill-buffer)` for example. But I'm not sure why you'd want to do it like that.
notperm · 2022-06-20 11:52
So uhh... use vim? Vim (and Neovim) is/are awesome but they they aren't emacs. I know that I use emacs because there are things about vim that I just can't get used to or don't like. If emacs feels that way for you, vim is an extremely robust and capable tool.
Gallipo · 2022-06-20 11:53
>this seems to be a general trend
Yes, I think emacs and vim are conceptually different in this. That means there is no one-stop-solution for this if you think of it as a problem (Well there is evil-mode).
I'm sure that among emacs-users you will find some that love or hate this and the whole spectrum between. Thus you are not the first to criticize this, but so far the consensus about emacs' UX-design (developers of emacs and emacs-packages tend to follow it) hasn't changed. So it is not likely to change in the future.
Of course you can customize everything, but working against a "general trend" is cumbersome. Emacs is only one program, it can not be perfect for everybody. My personal experience (with emacs in general, not only it's promts) is a loop of getting-annoyed, getting-used-to-it and customize. I learned to love it.
Anyway, for me emacs is such a useful tool that it's easy to live with some rough edges.
onetom · 2022-06-20 11:54
I was just about to point out the similarity between `:` and `M-:`. they are even the same letter...
avoiding multiple prompts, is a valid reason for using `M-:`, but I'd also question it's usefulness.
BettaGeorge · 2022-06-20 12:26
I do not quite get your point. Are you complaining? In that case, just disable the prompts. Emacs focuses on customisability over out-of-the-box experience. If you do not like customising your editor, then emacs is probably not for you and you would be happier with vim, which has a great out-of-the-box experience.
yurikhan · 2022-06-20 13:33
The big deal with prompting is that you have no way to fix typos you made in a response to one of the previous prompts. If you intend an `M-%` `bar` `RET` `quux` `RET`, and inadvertently start with `M-%` `baz` `RET` and then catch yourself “oops I meant `bar`”, then your only option is to cancel the whole command and start over. This becomes progressively more painful with each additional prompt.
Compare with every GUI-dialog-based application over there: you just press Shift+Tab to move back to the previous prompt, fix your typo, and move on.
----
There is also a tendency to ask for a thing’s name, as opposed to invoking a command with in the context of a thing. As much as possible, I try to use the latter. I practically never do a `C-x C-f` on an existing — instead, I select a file in Dired and open it with `RET`. I don’t kill buffers by name with `C-x k` — I either kill the current buffer with a custom-made command, or open up Ibuffer, then mark one or more buffers with `d` and kill them with `x`. Basically, I want to see lists of possible things to act on, rather than remember their names.
Extension_Try_6870 · 2022-06-20 14:24
In emacs, you can also do :s/text/TextToReplace with evil.
artyhedgehog · 2022-06-20 14:39
> I try to use the latter
> I select a file
Thing is, the key here is "I". That's how _you_ use all those tools. Someone else uses it differently. Emacs' solution is to give you the freedom to choose. And if you want to _improve_ how _you_ use it - you can do it via setting some variables, functions, key bindings, etc. in you emacs config.
Hell, you can even turn emacs much into vim by using evil-mode or some predefined configs (Doom, Spacemacs) with more tweaks out of the box _and_ still the freedom to reconfigure what you want differently.
notoriouslyfastsloth · 2022-06-20 18:09
its emacs just make it the way you want it
SlowValue · 2022-06-20 18:42
> I want to see lists of possible things to act on, rather than remember their names.
Have a look at those comfy completion frameworks, like [ivy/swiper/counsel/ivy-rich](https://github.com/abo-abo/swiper) or [helm](https://github.com/emacs-helm/helm) or [vertico/consult/embark/marginalia](https://github.com/minad/vertico)
dalanicolai · 2022-06-20 19:10
That's because Emacs actually makes an effort to be somewhat user friendly.
New users coming from vim should probably just start with Spacemacs (or Doom), it gets rid of the cumbersome 'default' workflow, and replaces it with a workflow better than vim's. Now you can choose from Emacs and Vim options... and `SPC b d` definitely works even better than `:bd RET`.
b3n · 2022-06-20 20:16
You don't even need to install any third-party packages like Evil, as Emacs comes with `viper-ex` built in which lets you do exactly this. Just `(require 'viper)` and then `M-x viper-ex`.
Ghosty141 · 2022-06-20 21:05
What I find very useful is having a kill-this-buffer function bound to a key. If I need to close multiple buffers ibuffers and projectile's kill buffer function is better suited.
xtifr · 2022-06-20 21:18
Yes, you have to start over in the *rare* case that a command has more than one prompt. Fortunately, there's usually a history associated with the prompts, so you don't have to *retype* something if editing it would be easier. Thus, in practice, the impact is minimal.
_viz_ · 2022-06-21 02:57
No need for those, press TAB enough times and you will get the *Completions* buffer with all the possible candidates.
klikklakvege · 2022-06-21 23:04
I had similar problems with emacs in the beginning and wrote a post here with the title i think "why does emacs suck so much?". It was about all the little annoyances with vanilla emacs
I figured out how to setup stuff in emacs and do really love emacs now.
There is no other tool in the universe that is so easy to customize. You set up a keyboard shortcut with one line of code. You set hooks up with one line and you set global variables with one line.
I recently found the emacs config of an ex vimmer that you can take a look at:
[https://writequit.org/eos/eos.html](https://writequit.org/eos/eos.html)
Once you set up stuff in emacs the way you like it you'll have it the way you like it for the rest of your life. An "elegant experience" meant something different in the 80ties and something different now. Something different for you and something different for me.
For killing buffers I have
`(global-set-key (kbd "C-q") 'kill-buffer-and-window)`
That gets also rid of a splitted window. It's really one line of code for one annoyance. And it usually can be done with copy&paste from the web.
I really think that you will like and love emacs as I do.You already got rid of some annoyances yourself and are demanding on how your workspace looks like. No other tool gives you that many possibilities to change it as emacs does.
LowCom · 2022-06-22 02:11
Yeah agree with most of what you wrote. Thanks.
(global-set-key (kbd "C-q") 'kill-buffer-and-window)
But won't this fail if this is the only window remaining? And then you won't be able to kill the buffer and it would complain about deleting the last remaining window.
lovela47 · 2022-06-23 16:18
One way to get the analogous behavior (non-interactive replace) in emacs is to type `M-:` and enter the following lisp code
(replace-regexp "some.regular?expression+" "TextToReplace" nil (point-min) (point-max))
To do it without regex and just strings, use
(replace-string "text" "TextToReplace" nil (point-min) (point-max))
I am not claiming this is as terse as vim/ex of course! Hope it's somewhat useful
bonus: once you've typed these commands in using `M-:`, the next time you type `M-:`, if you then type `M-r` you can search backward to find them in the history, and edit the string/regex to match the new situation
trimorphic · 2022-06-30 21:19
I just use evil and, at least for your first example of search and replace, Emacs on my system behaves exactly like vim.
I also actually like being required to type "yes" instead of just "y", because it makes me slow down a little, giving me a bit more time to think and makes the operation I'm being prompted for confirmation on just a little bit safer.
I'm sure it's possible to change the prompt to accept just "y", if it's important to you.