Re: Revisiting modelines in source files

2015-06-26 Thread Birunthan Mohanathas
On 18 June 2015 at 07:28, wrote: > 1) Comments that exceed the 80-char limit get wrapped blindly, rather than > being rewrapped properly. This results in comment blocks that look like this: I sidestepped this issue by making Clang-Format ignore all comments. See bug 961541. Cheers, Biru __

Re: Revisiting modelines in source files

2015-06-19 Thread Robert O'Callahan
On Sat, Jun 20, 2015 at 3:27 PM, Nicholas Nethercote wrote: > I also think automated tools probably won't get us meeting the style > guide perfectly -- e.g. the aforementioned line-length wrapping, and > can they ensure CamelCaps() function names and aFoo/mFoo/gFoo/sFoo > variable naming? -- so e

Re: Revisiting modelines in source files

2015-06-19 Thread Andrew McCreight
On Fri, Jun 19, 2015 at 8:27 PM, Nicholas Nethercote wrote: > > Sat, Jun 20, 2015 at 2:16 AM, Gregory Szorc wrote: > > > > We can mass rewrite the tree. But unless > > the tools to keep things consistent are easy and painless to use, this > will > > add chaos. > > Chaos? There are two distinct s

Re: Revisiting modelines in source files

2015-06-19 Thread Nicholas Nethercote
> Sat, Jun 20, 2015 at 2:16 AM, Gregory Szorc wrote: > > We can mass rewrite the tree. But unless > the tools to keep things consistent are easy and painless to use, this will > add chaos. Chaos? There are two distinct steps here. 1. Get the style mostly consistent (e.g. spacing/indentation/brac

Re: Revisiting modelines in source files

2015-06-19 Thread Eric Rahm
> If someone commits to producing a suitable clang-format binary/config, I'll > sign up for creating all the tooling. It looks like Birunthan stated he'd be willing to work on the clang-format side (I'm also happy to help out) if we are committed to integrating it into our wrorkflow. I found an

Re: Revisiting modelines in source files

2015-06-19 Thread Gregory Szorc
On Fri, Jun 19, 2015 at 6:45 AM, Birunthan Mohanathas < birunt...@mohanathas.com> wrote: > Hi, > > Over the past year, I have converted a few directories (xpcom/, > docshell/, embedding/) to Gecko style using a patched Clang-Format and > a few other tools. > > On 17 June 2015 at 18:57, Gregory Szo

Re: Revisiting modelines in source files

2015-06-19 Thread Mike Hoye
On 2015-06-18 8:36 PM, Eric Rahm wrote: On Thursday, June 18, 2015 at 7:28:44 AM UTC-7, kgu...@mozilla.com wrote: // This is a comment that was previously just over the eighty // character // limit but got rewrapped by clang-format just blindly // inserting // linebreaks willy-nilly and requires

Re: Revisiting modelines in source files

2015-06-19 Thread Birunthan Mohanathas
Hi, Over the past year, I have converted a few directories (xpcom/, docshell/, embedding/) to Gecko style using a patched Clang-Format and a few other tools. On 17 June 2015 at 18:57, Gregory Szorc wrote: > First thing is first: what are the blockers to mass rewriting > mozilla-central with clan

Re: Revisiting modelines in source files

2015-06-19 Thread kgupta
On Thursday, June 18, 2015 at 8:36:09 PM UTC-4, Eric Rahm wrote: > Can we sidestep this by punting on enforcing a line length restriction with > clang-format? > > I think it would be reasonably uncontroversial to just do the following > initially: > - spacing > - indentation > - bracing I

Re: Revisiting modelines in source files

2015-06-18 Thread Botond Ballo
On Thu, Jun 18, 2015 at 8:36 PM, Eric Rahm wrote: >> 2) MOZ_BEGIN_NESTED_ENUM_CLASS seems to trip up the formatter and it >> misformats the code after that. > > AFAICT there's no such thing as MOZ_BEGIN_NESTED_ENUM_CLASS It was removed in bug 290. Cheers, Botond

Re: Revisiting modelines in source files

2015-06-18 Thread Eric Rahm
On Thursday, June 18, 2015 at 7:28:44 AM UTC-7, kgu...@mozilla.com wrote: > 1) Comments that exceed the 80-char limit get wrapped blindly, rather than > being rewrapped properly. This results in comment blocks that look like this: > > // This is a comment that was previously just over the eighty

Re: Revisiting modelines in source files

2015-06-18 Thread kgupta
On Wednesday, June 17, 2015 at 9:57:12 PM UTC-4, Gregory Szorc wrote: > First thing is first: what are the blockers to mass rewriting > mozilla-central with clang-format's output? For the record I'm in favour of auto-clang-formatting the codebase, but the last time I tried running clang-format on

Re: Revisiting modelines in source files

2015-06-17 Thread Philip Chee
On 18/06/2015 12:15, ISHIKAWA,chiaki wrote: > Unfortunately, it does not handle the particular coding style of > #if,#else,#endif in JavaScript source files since > use of C-style macro preprocessor is not quite standard. > > Nobody seems to have written a emacs mode for this C-style macro use in

Re: Revisiting modelines in source files

2015-06-17 Thread Robert O'Callahan
That reminds me: when I reformatted rr, I did manually change the code in a few places (usually around #ifdefs) so that clang-format's line breaking didn't go completely crazy. Rob -- oIo otoeololo oyooouo otohoaoto oaonoyooonoeo owohooo oioso oaonogoroyo owoiotoho oao oboroootohoeoro oooro osoio

Re: Revisiting modelines in source files

2015-06-17 Thread ISHIKAWA,chiaki
Assessing style compliance as == clang-format(whole file) is by far the easiest to implement. I'd be in favor of a flag day (or set of mini flag days) where we mass rewrite the tree with clang-format's output. To be honest, I don't care WHICH particular style we follow, but please set the fl

Re: Revisiting modelines in source files

2015-06-17 Thread Mike Hommey
On Wed, Jun 17, 2015 at 06:57:04PM -0700, Gregory Szorc wrote: > On Wed, Jun 17, 2015 at 6:29 PM, Robert O'Callahan > wrote: > > > As an experiment, we declared the coding style of rr to be "whatever > > clang-format produces with rr's .clang-format file" (which was tweaked to > > resemble Mozill

Re: Revisiting modelines in source files

2015-06-17 Thread Gregory Szorc
On Wed, Jun 17, 2015 at 6:29 PM, Robert O'Callahan wrote: > As an experiment, we declared the coding style of rr to be "whatever > clang-format produces with rr's .clang-format file" (which was tweaked to > resemble Mozilla style, including an 80-char line limit). Overall I've been > very happy w

Re: Revisiting modelines in source files

2015-06-17 Thread Robert O'Callahan
As an experiment, we declared the coding style of rr to be "whatever clang-format produces with rr's .clang-format file" (which was tweaked to resemble Mozilla style, including an 80-char line limit). Overall I've been very happy with the results. Sometimes you get suboptimal linebreaking decisions

Re: Revisiting modelines in source files

2015-06-17 Thread Michael Layzell
On 2015-06-17 1:04 PM, Andrew McCreight wrote: As Boris said, for our particular emacs modeline there is no prompt. Actually, in some JS files I'm getting a prompt when opening them - js-indent-level isn't considered a safe variable by emacs. (although it's pretty easy to mark them as safe,

Re: Revisiting modelines in source files

2015-06-17 Thread Martin Thomson
On Wed, Jun 17, 2015 at 4:57 PM, Nicholas Nethercote wrote: > (At this point I expect people to push back against my claims that the > automated tools aren't up to snuff. If you really think automated > tools can do a good enough job, please run one and submit patches > fixing up some files. I'd b

Re: Revisiting modelines in source files

2015-06-17 Thread Nicholas Nethercote
On Wed, Jun 17, 2015 at 8:03 AM, Ehsan Akhgari wrote: > > I use vim, and the modelines are definitely useful to me. Same here. I'm also somebody who writes patches all over the codebase, and having the 2-space or 4-space indentation done automatically is *very* helpful. (I currently have a pendin

Re: Revisiting modelines in source files

2015-06-17 Thread Nicholas Nethercote
On Wed, Jun 17, 2015 at 10:07 AM, Gregory Szorc wrote: > > Can we all agree that the needs of the many outweigh the needs of the few > and establish a consistent and enforced C++ coding style across all of > mozilla-central? There's been general consensus around this for a while now. For example,

Re: Revisiting modelines in source files

2015-06-17 Thread Ehsan Akhgari
On 2015-06-17 1:07 PM, Gregory Szorc wrote: On Wed, Jun 17, 2015 at 8:14 AM, Ehsan Akhgari mailto:ehsan.akhg...@gmail.com>> wrote: On 2015-06-17 11:04 AM, Mike Hoye wrote: On 2015-06-17 6:53 AM, Mike Hommey wrote: So how about removing modelines and adding editorconfig

Re: Revisiting modelines in source files

2015-06-17 Thread Ehsan Akhgari
On 2015-06-17 11:18 AM, Nathan Froyd wrote: On Wed, Jun 17, 2015 at 11:03 AM, Ehsan Akhgari mailto:ehsan.akhg...@gmail.com>> wrote: On 2015-06-17 10:49 AM, Nathan Froyd wrote: Speaking as an emacs user, I'd be OK with removing modelines, adding editorconfig files, and adding

Re: Revisiting modelines in source files

2015-06-17 Thread Gregory Szorc
On Wed, Jun 17, 2015 at 8:14 AM, Ehsan Akhgari wrote: > On 2015-06-17 11:04 AM, Mike Hoye wrote: > >> On 2015-06-17 6:53 AM, Mike Hommey wrote: >> >>> So how about removing modelines and adding editorconfig files? >>> >> >> I understand we're considering (or getting close to?) autoformatting >> c

Re: Revisiting modelines in source files

2015-06-17 Thread Andrew McCreight
On Wed, Jun 17, 2015 at 3:53 AM, Mike Hommey wrote: > What we currently have in the tree is essentially modelines for vim and > emacs. But: > - most vim installations have modelines disabled by default because of > the security implications: https://lwn.net/Articles/20249/. > - emacs has the sa

Re: Revisiting modelines in source files

2015-06-17 Thread Nathan Froyd
On Wed, Jun 17, 2015 at 11:03 AM, Ehsan Akhgari wrote: > On 2015-06-17 10:49 AM, Nathan Froyd wrote: > >> Speaking as an emacs user, I'd be OK with removing modelines, adding >> editorconfig files, and adding .dir-locals.el files (modelines, but on a >> directory-wide basis, including subdirector

Re: Revisiting modelines in source files

2015-06-17 Thread Ehsan Akhgari
On 2015-06-17 11:04 AM, Mike Hoye wrote: On 2015-06-17 6:53 AM, Mike Hommey wrote: So how about removing modelines and adding editorconfig files? I understand we're considering (or getting close to?) autoformatting code on check-in. Are we? I'm curious to know more details about that... ___

Re: Revisiting modelines in source files

2015-06-17 Thread Mike Hoye
On 2015-06-17 6:53 AM, Mike Hommey wrote: So how about removing modelines and adding editorconfig files? I understand we're considering (or getting close to?) autoformatting code on check-in. Intuitively* that would obsolete editor-level config, (and save some time and nit-effort) but I don

Re: Revisiting modelines in source files

2015-06-17 Thread Ehsan Akhgari
On 2015-06-17 10:49 AM, Nathan Froyd wrote: On Wed, Jun 17, 2015 at 6:53 AM, Mike Hommey wrote: So how about removing modelines and adding editorconfig files? Speaking as an emacs user, I'd be OK with removing modelines, adding editorconfig

Re: Revisiting modelines in source files

2015-06-17 Thread Boris Zbarsky
On 6/17/15 10:01 AM, Mike Hommey wrote: modelines don't express those half-indent either. Also, they're not in the mozilla codying style, which, by the way uses 2-spaces indentations, not 4-spaces. Note that SpiderMonkey is almost entirely 4-space indent. mozilla~% grep -r "c-basic-offset: 4"

Re: Revisiting modelines in source files

2015-06-17 Thread Nathan Froyd
On Wed, Jun 17, 2015 at 6:53 AM, Mike Hommey wrote: > So how about removing modelines and adding editorconfig files? > > Speaking as an emacs user, I'd be OK with removing modelines, adding editorconfig files, and adding .dir-locals.el files (mod

Re: Revisiting modelines in source files

2015-06-17 Thread Boris Zbarsky
On 6/17/15 6:53 AM, Mike Hommey wrote: - emacs has the same security implication, and AIUI, opening a file with a modeline makes emacs ask questions to the user. Or ignore them in batch mode. That depends on what's in the modeline. Pretty sure our typical "Mode: C++; tab-width: 8; inden

Re: Revisiting modelines in source files

2015-06-17 Thread Mike Hommey
On Wed, Jun 17, 2015 at 03:13:20PM +0200, Nicolas B. Pierron wrote: > On 06/17/2015 12:53 PM, Mike Hommey wrote: > >So how about removing modelines and adding editorconfig files? > > This sounds like a good idea at first, but apparently they have no support > for half-indent, as we do have for js/

Re: Revisiting modelines in source files

2015-06-17 Thread Nicolas B. Pierron
On 06/17/2015 12:53 PM, Mike Hommey wrote: So how about removing modelines and adding editorconfig files? This sounds like a good idea at first, but apparently they have no support for half-indent, as we do have for js/src/ files such as visibility keyword, and case statements. Only by read

Re: Revisiting modelines in source files

2015-06-17 Thread Mike Hommey
On Wed, Jun 17, 2015 at 07:53:18PM +0900, Mike Hommey wrote: > Hi, > > The following post visible on planet, prompted a discussion on a french > irc channel. > http://www.otsukare.info/2015/06/17/mozilla-central-sublimetext > > What we currently have in the tree is essentially modelines for vim a

Re: Revisiting modelines in source files

2015-06-17 Thread Mike Hommey
On Wed, Jun 17, 2015 at 01:02:54PM +0200, Mike de Boer wrote: > Mike, thanks for bringing this up! Huge +1 from me. > > For posterity, here’s the bug I filed almost a year ago (time flies!): > https://bugzilla.mozilla.org/show_bug.cgi?id=957564 >

Re: Revisiting modelines in source files

2015-06-17 Thread Mike de Boer
Mike, thanks for bringing this up! Huge +1 from me. For posterity, here’s the bug I filed almost a year ago (time flies!): https://bugzilla.mozilla.org/show_bug.cgi?id=957564 Cheers, Another Mike. > On 17 Jun 2015, at 12:53, Mike Hommey w

Revisiting modelines in source files

2015-06-17 Thread Mike Hommey
Hi, The following post visible on planet, prompted a discussion on a french irc channel. http://www.otsukare.info/2015/06/17/mozilla-central-sublimetext What we currently have in the tree is essentially modelines for vim and emacs. But: - most vim installations have modelines disabled by default