Re: mg: how to indent using spaces instead of tabs

2022-06-12 Thread Luke A. Call
On 2022-06-12 18:16:15+0300, Mihai Popescu  wrote:
> > ... mg will use a tab for indentation.
> 
> Use something to replace every TAB occurrence in the source code with
> 8 spaces sequence. Well, not every TAB maybe?

man expand, unexpand(1) exists.



Re: mg: how to indent using spaces instead of tabs

2022-06-12 Thread Jeff Ross




On 6/12/22 9:16 AM, Mihai Popescu wrote:

... mg will use a tab for indentation.

Use something to replace every TAB occurrence in the source code with
8 spaces sequence. Well, not every TAB maybe?


man 1 expand



Re: mg: how to indent using spaces instead of tabs

2022-06-12 Thread Mihai Popescu
> ... mg will use a tab for indentation.

Use something to replace every TAB occurrence in the source code with
8 spaces sequence. Well, not every TAB maybe?



Re: mg: how to indent using spaces instead of tabs

2022-06-07 Thread obsdml



> On Jun 5, 2022, at 4:24 AM, Sam Lee  wrote:
> 
> On 2022-06-05 10:58 +0200, Omar Polo wrote:
>> M-x no-tab-mode RET seems to work (as long as you don't want to change
>> the width of the `expandtab'; it always align to the nearest multiple
>> of 8)
> 
> How do people write Python programs using mg?
> Python requires 4 space indentation ...

I have to say it...
Technically Python _requires_ any white space indentation, but the PEP 8 
readability guidelines recommend sticking to four spaces.  Google sticks to two 
spaces.  I write prototype code in two spaces and code I intend to re-read at 
some point with four spaces (the “serious” stuff.)   Some people use tabs, but 
they use tabs throughout.  Mixing tabbed and spaced indenting is horrific in an 
indent specified language.



Re: mg: how to indent using spaces instead of tabs

2022-06-05 Thread Omar Polo
Sam Lee  wrote:
> On 2022-06-05 10:58 +0200, Omar Polo wrote:
> > M-x no-tab-mode RET seems to work (as long as you don't want to change
> > the width of the `expandtab'; it always align to the nearest multiple
> > of 8)
> 
> How do people write Python programs using mg?
> Python requires 4 space indentation ...

and lua uses three spaces.  i guess there aren't a lot of people writing
in these languages with mg, or maybe they don't use auto-indent-mode?
dunno.  personally i use mg mainly for configuration files and C, as i
find it sometimes more "comfy" than Emacs itself :)

The good thing tho is that you have the sources (/usr/src/usr.bin/mg
assuming you have a checkout in /usr/src.)

You can add -DNOTAB in the Makefile to enable it, then grep for NOTAB
and see how to allow using a different tab width per buffer.  Then
you'll have a diff for it, so you're issue will be solved, and you can
share it on tech@ (cc'ing lum@).  I for one would be happy to review
such a diff, even if I can't give a meaningful OK.



Re: mg: how to indent using spaces instead of tabs

2022-06-05 Thread Omar Polo
Omar Polo  wrote:
> Sam Lee  wrote:
> > In the mg text editor, how do I indent using spaces instead of tabs?
> > If I enable auto-indent-mode, mg uses tabs to indent. Is there
> > something like Vim and nvi's 'expandtab' option that makes mg indent
> > using spaces instead of tabs?
> 
> there isn't an `expandtab' for mg.
> 
> there is some code in mg to handle that, but it's hidden under some
> #ifdef NOTAB and probably not complete and maybe doesn't even compile.

actually, i was wrong.  it's true that the relevant code is hidden under
#ifdef NOTAB and not enabled by default, but it compiles fine and M-x
no-tab-mode RET seems to work (as long as you don't want to change the
width of the `expandtab'; it always align to the nearest multiple of 8)



Re: mg: how to indent using spaces instead of tabs

2022-06-05 Thread Omar Polo
Sam Lee  wrote:
> In the mg text editor, how do I indent using spaces instead of tabs?
> If I enable auto-indent-mode, mg uses tabs to indent. Is there
> something like Vim and nvi's 'expandtab' option that makes mg indent
> using spaces instead of tabs?

there isn't an `expandtab' for mg.

there is some code in mg to handle that, but it's hidden under some
#ifdef NOTAB and probably not complete and maybe doesn't even compile.