A while back, there was a massive patch that removed all the tabs from
the Sage library. Unfortunately, they have been creeping back in, and
there are now quite a few files with tabs: try doing
grep --perl-regexp '\t' --files-with-matches -r sage/*
from SAGE_ROOT/devel/sage/.
Coordinating another big tab removal patch would be difficult, but I
think that we could at least change the "sage -merge" script so that it
rejects any patch that introduces tabs. (Unless, say, some kind of
--no-really-the-tabs-are-okay command line option is specified.) Does
this seem like a good idea?
(This is inspired by #3852, where I fixed up a bunch of tabs and
whitespace in symbolics/expression.pyx, and Burcin pointed out that such
a patch would mess up a bunch of other patches that affect that file.)
Dan
--
--- Dan Drake
----- http://mathsci.kaist.ac.kr/~drake
-------
+1
or from sage: search_src("\t")
This is annoying; it was a pain to get rid of the tabs last time. If
I remember, having tabs in a file can cause problems with Sphinx,
maybe with displaying help in the notebook.
> Coordinating another big tab removal patch would be difficult, but I
I put together a patch in about 20 minutes, using search_src("\t") and
the emacs "untabify" function. If our next release is 4.4, then 4.4.1
could be purely an untabify release...
> think that we could at least change the "sage -merge" script so that it
> rejects any patch that introduces tabs. (Unless, say, some kind of
> --no-really-the-tabs-are-okay command line option is specified.) Does
> this seem like a good idea?
Yes. Another option: should "sage -t" fail on any file with tabs?
Then the responsibility would fall more to the patch authors than to
the release managers.
--
John
+1 -- I greatly prefer that option. In particular, it means that a
release manager does not have to use "sage -merge" if they don't want
to. Changing sage -t is much better.
-- William
--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
> > Yes. Another option: should "sage -t" fail on any file with tabs?
> > Then the responsibility would fall more to the patch authors than to
> > the release managers.
>
> +1 -- I greatly prefer that option. In particular, it means that a
> release manager does not have to use "sage -merge" if they don't want
> to. Changing sage -t is much better.
Here's a patch:
<http://trac.sagemath.org/sage_trac/ticket/8680>
--
John
Trailing whitespace could be removed. (Currently trailing tabs are
converted to many trailing spaces.)
I've also come across files that do not end with newline...
Opinions?
-Leif
(see also <http://trac.sagemath.org/sage_trac/ticket/8680#comment:9>)
Why? Is there a single place in all sage that should use a tab in the
source code? Please clarify?
> it would be better to have a tool that (conditionally) does this
> rather than supplying patches to lots of files converted by Emacs. The
> same tool could be used just to check for "illegal" tabs. As I
> understand this, these are *tabs in leading whitespace*.
>
> Trailing whitespace could be removed. (Currently trailing tabs are
> converted to many trailing spaces.)
That is another issue. It doesn't cause any trouble in python, so it
doesn't concern me. Mixing spaces and tabs does cause trouble, and I
think using tabs at all violates the style guidelines in our developer
manual.
>
> I've also come across files that do not end with newline...
>
> Opinions?
>
> -Leif
>
> (see also <http://trac.sagemath.org/sage_trac/ticket/8680#comment:9>)
>
> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>
> To unsubscribe, reply using "remove me" as the subject.
> I'm not happy with "brute-force" converting *any* tab to space(s), and
> it would be better to have a tool that (conditionally) does this
> rather than supplying patches to lots of files converted by Emacs. The
> same tool could be used just to check for "illegal" tabs. As I
> understand this, these are *tabs in leading whitespace*.
>
> Trailing whitespace could be removed. (Currently trailing tabs are
> converted to many trailing spaces.)
>
> I've also come across files that do not end with newline...
>
> Opinions?
I think we should do this once, after a tool is in place to make sure
these things don't get in anymore.
A big +1 to sage -t failing on files that have tabs, lack newlines, or
whatever else the style guide enforces. I've also thought it would be
useful to have a trac plugin that points out such things (and it could
report coverage changes as well).
- Robert
Well, I think it's more complicated than that, or at least it used to
be: when we first started using Sphinx to produce docstrings in the
notebook, if there was a tab *anywhere* in the file, then docstrings
for that file would not be processed correctly by Sphinx. This is the
main reason that I personally wanted to get rid of all tabs in .py
and .pyx files. I haven't tested lately to see if that's still an
issue.
That is, it's not just an esthetic issue or a style issue: there is
(or was?) a very good reason to eliminate all tabs, not just in
leading whitespace.
> Trailing whitespace could be removed. (Currently trailing tabs are
> converted to many trailing spaces.)
>
> I've also come across files that do not end with newline...
I certainly don't object to dealing with these, but they don't have
the same sense of importance to me. (Or maybe they're important but I
don't know why?)
--
John