Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 339300 - [app-vim/perl-support] feature req: patch out forced indentation settings.
Summary: [app-vim/perl-support] feature req: patch out forced indentation settings.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High enhancement
Assignee: Vim Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-30 23:15 UTC by Kent Fredric (IRC: kent\n) (RETIRED)
Modified: 2011-02-08 21:43 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2010-09-30 23:15:23 UTC
In the "ftplugin/perl.vim" file shipped with perl-support, the following lines are *uncommented* 

setlocal  tabstop=4
setlocal  shiftwidth=4


Oddly, the comment above them reads as follows: 

"  Set tabulator and shift width to 4 conforming to the Perl Style Guide.
"  Uncomment the next two lines to force these settings for all files with
"  filetype 'perl' .

Myself, I don't like a 4-space tabstop, despite it being "standard", and this piece of code in here is somewhat problematic to work around. 


http://lug.fh-swf.de/vim/vim-doc/perlsupport.html  implies its only a *suggested* choice of indentation, but none-the-less, it forces it upon us, and I see no way to "opt out" of this behaviour. 

I *would* file a bug upstream, but their bug reporting services appear absent or impossible to find. 

I have been working around this issue myself by maintaining my own ebuilds since 3.6.2 with a feature to disable this sillyness, and have been using it long enough that I'd like it in the main distribution, and perhaps somebody can prod the author upstream to fix this issue.

Lines I put in perl-support.ebuild are as follows: 

IUSE="+perl-tabs"
src_unpack(){
        unpack ${A}
        use perl-tabs || einfo "Disabling Perl-Style Tabs"
        use perl-tabs \
                || sed -i '/=4/s/^/"/' ${WORKDIR}/perl-support-${PV}/ftplugin/perl.vim \
                || die "Can't Seem to strip tabs :( "
}
And I add this to metadata.xml:

 <use>
    <flag name='perl-tabs'>Automatically Enforce 4-Space tabs in all perl
    files as per the Perl Style Guide. ( Disable if you want custom
    indentation settings )</flag>
 </use>


I'm not even sure this should be 'used' by default, myself, I'd rather this be opt-in instead of opt-out, because the Perl Style Guide is merely *one* way to do it, and by no means an authority, as well as the fact files having their indentation mysteriously broken because of this is initially hard to debug. 

The name "perl-tabs" might also want a better name, but its the best I could come up with.

True pedants will also want a proper .patch file instead of a shell-out to sed, but sed works for me =)


nb. My sed line above is at first glance a little confusing, I forgot what  /=4/ did, but this shows it: 

sed -n '/=4/p' $( qlist perl-support | grep -i perl.vim )

setlocal  tabstop=4
setlocal  shiftwidth=4
Comment 1 Tim Harder gentoo-dev 2011-02-07 14:20:24 UTC
Just added 4.9 to CVS that comments out the two lines as specified in the documentation.
Comment 2 Sergiy Borodych 2011-02-08 21:43:58 UTC
> I *would* file a bug upstream, but their bug reporting services appear absent
> or impossible to find. 

You can contact author (upstream) at mailing list
 http://lug.fh-swf.de/cgi-bin/mailman/listinfo/vim-plugins-list