Loading ...
Sorry, an error occurred while loading the content.

Re: [PATCH] add 'cinoption' "E" to correctly indent enum for Java code

Expand Messages
  • Hong Xu
    ... Hi Gary, What I mean is they don t need to have this feature. The original use of j can also be enabled by default, but it isn t, right? But I do NOT
    Message 1 of 9 , Mar 5, 2013
    • 0 Attachment
      On 3/5/13 10:15 AM, Gary Johnson wrote:
      > On 2013-03-05, Hong wrote:
      >> On Tuesday, March 5, 2013 8:16:48 AM UTC-8, Lech Lorens wrote:
      >>> Wouldn't it be better to use the existing 'cinoptions' entry jN? It's
      >>>
      >>> related to Java...
      >>>
      >>
      >> This is also what I am hesitating at. But people who need the
      >> original 'j' option may not need this option (and vice versa) for
      >> the use of their languages (Javascript?), so I finally splitted
      >> them.
      >
      > I can't imagine anyone choosing to have their code formatted as in
      > this example from you:
      >
      > public enum {
      > MON,
      > TUE,
      > }
      >

      Hi Gary,

      What I mean is they don't need to have this feature. The original use of
      'j' can also be enabled by default, but it isn't, right?

      But I do NOT persist on creating a new option. We can finally figure out
      what the best solution is.

      Hong

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Gary Johnson
      ... I see your point, except that I _think_ the reason for not enabling j by default was because it would mess up C formatting. That is just speculation,
      Message 2 of 9 , Mar 5, 2013
      • 0 Attachment
        On 2013-03-05, Hong Xu wrote:
        > On 3/5/13 10:15 AM, Gary Johnson wrote:
        > >On 2013-03-05, Hong wrote:
        > >>On Tuesday, March 5, 2013 8:16:48 AM UTC-8, Lech Lorens wrote:
        > >>>Wouldn't it be better to use the existing 'cinoptions' entry jN? It's
        > >>>
        > >>>related to Java...
        > >>>
        > >>
        > >>This is also what I am hesitating at. But people who need the
        > >>original 'j' option may not need this option (and vice versa) for
        > >>the use of their languages (Javascript?), so I finally splitted
        > >>them.
        > >
        > >I can't imagine anyone choosing to have their code formatted as in
        > >this example from you:
        > >
        > > public enum {
        > > MON,
        > > TUE,
        > > }
        > >
        >
        > Hi Gary,
        >
        > What I mean is they don't need to have this feature. The original use
        > of 'j' can also be enabled by default, but it isn't, right?

        I see your point, except that I _think_ the reason for not enabling
        'j' by default was because it would mess up C formatting. That is
        just speculation, though.

        If the purpose of the 'j' flag is to "Indent Java anonymous classes
        correctly," that suggests to me that it acts as a clue to the
        C-indenter that this is not C but Java and that it should do what's
        right for Java. If that's true, then I think your fix should be
        enabled by this same flag.

        > But I do NOT persist on creating a new option. We can finally figure
        > out what the best solution is.

        Agreed. I'm just looking at this from the perspective of keeping
        Vim's options uncluttered. I hope someone more experienced with
        Java and the C-indenter can chime in here.

        Regards,
        Gary

        --
        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Bram Moolenaar
        ... Thanks, tests are good. However, it seems the test passes without your patch. static is already checked for and skipped above the lines you insert.
        Message 3 of 9 , Mar 5, 2013
        • 0 Attachment
          Hong Xu wrote:

          > On Tuesday, March 5, 2013 8:16:48 AM UTC-8, Lech Lorens wrote:
          > > Wouldn't it be better to use the existing 'cinoptions' entry jN? It's
          > >
          > > related to Java...
          > >
          >
          > This is also what I am hesitating at. But people who need the original 'j' option may not need this option (and vice versa) for the use of their languages (Javascript?), so I finally splitted them.
          > >
          > >
          > > BTW, in the past I made a number of modifications to the indenting
          > >
          > > code. It was like treading on a mine field (lots of things I could
          > >
          > > break). Would you, please, also include a test case for your
          > >
          > > functionality so that the next person that modifies get_c_indent()
          > >
          > > does not break what you've achieved?
          > >
          > >
          >
          > Thanks for the reminder. I have included the test case in the new
          > attached patch.

          Thanks, tests are good. However, it seems the test passes without your
          patch.

          "static" is already checked for and skipped above the lines you insert.
          Without a flag to enable this. I don't see much of a problem also
          skipping the public/private/protected attributes without a flag.

          Actually, what really matters is the check for "=". I think it should
          be ignored for Java, the "j" flag.



          --
          How To Keep A Healthy Level Of Insanity:
          11. Specify that your drive-through order is "to go".

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ an exciting new programming language -- http://www.Zimbu.org ///
          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

          --
          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Hong Xu
          ... I tried without the patch, but they cannot pass on my computer... This is weird. ... We do need the second check inside the loop, since people may write
          Message 4 of 9 , Mar 5, 2013
          • 0 Attachment
            On Mar 5, 2013, at 11:57 AM, Bram Moolenaar <Bram@...> wrote:

            >
            > Hong Xu wrote:
            >
            >> On Tuesday, March 5, 2013 8:16:48 AM UTC-8, Lech Lorens wrote:
            >>> Wouldn't it be better to use the existing 'cinoptions' entry jN? It's
            >>>
            >>> related to Java...
            >>
            >> This is also what I am hesitating at. But people who need the original 'j' option may not need this option (and vice versa) for the use of their languages (Javascript?), so I finally splitted them.
            >>>
            >>>
            >>> BTW, in the past I made a number of modifications to the indenting
            >>>
            >>> code. It was like treading on a mine field (lots of things I could
            >>>
            >>> break). Would you, please, also include a test case for your
            >>>
            >>> functionality so that the next person that modifies get_c_indent()
            >>>
            >>> does not break what you've achieved?
            >>
            >> Thanks for the reminder. I have included the test case in the new
            >> attached patch.
            >
            > Thanks, tests are good. However, it seems the test passes without your
            > patch.
            >

            I tried without the patch, but they cannot pass on my computer... This
            is weird.

            > "static" is already checked for and skipped above the lines you insert.
            > Without a flag to enable this. I don't see much of a problem also
            > skipping the public/private/protected attributes without a flag.
            >

            We do need the second check inside the loop, since people may write either:

            public static enum
            static public enum


            Yes, I do agree with you about the flag to enable this. We really don't
            need any flags to enable this since nothing is messed up with this
            additional feature. I attached a new patch here, with updated code and
            an updated test.

            > Actually, what really matters is the check for "=". I think it should
            > be ignored for Java, the "j" flag.

            I tried to add a flag here, but it seems the 'J' option is broken in
            this way (test3 would fail).


            Thanks,
            Hong

            --
            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Bram Moolenaar
            ... Right, this works like an OR, not an AND. I ll include it and clean it up a bit. I ll add a function to check if a word follows, that is done in many
            Message 5 of 9 , Mar 7, 2013
            • 0 Attachment
              Hong Xu wrote:

              > On Mar 5, 2013, at 11:57 AM, Bram Moolenaar <Bram@...> wrote:
              >
              > >
              > > Hong Xu wrote:
              > >
              > >> On Tuesday, March 5, 2013 8:16:48 AM UTC-8, Lech Lorens wrote:
              > >>> Wouldn't it be better to use the existing 'cinoptions' entry jN? It's
              > >>>
              > >>> related to Java...
              > >>
              > >> This is also what I am hesitating at. But people who need the original 'j' option may not need this option (and vice versa) for the use of their languages (Javascript?), so I finally splitted them.
              > >>>
              > >>>
              > >>> BTW, in the past I made a number of modifications to the indenting
              > >>>
              > >>> code. It was like treading on a mine field (lots of things I could
              > >>>
              > >>> break). Would you, please, also include a test case for your
              > >>>
              > >>> functionality so that the next person that modifies get_c_indent()
              > >>>
              > >>> does not break what you've achieved?
              > >>
              > >> Thanks for the reminder. I have included the test case in the new
              > >> attached patch.
              > >
              > > Thanks, tests are good. However, it seems the test passes without your
              > > patch.
              > >
              >
              > I tried without the patch, but they cannot pass on my computer... This
              > is weird.
              >
              > > "static" is already checked for and skipped above the lines you insert.
              > > Without a flag to enable this. I don't see much of a problem also
              > > skipping the public/private/protected attributes without a flag.
              > >
              >
              > We do need the second check inside the loop, since people may write either:
              >
              > public static enum
              > static public enum
              >
              >
              > Yes, I do agree with you about the flag to enable this. We really don't
              > need any flags to enable this since nothing is messed up with this
              > additional feature. I attached a new patch here, with updated code and
              > an updated test.
              >
              > > Actually, what really matters is the check for "=". I think it should
              > > be ignored for Java, the "j" flag.
              >
              > I tried to add a flag here, but it seems the 'J' option is broken in
              > this way (test3 would fail).

              Right, this works like an OR, not an AND.

              I'll include it and clean it up a bit. I'll add a function to check if
              a word follows, that is done in many places.

              --
              How To Keep A Healthy Level Of Insanity:
              18. When leaving the zoo, start running towards the parking lot,
              yelling "run for your lives, they're loose!!"

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
              \\\ an exciting new programming language -- http://www.Zimbu.org ///
              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

              --
              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php

              ---
              You received this message because you are subscribed to the Google Groups "vim_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            Your message has been successfully submitted and would be delivered to recipients shortly.