linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] streamline_config.pl: Fix Perl spacing
@ 2021-03-22 21:38 Steven Rostedt
  2021-03-22 21:38 ` [PATCH 1/2] streamline_config.pl: Make spacing consistent Steven Rostedt
  2021-03-22 21:38 ` [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users Steven Rostedt
  0 siblings, 2 replies; 11+ messages in thread
From: Steven Rostedt @ 2021-03-22 21:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-kbuild, Masahiro Yamada, Andrew Morton, John (Warthog9) Hawley


Talking with John Hawley about how vim and emacs deal with Perl files
with respect to tabs and spaces, I found that some of my Perl code in
the kernel had inconsistent spacing. The way emacs handles Perl by default
is to use 4 spaces per indent, but make all 8 spaces into a single tab.
Vim does not do this by default. But if you add the vim variable control:

 # vim: softtabstop=4

to a perl file, it makes vim behave the same way as emacs.

The first patch is to change all 8 spaces into a single tab (mostly from
people editing the file with vim). The next patch adds the softtabstop
variable to make vim act like emacs by default.

Steven Rostedt (VMware) (2):
      streamline_config.pl: Make spacing consistent
      streamline_config.pl: Add softtabstop=4 for vim users

----
 scripts/kconfig/streamline_config.pl | 80 ++++++++++++++++++------------------
 1 file changed, 41 insertions(+), 39 deletions(-)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] streamline_config.pl: Make spacing consistent
  2021-03-22 21:38 [PATCH 0/2] streamline_config.pl: Fix Perl spacing Steven Rostedt
@ 2021-03-22 21:38 ` Steven Rostedt
  2021-03-22 21:38 ` [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users Steven Rostedt
  1 sibling, 0 replies; 11+ messages in thread
From: Steven Rostedt @ 2021-03-22 21:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-kbuild, Masahiro Yamada, Andrew Morton, John (Warthog9) Hawley

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

As Perl code tends to have 4 space indentation, but uses tabs for every 8
spaces, make that consistent in the streamline_config.pl code.
Replace all 8 spaces with a single tab.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 scripts/kconfig/streamline_config.pl | 78 ++++++++++++++--------------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 1c78ba49ca99..059061b6daef 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -601,12 +601,12 @@ if (defined($ENV{'LMC_KEEP'})) {
 sub in_preserved_kconfigs {
     my $kconfig = $config2kfile{$_[0]};
     if (!defined($kconfig)) {
-        return 0;
+	return 0;
     }
     foreach my $excl (@preserved_kconfigs) {
-        if($kconfig =~ /^$excl/) {
-            return 1;
-        }
+	if($kconfig =~ /^$excl/) {
+	    return 1;
+	}
     }
     return 0;
 }
@@ -629,52 +629,52 @@ foreach my $line (@config_file) {
     }
 
     if (/CONFIG_MODULE_SIG_KEY="(.+)"/) {
-        my $orig_cert = $1;
-        my $default_cert = "certs/signing_key.pem";
-
-        # Check that the logic in this script still matches the one in Kconfig
-        if (!defined($depends{"MODULE_SIG_KEY"}) ||
-            $depends{"MODULE_SIG_KEY"} !~ /"\Q$default_cert\E"/) {
-            print STDERR "WARNING: MODULE_SIG_KEY assertion failure, ",
-                "update needed to ", __FILE__, " line ", __LINE__, "\n";
-            print;
-        } elsif ($orig_cert ne $default_cert && ! -f $orig_cert) {
-            print STDERR "Module signature verification enabled but ",
-                "module signing key \"$orig_cert\" not found. Resetting ",
-                "signing key to default value.\n";
-            print "CONFIG_MODULE_SIG_KEY=\"$default_cert\"\n";
-        } else {
-            print;
-        }
-        next;
+	my $orig_cert = $1;
+	my $default_cert = "certs/signing_key.pem";
+
+	# Check that the logic in this script still matches the one in Kconfig
+	if (!defined($depends{"MODULE_SIG_KEY"}) ||
+	    $depends{"MODULE_SIG_KEY"} !~ /"\Q$default_cert\E"/) {
+	    print STDERR "WARNING: MODULE_SIG_KEY assertion failure, ",
+		"update needed to ", __FILE__, " line ", __LINE__, "\n";
+	    print;
+	} elsif ($orig_cert ne $default_cert && ! -f $orig_cert) {
+	    print STDERR "Module signature verification enabled but ",
+		"module signing key \"$orig_cert\" not found. Resetting ",
+		"signing key to default value.\n";
+	    print "CONFIG_MODULE_SIG_KEY=\"$default_cert\"\n";
+	} else {
+	    print;
+	}
+	next;
     }
 
     if (/CONFIG_SYSTEM_TRUSTED_KEYS="(.+)"/) {
-        my $orig_keys = $1;
-
-        if (! -f $orig_keys) {
-            print STDERR "System keyring enabled but keys \"$orig_keys\" ",
-                "not found. Resetting keys to default value.\n";
-            print "CONFIG_SYSTEM_TRUSTED_KEYS=\"\"\n";
-        } else {
-            print;
-        }
-        next;
+	my $orig_keys = $1;
+
+	if (! -f $orig_keys) {
+	    print STDERR "System keyring enabled but keys \"$orig_keys\" ",
+		"not found. Resetting keys to default value.\n";
+	    print "CONFIG_SYSTEM_TRUSTED_KEYS=\"\"\n";
+	} else {
+	    print;
+	}
+	next;
     }
 
     if (/^(CONFIG.*)=(m|y)/) {
-        if (in_preserved_kconfigs($1)) {
-            dprint "Preserve config $1";
-            print;
-            next;
-        }
+	if (in_preserved_kconfigs($1)) {
+	    dprint "Preserve config $1";
+	    print;
+	    next;
+	}
 	if (defined($configs{$1})) {
 	    if ($localyesconfig) {
-	        $setconfigs{$1} = 'y';
+		$setconfigs{$1} = 'y';
 		print "$1=y\n";
 		next;
 	    } else {
-	        $setconfigs{$1} = $2;
+		$setconfigs{$1} = $2;
 	    }
 	} elsif ($2 eq "m") {
 	    print "# $1 is not set\n";
-- 
2.30.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users
  2021-03-22 21:38 [PATCH 0/2] streamline_config.pl: Fix Perl spacing Steven Rostedt
  2021-03-22 21:38 ` [PATCH 1/2] streamline_config.pl: Make spacing consistent Steven Rostedt
@ 2021-03-22 21:38 ` Steven Rostedt
  2021-03-24  6:01   ` Masahiro Yamada
  1 sibling, 1 reply; 11+ messages in thread
From: Steven Rostedt @ 2021-03-22 21:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-kbuild, Masahiro Yamada, Andrew Morton, John (Warthog9) Hawley

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The tab stop for Perl files is by default (at least in emacs) to be 4
spaces, where a tab is used for all 8 spaces. Add a local variable comment
to make vim do the same by default, and this will help keep the file
consistent in the future when others edit it via vim and not emacs.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 scripts/kconfig/streamline_config.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 059061b6daef..044829972ba5 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -702,3 +702,5 @@ foreach my $module (keys(%modules)) {
 	print STDERR "\n";
     }
 }
+
+# vim: softtabstop=4
-- 
2.30.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users
  2021-03-22 21:38 ` [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users Steven Rostedt
@ 2021-03-24  6:01   ` Masahiro Yamada
  2021-03-24 13:54     ` Steven Rostedt
  0 siblings, 1 reply; 11+ messages in thread
From: Masahiro Yamada @ 2021-03-24  6:01 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Linux Kernel Mailing List, Linux Kbuild mailing list,
	Andrew Morton, John (Warthog9) Hawley

On Tue, Mar 23, 2021 at 6:40 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>
> The tab stop for Perl files is by default (at least in emacs) to be 4
> spaces, where a tab is used for all 8 spaces. Add a local variable comment
> to make vim do the same by default, and this will help keep the file
> consistent in the future when others edit it via vim and not emacs.
>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


Documentation/process/coding-style.rst says "do not do this".

Rather, I want to remove this ugly stuff entirely.
https://lore.kernel.org/patchwork/patch/1401439/

Adding .editorconfig seems OK to me, but
Doing this in individual files in an editor-specific
manner is a horror.





> ---
>  scripts/kconfig/streamline_config.pl | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
> index 059061b6daef..044829972ba5 100755
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -702,3 +702,5 @@ foreach my $module (keys(%modules)) {
>         print STDERR "\n";
>      }
>  }
> +
> +# vim: softtabstop=4
> --
> 2.30.1
>
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users
  2021-03-24  6:01   ` Masahiro Yamada
@ 2021-03-24 13:54     ` Steven Rostedt
  2021-03-25  0:06       ` Steven Rostedt
  2021-03-25  6:20       ` Masahiro Yamada
  0 siblings, 2 replies; 11+ messages in thread
From: Steven Rostedt @ 2021-03-24 13:54 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Linux Kernel Mailing List, Linux Kbuild mailing list,
	Andrew Morton, John (Warthog9) Hawley

On Wed, 24 Mar 2021 15:01:13 +0900
Masahiro Yamada <masahiroy@kernel.org> wrote:

> On Tue, Mar 23, 2021 at 6:40 AM Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> >
> > The tab stop for Perl files is by default (at least in emacs) to be 4
> > spaces, where a tab is used for all 8 spaces. Add a local variable comment
> > to make vim do the same by default, and this will help keep the file
> > consistent in the future when others edit it via vim and not emacs.
> >
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>  
> 
> 
> Documentation/process/coding-style.rst says "do not do this".

I take that file more as for C code, never took it for Perl ;-)

> 
> Rather, I want to remove this ugly stuff entirely.
> https://lore.kernel.org/patchwork/patch/1401439/

And I totally agree it does not belong in C code.

> 
> Adding .editorconfig seems OK to me, but
> Doing this in individual files in an editor-specific
> manner is a horror.

Is there a way to add this for the directory?

The reason I added this was because of the different ways that vim and
emacs handle Perl files. I just added this to ktest.pl because I want it to
be consistent.

The emacs way to edit Perl is to have 4 space indentation, but use tabs for
every 8 spaces. That is, you have:

    (4 spaces)
	(1 tab)
	    (1 tab and 4 spaces)
		(2 tabs)
		    (2 tabs and 4 spaces)

etc.

What I found from people who edit Perl code is that they will either just
indent 8 (with tabs), or just use all spaces. Then you have:

	    (1 tab and 4 spaces)
            (followed by 12 spaces!)

The way to make vim work the same is to add the softtabspace=4 command.

We can not add this, but then have to either police the patches coming in,
or constantly clean up the code after the fact.

This code doesn't change much, so I'm fine with that. But for ktest.pl, I'm
adding it.

-- Steve

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users
  2021-03-24 13:54     ` Steven Rostedt
@ 2021-03-25  0:06       ` Steven Rostedt
  2021-03-25  6:20       ` Masahiro Yamada
  1 sibling, 0 replies; 11+ messages in thread
From: Steven Rostedt @ 2021-03-25  0:06 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Linux Kernel Mailing List, Linux Kbuild mailing list,
	Andrew Morton, John (Warthog9) Hawley

On Wed, 24 Mar 2021 09:54:17 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> This code doesn't change much, so I'm fine with that. But for ktest.pl, I'm
> adding it.

Anyway, I'm not going to ask you to take the second patch if you don't
like it, but would you take the first patch?

-- Steve

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users
  2021-03-24 13:54     ` Steven Rostedt
  2021-03-25  0:06       ` Steven Rostedt
@ 2021-03-25  6:20       ` Masahiro Yamada
  2021-03-25 13:50         ` Steven Rostedt
  1 sibling, 1 reply; 11+ messages in thread
From: Masahiro Yamada @ 2021-03-25  6:20 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Linux Kernel Mailing List, Linux Kbuild mailing list,
	Andrew Morton, John (Warthog9) Hawley

On Wed, Mar 24, 2021 at 10:54 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed, 24 Mar 2021 15:01:13 +0900
> Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> > On Tue, Mar 23, 2021 at 6:40 AM Steven Rostedt <rostedt@goodmis.org> wrote:
> > >
> > > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> > >
> > > The tab stop for Perl files is by default (at least in emacs) to be 4
> > > spaces, where a tab is used for all 8 spaces. Add a local variable comment
> > > to make vim do the same by default, and this will help keep the file
> > > consistent in the future when others edit it via vim and not emacs.
> > >
> > > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> >
> >
> > Documentation/process/coding-style.rst says "do not do this".
>
> I take that file more as for C code, never took it for Perl ;-)
>
> >
> > Rather, I want to remove this ugly stuff entirely.
> > https://lore.kernel.org/patchwork/patch/1401439/
>
> And I totally agree it does not belong in C code.
>
> >
> > Adding .editorconfig seems OK to me, but
> > Doing this in individual files in an editor-specific
> > manner is a horror.
>
> Is there a way to add this for the directory?
>
> The reason I added this was because of the different ways that vim and
> emacs handle Perl files. I just added this to ktest.pl because I want it to
> be consistent.
>
> The emacs way to edit Perl is to have 4 space indentation, but use tabs for
> every 8 spaces. That is, you have:
>
>     (4 spaces)
>         (1 tab)
>             (1 tab and 4 spaces)
>                 (2 tabs)
>                     (2 tabs and 4 spaces)
>
> etc.


The root cause of inconsistency is that
you mix up space-indentation and tab-indentation.
I do not know if it is a standard way either.

For example, scripts/checkpatch.pl uses only tabs,
which I think is more robust.

Unfortunately, we do not have standardized indentation style
for scripts yet, and people can go in any direction.

The editorconfig patch [1] proposed to always use 4-space
indentation for *.pl files.
(that is, do not replace 8 spaces with a tab).

I do not know whether the kernel will adopt .editorconfig or not,
but if that patch is applied, your 1/2 will be a step backward.

My got-feeling is, you will never reach the goal as long as
you adopt a strange indentation style, which is obscure
to other contributors.

Not all people use vim.
I am not interested in 1/2 either.

If you insist on this patch set, apply it to your tree
and send a pull request by yourself.


[1]: https://lore.kernel.org/lkml/20200703073143.423557-1-danny@kdrag0n.dev/



>
> What I found from people who edit Perl code is that they will either just
> indent 8 (with tabs), or just use all spaces. Then you have:
>
>             (1 tab and 4 spaces)
>             (followed by 12 spaces!)
>
> The way to make vim work the same is to add the softtabspace=4 command.
>
> We can not add this, but then have to either police the patches coming in,
> or constantly clean up the code after the fact.
>
> This code doesn't change much, so I'm fine with that. But for ktest.pl, I'm
> adding it.
>
> -- Steve



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users
  2021-03-25  6:20       ` Masahiro Yamada
@ 2021-03-25 13:50         ` Steven Rostedt
  2021-03-25 14:09           ` Masahiro Yamada
  2021-03-26  7:51           ` Joe Perches
  0 siblings, 2 replies; 11+ messages in thread
From: Steven Rostedt @ 2021-03-25 13:50 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Linux Kernel Mailing List, Linux Kbuild mailing list,
	Andrew Morton, John (Warthog9) Hawley

On Thu, 25 Mar 2021 15:20:13 +0900
Masahiro Yamada <masahiroy@kernel.org> wrote:

> 
> The root cause of inconsistency is that
> you mix up space-indentation and tab-indentation.
> I do not know if it is a standard way either.

This is the default way emacs has edited perl files for as long as I can
remember (back to 1996). It became my standard of editing perl files just
because of that. For everything else, I use tabs.

> 
> For example, scripts/checkpatch.pl uses only tabs,
> which I think is more robust.

Probably because Joe probably uses vim ;-)

> 
> Unfortunately, we do not have standardized indentation style
> for scripts yet, and people can go in any direction.
> 
> The editorconfig patch [1] proposed to always use 4-space
> indentation for *.pl files.
> (that is, do not replace 8 spaces with a tab).

I rather have all tabs, or the tab and spaces. I find 8 spaces to be a
waste of memory and disk space.

> 
> I do not know whether the kernel will adopt .editorconfig or not,
> but if that patch is applied, your 1/2 will be a step backward.

My 1/2 only made it consistent, as the original code had the tab/spaces mix
and just a few lines that were modified by others broke it by adding all
spaces.

> 
> My got-feeling is, you will never reach the goal as long as
> you adopt a strange indentation style, which is obscure
> to other contributors.

I'm guessing this is not strange to other perl developers who uses emacs.

> 
> Not all people use vim.

I don't use it either. I was trying to make vim match emacs. Of course for
those that use something else, it wont help. I'm curious, what's your main
editor that you use?

> I am not interested in 1/2 either.

OK.

> 
> If you insist on this patch set, apply it to your tree
> and send a pull request by yourself.

I'm fine with that.

> 
> 
> [1]: https://lore.kernel.org/lkml/20200703073143.423557-1-danny@kdrag0n.dev/

Thanks for the link.

-- Steve

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users
  2021-03-25 13:50         ` Steven Rostedt
@ 2021-03-25 14:09           ` Masahiro Yamada
  2021-03-25 15:10             ` Steven Rostedt
  2021-03-26  7:51           ` Joe Perches
  1 sibling, 1 reply; 11+ messages in thread
From: Masahiro Yamada @ 2021-03-25 14:09 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Linux Kernel Mailing List, Linux Kbuild mailing list,
	Andrew Morton, John (Warthog9) Hawley

On Thu, Mar 25, 2021 at 10:50 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Thu, 25 Mar 2021 15:20:13 +0900
> Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> >
> > The root cause of inconsistency is that
> > you mix up space-indentation and tab-indentation.
> > I do not know if it is a standard way either.
>
> This is the default way emacs has edited perl files for as long as I can
> remember (back to 1996). It became my standard of editing perl files just
> because of that. For everything else, I use tabs.
>
> >
> > For example, scripts/checkpatch.pl uses only tabs,
> > which I think is more robust.
>
> Probably because Joe probably uses vim ;-)
>
> >
> > Unfortunately, we do not have standardized indentation style
> > for scripts yet, and people can go in any direction.
> >
> > The editorconfig patch [1] proposed to always use 4-space
> > indentation for *.pl files.
> > (that is, do not replace 8 spaces with a tab).
>
> I rather have all tabs, or the tab and spaces. I find 8 spaces to be a
> waste of memory and disk space.
>
> >
> > I do not know whether the kernel will adopt .editorconfig or not,
> > but if that patch is applied, your 1/2 will be a step backward.
>
> My 1/2 only made it consistent, as the original code had the tab/spaces mix
> and just a few lines that were modified by others broke it by adding all
> spaces.
>
> >
> > My got-feeling is, you will never reach the goal as long as
> > you adopt a strange indentation style, which is obscure
> > to other contributors.
>
> I'm guessing this is not strange to other perl developers who uses emacs.
>
> >
> > Not all people use vim.
>
> I don't use it either. I was trying to make vim match emacs. Of course for
> those that use something else, it wont help. I'm curious, what's your main
> editor that you use?


I use emacs.

I have some setups in my ~/.emacs
although I am not an expert of emacs lisp.


(defalias 'perl-mode 'cperl-mode)

(add-hook 'cperl-mode-hook
          (lambda()
                (setq cperl-indent-level 8)
(setq cperl-tab-always-indent t)
            (setq tab-width 8)
            (setq indent-tabs-mode t)
            ))




Then, emacs can understand that
my preference is tab-indentation
with 8 character width.







>
> > I am not interested in 1/2 either.
>
> OK.
>
> >
> > If you insist on this patch set, apply it to your tree
> > and send a pull request by yourself.
>
> I'm fine with that.
>
> >
> >
> > [1]: https://lore.kernel.org/lkml/20200703073143.423557-1-danny@kdrag0n.dev/
>
> Thanks for the link.
>
> -- Steve



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users
  2021-03-25 14:09           ` Masahiro Yamada
@ 2021-03-25 15:10             ` Steven Rostedt
  0 siblings, 0 replies; 11+ messages in thread
From: Steven Rostedt @ 2021-03-25 15:10 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Linux Kernel Mailing List, Linux Kbuild mailing list,
	Andrew Morton, John (Warthog9) Hawley

On Thu, 25 Mar 2021 23:09:38 +0900
Masahiro Yamada <masahiroy@kernel.org> wrote:

> > > Not all people use vim.  
> >
> > I don't use it either. I was trying to make vim match emacs. Of course for
> > those that use something else, it wont help. I'm curious, what's your main
> > editor that you use?  
> 
> 
> I use emacs.
> 
> I have some setups in my ~/.emacs
> although I am not an expert of emacs lisp.
> 
> 
> (defalias 'perl-mode 'cperl-mode)
> 
> (add-hook 'cperl-mode-hook
>           (lambda()
>                 (setq cperl-indent-level 8)
> (setq cperl-tab-always-indent t)
>             (setq tab-width 8)
>             (setq indent-tabs-mode t)
>             ))
> 
> 
> 
> 
> Then, emacs can understand that
> my preference is tab-indentation
> with 8 character width.

Ah, so you edited your perl-mode to not use the emacs default. I never did.

I was just letting you know where I picked up the "mix up space-indentation
and tab-indentation" from ;-)  I'm sure if you removed those lines, you
would then see why I use that "standard".

I've been doing it for so long on all my perl files, it's been engraved in
me to do it that way whenever I work on perl.

-- Steve

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users
  2021-03-25 13:50         ` Steven Rostedt
  2021-03-25 14:09           ` Masahiro Yamada
@ 2021-03-26  7:51           ` Joe Perches
  1 sibling, 0 replies; 11+ messages in thread
From: Joe Perches @ 2021-03-26  7:51 UTC (permalink / raw)
  To: Steven Rostedt, Masahiro Yamada
  Cc: Linux Kernel Mailing List, Linux Kbuild mailing list,
	Andrew Morton, John (Warthog9) Hawley

On Thu, 2021-03-25 at 09:50 -0400, Steven Rostedt wrote:
> On Thu, 25 Mar 2021 15:20:13 +0900 Masahiro Yamada <masahiroy@kernel.org> wrote:
> > 
> > The root cause of inconsistency is that
> > you mix up space-indentation and tab-indentation.
> > I do not know if it is a standard way either.
> 
> This is the default way emacs has edited perl files for as long as I can
> remember (back to 1996). It became my standard of editing perl files just
> because of that. For everything else, I use tabs.
[]
> > For example, scripts/checkpatch.pl uses only tabs,
> > which I think is more robust.
> 
> Probably because Joe probably uses vim ;-)

I generally use emacs.  Maybe Andy Whitcroft uses vim.
For checkpatch.pl I just followed Andy's style.
get_maintainer.pl uses the 4 spaces then 1 tab style like Steven uses.

perl code can be pretty long left to right so using smaller indentation
seems useful there.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-03-26  7:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 21:38 [PATCH 0/2] streamline_config.pl: Fix Perl spacing Steven Rostedt
2021-03-22 21:38 ` [PATCH 1/2] streamline_config.pl: Make spacing consistent Steven Rostedt
2021-03-22 21:38 ` [PATCH 2/2] streamline_config.pl: Add softtabstop=4 for vim users Steven Rostedt
2021-03-24  6:01   ` Masahiro Yamada
2021-03-24 13:54     ` Steven Rostedt
2021-03-25  0:06       ` Steven Rostedt
2021-03-25  6:20       ` Masahiro Yamada
2021-03-25 13:50         ` Steven Rostedt
2021-03-25 14:09           ` Masahiro Yamada
2021-03-25 15:10             ` Steven Rostedt
2021-03-26  7:51           ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).