[Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Soni "They/Them" L.
Hi! As you may or may not know, Lua uses _PROMPT and _PROMPT2 in the
standard REPL (indeed, it's described in the reference manual).

Their default values, e.g. when unset, are "> " and ">> ". There are
some reasons why this isn't good:

1. Terminals have block selection mode (hold control while selecting).
The different widths makes this difficult.
2. That's about the only reason.

I propose we change this so the default/fallback _PROMPT and _PROMPT2
are ">  " and ">> " respectively, i.e. they have the same width by
default. This would work really well with block selection.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.


Reply | Threaded
Open this post in threaded view
|

Re: [Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Dirk Laurie-2
2018-02-03 18:11 GMT+02:00 Soni "They/Them" L. <[hidden email]>:

> Hi! As you may or may not know, Lua uses _PROMPT and _PROMPT2 in the
> standard REPL (indeed, it's described in the reference manual).
>
> Their default values, e.g. when unset, are "> " and ">> ". There are some
> reasons why this isn't good:
>
> 1. Terminals have block selection mode (hold control while selecting). The
> different widths makes this difficult.
> 2. That's about the only reason.
>
> I propose we change this so the default/fallback _PROMPT and _PROMPT2 are ">
> " and ">> " respectively, i.e. they have the same width by default. This
> would work really well with block selection.

There is of course the obvious (to Linux users) workaround,

    alias lua="lua -e \"_PROMPT, _PROMPT2 = whatever\" -i "

which caters also for the case where someone does not like your proposal.
For example, some time ago someone on this list proposed ';' instead of '>'
which has the advantage that you can cut-and-paste from actual session
output without causing syntax errors. Personally, I like whitespace best.

Reply | Threaded
Open this post in threaded view
|

Re: [Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Egor Skriptunoff-2
On Sat, Feb 3, 2018 at 7:44 PM, Dirk Laurie wrote:
2018-02-03 18:11 GMT+02:00 Soni "They/Them" L.:
> I propose we change this so the default/fallback _PROMPT and _PROMPT2 are ">
> " and ">> " respectively, i.e. they have the same width by default. This
> would work really well with block selection.

For example, some time ago someone on this list proposed ';' instead of '>'
which has the advantage that you can cut-and-paste from actual session
output without causing syntax errors. Personally, I like whitespace best.


Yes, I like it too: "; " and "  " (for _PROMPT and _PROMPT2 respectively) would allow to copy-paste multiline REPL command (using simple text selection, no need to hold Ctrl+Alt) to a .lua file without need for removing all those ">" to make Lua syntax correct.

Reply | Threaded
Open this post in threaded view
|

Re: [Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Russell Haley
In reply to this post by Soni "They/Them" L.
Sorry for the top post.

I'm not sure I'm keen on this solution but the cut paste struggle is 'real'. 

I either loose the first character or have to delete all the extra chevrons. The extra space would mean I have to delete two spaces when I copy one liners. 

If I'm honest the space between the REPL and the first character bugs me too. ‎

My preference would instead consist of  being able to dump the console history for the session or even just the last successful chunk:

Print_last_chunk()
Save_last_chunk(filename)

(The capital letters in the names are my email clients idea).

I'll bet that's already an available pattern.  If I were implementing it I would add a console class that has various facilities only available through interactive mode. 

I expect Steve Donavan to pipe up here and say he's got that written somewhere. I seem to think of things he's already invented. :P 

Russ

Sent from my BlackBerry 10 smartphone on the Virgin Mobile network.
  Original Message  
From: Soni "They/Them" L.
Sent: Saturday, February 3, 2018 8:11 AM
To: Lua mailing list
Reply To: Lua mailing list
Subject: [Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Hi! As you may or may not know, Lua uses _PROMPT and _PROMPT2 in the
standard REPL (indeed, it's described in the reference manual).

Their default values, e.g. when unset, are "> " and ">> ". There are
some reasons why this isn't good:

1. Terminals have block selection mode (hold control while selecting).
The different widths makes this difficult.
2. That's about the only reason.

I propose we change this so the default/fallback _PROMPT and _PROMPT2
are ">  " and ">> " respectively, i.e. they have the same width by
default. This would work really well with block selection.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.



Reply | Threaded
Open this post in threaded view
|

Re: [Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Rena

On Feb 3, 2018 12:01 PM, "Russell Haley" <[hidden email]> wrote:
Sorry for the top post.

I'm not sure I'm keen on this solution but the cut paste struggle is 'real'. 

I either loose the first character or have to delete all the extra chevrons. The extra space would mean I have to delete two spaces when I copy one liners. 

If I'm honest the space between the REPL and the first character bugs me too. ‎

My preference would instead consist of  being able to dump the console history for the session or even just the last successful chunk:

Print_last_chunk()
Save_last_chunk(filename)

(The capital letters in the names are my email clients idea).

I'll bet that's already an available pattern.  If I were implementing it I would add a console class that has various facilities only available through interactive mode. 

I expect Steve Donavan to pipe up here and say he's got that written somewhere. I seem to think of things he's already invented. :P 

Russ

Sent from my BlackBerry 10 smartphone on the Virgin Mobile network.
  Original Message  
From: Soni "They/Them" L.
Sent: Saturday, February 3, 2018 8:11 AM
To: Lua mailing list
Reply To: Lua mailing list
Subject: [Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Hi! As you may or may not know, Lua uses _PROMPT and _PROMPT2 in the
standard REPL (indeed, it's described in the reference manual).

Their default values, e.g. when unset, are "> " and ">> ". There are
some reasons why this isn't good:

1. Terminals have block selection mode (hold control while selecting).
The different widths makes this difficult.
2. That's about the only reason.

I propose we change this so the default/fallback _PROMPT and _PROMPT2
are ">  " and ">> " respectively, i.e. they have the same width by
default. This would work really well with block selection.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.



Ideally, you could enclose the prompt in formatting codes that tell the terminal emulator to not copy it by default. However I don't know of any that have such a feature.

Reply | Threaded
Open this post in threaded view
|

Re: [Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Daurnimator
In reply to this post by Dirk Laurie-2
On 3 February 2018 at 08:44, Dirk Laurie <[hidden email]> wrote:
> There is of course the obvious (to Linux users) workaround,
>
>     alias lua="lua -e \"_PROMPT, _PROMPT2 = whatever\" -i "
>
> which caters also for the case where someone does not like your proposal.

I find aliases clunky. Instead I use LUA_INIT (I just add a bit of
colour) from my .bashrc:

export LUA_INIT='_PROMPT="\1\27[32;1m\2>\1\27[0m\2 ";
_PROMPT2="\1\27[36;1m\2>>\1\27[0m\2 "'

Reply | Threaded
Open this post in threaded view
|

Re: [Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Paige DePol
Daurnimator <[hidden email]> wrote:

> On 3 February 2018 at 08:44, Dirk Laurie <[hidden email]> wrote:
>> There is of course the obvious (to Linux users) workaround,

Not technically just Linux users, but anyone who uses a shell that supports
aliases. Bash seems to be available under pretty much every operating system
these days. The git package from Google for Windows even comes with a very
nice terminal with bash (and other utilities) included.

>>   alias lua="lua -e \"_PROMPT, _PROMPT2 = whatever\" -i "
>>
>> which caters also for the case where someone does not like your proposal.
>
> I find aliases clunky. Instead I use LUA_INIT (I just add a bit of
> colour) from my .bashrc:
>
> export LUA_INIT='_PROMPT="\1\27[32;1m\2>\1\27[0m\2 ";
> _PROMPT2="\1\27[36;1m\2>>\1\27[0m\2 "'

Why do you find aliases clunky, if I may ask? What do you use instead?

I just checked my bash profile and I seems I have 42 defined aliases and
a dozen or so functions in there. Apparently I love aliases! ;)

~Paige


Reply | Threaded
Open this post in threaded view
|

Re: [Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Daurnimator
On 3 February 2018 at 10:34, Paige DePol <[hidden email]> wrote:
> Why do you find aliases clunky, if I may ask?

They only affect interactive shells. This means that:
  - I can't run them from other places. e.g. os.execute("somealias")
  - `which myalias` doesn't entirely tell the truth
  - Copying a shell session to a shell script for
automation/repeatability isn't a true replication
  - When using other shells/environments they don't work

> What do you use instead?

I rarely need them.
On the rare occasion I need an extra command I write a shell
script/lua script and put it in ~/.local/bin (which is in my PATH)

> I just checked my bash profile and I seems I have 42 defined aliases and
a dozen or so functions in there. Apparently I love aliases! ;)

I apparently have two:

  - alias ls='ls --color=auto'
  - alias rm='rm --one-file-system'

Reply | Threaded
Open this post in threaded view
|

Re: [Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Paige DePol
Daurnimator <[hidden email]> wrote:

> On 3 February 2018 at 10:34, Paige DePol <[hidden email]> wrote:
>> Why do you find aliases clunky, if I may ask?
>
> They only affect interactive shells. This means that:
>  - I can't run them from other places. e.g. os.execute("somealias")
>  - `which myalias` doesn't entirely tell the truth
>  - Copying a shell session to a shell script for
> automation/repeatability isn't a true replication
>  - When using other shells/environments they don't work

All valid points. I guess I just use aliases specifically
to create alternate interactive commands essentially.


>> What do you use instead?
>
> I rarely need them.
> On the rare occasion I need an extra command I write a shell
> script/lua script and put it in ~/.local/bin (which is in my PATH)

Yea, I have a bunch of things in /usr/local/bin as well. I really
should convert the bash functions I have into actual scripts.


>> I just checked my bash profile and I seems I have 42 defined aliases and
> a dozen or so functions in there. Apparently I love aliases! ;)
>
> I apparently have two:
>
>  - alias ls='ls --color=auto'
>  - alias rm='rm --one-file-system'

I have a color alias for 'ls' as well. Hmm, my 'rm' doesn't seem to
support the --one-file-system flag, which isn't a surprise as macOS
uses the BSD tools and not the GNU ones. It does seem like a very
useful option to have enabled by default though!

~Paige


Reply | Threaded
Open this post in threaded view
|

Re: [Proposal] Change default _PROMPT from "> " to "> " (two spaces)

Tony Papadimitriou
In reply to this post by Soni "They/Them" L.
I've always used:

Lua>
...>

same width, and I'm reminded in which shell I'm in.

-----Original Message-----
From: Soni "They/Them" L.

Hi! As you may or may not know, Lua uses _PROMPT and _PROMPT2 in the
standard REPL (indeed, it's described in the reference manual).

Their default values, e.g. when unset, are "> " and ">> ". There are
some reasons why this isn't good:

1. Terminals have block selection mode (hold control while selecting).
The different widths makes this difficult.
2. That's about the only reason.