[libvirt] [PATCH][RFC] Add a rule for indenting labels

Daniel P. Berrange berrange at redhat.com
Fri Mar 21 14:49:52 UTC 2014


On Fri, Mar 21, 2014 at 08:19:42AM -0600, Eric Blake wrote:
> On 03/21/2014 07:11 AM, Ján Tomko wrote:
> > Indent labels by one space.
> > 
> > Add the rule to HACKING and enforce it by syntax-check.
> > ---
> > Adding a space helps git's function context detection, but the fallout
> > patch is over 800K.
> > 
> > My reasoning for also indenting labels in nested code is that
> > vim's cinoptions don't have a separate option for these labels
> > (or I haven't searched hard enough?).
> 
> Alas, I don't know enough on vim to help there.
> 
> > 
> > Inspired by this thread:
> > https://www.redhat.com/archives/libvir-list/2014-March/msg01310.html
> > 
> >  cfg.mk               |  7 +++++++
> >  docs/hacking.html.in | 18 +++++++++++++++++-
> >  2 files changed, 24 insertions(+), 1 deletion(-)
> > 
> > diff --git a/cfg.mk b/cfg.mk
> > index 559f719..1512fb2 100644
> > --- a/cfg.mk
> > +++ b/cfg.mk
> > @@ -898,6 +898,13 @@ sc_prohibit_virConnectOpen_in_virsh:
> >  	halt='Use vshConnect() in virsh instead of virConnectOpen*'    \
> >  	  $(_sc_search_regexp)
> >  
> > +sc_require_space_before_label:
> > +	@prohibit='^(( {2})*|( {3})*)([_a-zA-Z0-9]+):$$'               \
> 
> This doesn't do what you want; it sounds like you want to require all
> labels to have (4n+1) spaces, so you want 4n+{0,2,3} to be forbidden.
> Something like:
> 
> @prohibit='^( {4})*(|  |   )([_a-zA-Z0-9]+):$$'
> 
> > +	exclude='( {4})*default:$$'                                    \
> > +	in_vc_files='\.[ch]$$'                                         \
> > +	halt="Labels should be indented by 4*n + 1 spaces"             \
> > +	  $(_sc_search_regexp)
> 
> The rest of this makes sense, if I can figure out why my emacs settings
> aren't doing this already, and if we update .dir-locals.el in the same
> patch.

FWIW, my emacs is doing the right thing wrt this proposed hacking
rule and I don't have any .emacsrc file at all on this machine - just
plain default settings.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list