Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange # vim: set et ts=4 sw=4: comments at the end of some scrips #1844

Closed
jsmeix opened this issue Jun 28, 2018 · 15 comments
Closed

Strange # vim: set et ts=4 sw=4: comments at the end of some scrips #1844

jsmeix opened this issue Jun 28, 2018 · 15 comments

Comments

@jsmeix
Copy link
Member

jsmeix commented Jun 28, 2018

In current ReaR master code some scripts have a last line

# vim: set et ts=4 sw=4:

which got added by @rmetrich via
b184194
and
84f03a4

I.e. in current ReaR master code there is

 $ find usr/sbin/rear usr/share/rear/ | xargs grep 'vim:' 2>/dev/null

usr/share/rear/lib/layout-functions.sh:# vim: set et ts=4 sw=4:
usr/share/rear/prep/GNU/Linux/220_include_lvm_tools.sh:# vim: set et ts=4 sw=4:
usr/share/rear/layout/prepare/GNU/Linux/110_include_lvm_code.sh:# vim: set et ts=4 sw=4:
usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh:# vim: set et ts=4 sw=4:

I guess this is some special automatism by the vi editor.

@rmetrich
could you explan the reason behind
and whether or not I should remove them
or if it makes sense to have those trailing comment lines.

@jsmeix jsmeix added this to the ReaR v2.5 milestone Jun 28, 2018
@jsmeix jsmeix self-assigned this Jun 28, 2018
@rmetrich
Copy link
Contributor

@jsmeix these directives tell vim to automatically adjust when editing the file:

  • et : expand tabs
  • ts=4 : 4 spaces when expanding a found in the file
  • sw=4 : 5 spaces when hitting on your keyboard

Since most of ReaR's code is indented using these settings, keeping that would be nice to avoid messing up the files.

@jsmeix
Copy link
Member Author

jsmeix commented Jun 28, 2018

@rmetrich
thanks for your prompt reply!
Now I understand.

@jsmeix
Copy link
Member Author

jsmeix commented Jun 28, 2018

@gdha @gozora @schabrolles
what do you think:

Schouldn't then such a trailing comment line

# vim: set et ts=4 sw=4:

be appended to every ReaR script?

@gozora
Copy link
Member

gozora commented Jun 28, 2018

Honestly I didn't know about this feature, but I'd personally prefer to keep editor settings out of source code mainly because other users might appear with different editors storing another set of "meta-data" which could lead to mess...

V.

@rmetrich
Copy link
Contributor

As you wish, although such metadata is widely used among projects, e.g. mariadb, sos, ruby, rsyslog, gnutls, NetworkManager, ...

Even in rear, it is already used in packaging/arch/PKGBUILD.

@gozora
Copy link
Member

gozora commented Jun 28, 2018

Don't get me wrong Renaud, I'm not going to fight to keep this away from ReaR source code, if you guys think this is a useful idea, let's keep it, no problem with that from my site.
My editor for example, keeps meta-data information (e.g. information about collapsed sections etc.) in separate files (dot prefixed) directly in source tree and I just thought that it might be disturbing for other people to deal with them, so I've reconfigured this behavior ...

V.

@jsmeix
Copy link
Member Author

jsmeix commented Jun 29, 2018

I hope such comments cannot cause real trouble (because they are only comments)
and because they are useful in some cases it is o.k. for me to have them.
I think the only real trouble that such comments could cause are the usual
"what is the right editor" plus "what is the right indentation style" wars ;-)

@rmetrich
Copy link
Contributor

I can answer to "what is the right editor" ;-)

@jsmeix
Copy link
Member Author

jsmeix commented Jun 29, 2018

My editor is the only right one that is used by real hard men ;-)

@gozora
Copy link
Member

gozora commented Jun 29, 2018

@jsmeix ed ?

@rmetrich
Copy link
Contributor

likely, at his time there was only that ;-)

@rmetrich
Copy link
Contributor

or even maybe his editor was a puncher, for punch cards ;-)

@jsmeix
Copy link
Member Author

jsmeix commented Jun 29, 2018

@gozora
real Supermen use super ed a.k.a. sed :-))

@jsmeix
Copy link
Member Author

jsmeix commented Jun 29, 2018

@rmetrich
in ancient times real hard men used a puncher chisel and a big hammer...
http://www.wordinfo.info/words/images/graph-epigraph-Egyptian-Col.gif

@jsmeix
Copy link
Member Author

jsmeix commented Jul 30, 2018

I think this issue is sufficiently discussed so that I can close it
and the consensus is that it is o.k. to have those comments
but it is not required to have such comments in every file or script.

@jsmeix jsmeix closed this as completed Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants