When working with Erlang, the shell is central to a lot of the work that we do. It is where most of us started out when learning Erlang and it is where we have spent countless hours trying to debug issues in production.
For Erlang/OTP 26, we are going to take a close look at the shell and see what we can improve in there. There are already a lot of issues at the Erlang/OTP github tracker related to problems with the shell and we intend to address as many of those as we can. However, we do not only want to look at fixing current bugs, but also expand what the shell does today.
The kernel application allows configuration of a shell history. You can enable it using erl -kernel shell_history enabled, or setting ERL_FLAGS=-kernel shell_history enabled. Is this what you mean, or something different?
Ctrl+L today in the shell redraws the current line, which is a feature I find very handy when logger/dbg is printing things to stdout as I type. I would not like it if that feature went away.
Btw, Ctrl+L in my shell sets the cursor to be at the top left, while clear clears that history buffer as well. I assume you would like Ctrl+L to do the first option, but thought I would double-check to make sure.
It’s tricky, but essentially would require modal editing (hence why I don’t think it would be realistic to expect it).
So instead of pressing ctrl+a to go to the beginning of the line or ctrl+e to go to the end, I switch from insert mode to edit mode and press 0 or $.
Common commands in edit mode include things such as ct" which means "change the content from the current cursor until the next "" and switches back to insert mode.
I frankly have no idea how the same shell code can be made to switch from one to the other; I just know that I looked at how it was handled in the current one and it was very much impossible. I also know pretty much nobody uses that sort of shortcuts, so I wouldn’t be mad not to see it, that’s the usual.
Yeah, I think that the “as I type” mode is the most useful one, particularly around things like whether I’m still stuck in a string (or quoted atom), and in some cases matching on closing parens or brackets.
Suggestions for function arguments are probably the trickiest one, possibly based on type names if that is carried.
And yes, Ctrl+L clears the terminal and insert a new prompt. This behaviour is incredibly common for all shells — system or language — I ever used. Some advanced shells such as zsh even keep what was currently typed in the current prompt line.
Not having it means the only way to clear the mess is to exit and re-start the Erlang shell. This is a constant annoyance.
If filename is specified, the file is edited; after the editor exits, the file’s content is copied into the current query buffer. If no filename is given, the current query buffer is copied to a temporary file which is then edited in the same fashion. Or, if the current query buffer is empty, the most recently executed query is copied to a temporary file and edited in the same fashion.
If we could implement this you could get something close, but since it would open up a new vi session you would not be able to view the current content of the terminal at the same time. Unless you set EDITOR=“xterm vi”… not sure how useful something like that would be.
I tend to agree with @dszoboszlay, copy and paste is a great argument.
However, if we decided not to have any prompt
Its difficult to tell if the function is stuck/executing or if I forgot to complete the expression with ‘.’.
Some kind of indication is necessary (IMO) to help new adopters to make that distinction.
Can probably be solved by cleverly using colors.
What I’d like to see in the shell is that it would be possible to apply parse transforms to the typed commands. Maybe something similar to how records are handled, where you read records with rr() and the shell remembers the record definitions, in the same vein, you’d be able to specify which parse transforms you’d like the shell to invoke on the typed input. The later should be also configurable through given user_default or shell_default modules.