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

Re: [jasspa] java indent and highligting

Expand Messages
  • Thomas Hundt
    Hold it. This release is unusable. Basic functionality has been broken: private static final Logger LOG = Logger.getLogger(PeakHourReportRunner.class); now
    Message 1 of 29 , Oct 5, 2006
    • 0 Attachment
      Hold it. This release is unusable.

      Basic functionality has been broken:

      private static final Logger LOG =
      Logger.getLogger(PeakHourReportRunner.class);

      now comes out as

      private static final Logger LOG =
      Logger.getLogger(PeakHourReportRunner.class);

      and if-else statements come out as

      if (something)
      do_something();
      else
      do_something_else();

      (Bryan feels the whole world should have to put in braces, but --
      idealism aside -- I know I'm going to be editing plenty of peoples' code
      without all the braces where he would like them. It IS a legitimate
      Java feature not to have to put in extra braces where they aren't
      necessary, and having the editor properly indent them will allow one to
      find out where one screwed it up, right? I mean that is why we are
      doing this, yes?)

      I'm rather have it work the way it used to, minus any of the new
      "improvements", if basic functionality like this goes out the window.

      Sorry, Jon. It was looking great there for a while, but this is too much.

      Regards,

      -Th


      Jon Green wrote:
      > Bryan Schofield wrote:
      >> I took a look at the java hilighting. It was missing some java
      >> keywords and it had a bunch of c keywords that don't really apply.
      >> Below is a suggestion for hilighting. In hkjava.emf if you replace
      >
      > Thanks Bryan,
      >
      > I have re-worked hkjava.emf with all of the suggestions received to
      > date. If you install this then delete the myjava.emf file (or rename to
      > myjava-1.emf so that it is not picked up) and then execute the file (or
      > restart the editor).
      >
      > This includes the token highlighting as suggested and the indent as
      > suggested. The language template includes the new indent method and the
      > existing 'C' method. The indent mode may be changed with
      > esc-x major-mode-setup.
      >
      > I am proposing that this gets shipped with the next release. Is this OK
      > with everybody? Does this solve the Java problems that people are
      > experiencing?
      >
      > Thanks
      > Jon.


      --
      Thomas Hundt <tom@...> +1-415-867-6698
    • Jon Green
      ... Hi Thomas, Thanks for the info and knee jerk reaction, just what I was looking for. M-x major-mode-setup will allow you to turn on C indentation again
      Message 2 of 29 , Oct 5, 2006
      • 0 Attachment
        Thomas Hundt wrote:
        > Hold it. This release is unusable.
        >
        > Basic functionality has been broken:
        >
        > private static final Logger LOG =
        > Logger.getLogger(PeakHourReportRunner.class);
        >
        > now comes out as
        >
        > private static final Logger LOG =
        > Logger.getLogger(PeakHourReportRunner.class);
        >
        > and if-else statements come out as
        >
        > if (something)
        > do_something();
        > else
        > do_something_else();
        >
        > (Bryan feels the whole world should have to put in braces, but --
        > idealism aside -- I know I'm going to be editing plenty of peoples' code
        > without all the braces where he would like them. It IS a legitimate
        > Java feature not to have to put in extra braces where they aren't
        > necessary, and having the editor properly indent them will allow one to
        > find out where one screwed it up, right? I mean that is why we are
        > doing this, yes?)
        >
        > I'm rather have it work the way it used to, minus any of the new
        > "improvements", if basic functionality like this goes out the window.
        >
        > Sorry, Jon. It was looking great there for a while, but this is too much.
        >
        > Regards,
        >
        > -Th
        >

        Hi Thomas,

        Thanks for the info and knee jerk reaction, just what I was looking for.

        M-x major-mode-setup

        will allow you to turn on 'C' indentation again this should restore what
        you had before. I'll make C mode the default and then leave the other
        method in for the 'Java pure' people.

        Regards
        Jon.
      • Jon Green
        ... OK, here is the next one! This time the default mode of operation is the built in indentation with the bracket alignment disabled. Note that your history
        Message 3 of 29 , Oct 5, 2006
        • 0 Attachment
          Thomas Hundt wrote:
          > Hold it. This release is unusable.
          >
          > Basic functionality has been broken:
          >
          > private static final Logger LOG =
          > Logger.getLogger(PeakHourReportRunner.class);
          >
          > now comes out as
          >
          > private static final Logger LOG =
          > Logger.getLogger(PeakHourReportRunner.class);
          >
          > and if-else statements come out as
          >
          > if (something)
          > do_something();
          > else
          > do_something_else();
          >
          > (Bryan feels the whole world should have to put in braces, but --
          > idealism aside -- I know I'm going to be editing plenty of peoples' code
          > without all the braces where he would like them. It IS a legitimate
          > Java feature not to have to put in extra braces where they aren't
          > necessary, and having the editor properly indent them will allow one to
          > find out where one screwed it up, right? I mean that is why we are
          > doing this, yes?)
          >
          > I'm rather have it work the way it used to, minus any of the new
          > "improvements", if basic functionality like this goes out the window.
          >
          > Sorry, Jon. It was looking great there for a while, but this is too much.
          >
          > Regards,
          >
          > -Th
          >

          OK, here is the next one!

          This time the default mode of operation is the built in indentation with
          the bracket alignment disabled.

          Note that your history will likely be retained so you will have to
          reconfigure the major mode to return to some default using

          M-x major-mode-setup

          The defaults are:

          Brace Hilighting:OFF
          Enable Bracket Alignment:OFF (Enables old brace alignment)
          Alternative Indent Mode:OFF (Pure Java mode)

          I understand that neither method is ideal. With the 'C' type indent then
          there are issues with "@" statements. These are not present in the
          Alternative indent - but this then needs to be fully bracketed.

          Regards
          Jon.
        • Bryan Schofield
          unfortunately, the indent syntax isn t powerful enough to describe the situtations needed. For example... if (true) continuedStatement(); if (true) {
          Message 4 of 29 , Oct 6, 2006
          • 0 Attachment
            unfortunately, the indent syntax isn't powerful enough to describe the
            situtations needed.

            For example...

            if (true)
            continuedStatement();

            if (true) {
            indentedStatement();
            }

            if (true)
            {
            indentedStatement();
            }

            I do not know how to tell indent that the next line is a continuation,
            unless it is a "{". I can write indent rules to handle the first 2 or
            the last 2 but not all 3 at the same time.


            indent .indent.java c "=\\s*$" t

            handles:

            private static final Logger LOG =
            Logger.getLogger(PeakHourReportRunner.class);
          • jon@jasspa.com
            ... Hi Bryan, We are aware of the short comings of the indentation. We have yet to come up with a better way of describing the indentation in terms of its
            Message 5 of 29 , Oct 6, 2006
            • 0 Attachment
              > unfortunately, the indent syntax isn't powerful enough to describe the
              > situtations needed.
              >
              > For example...
              >
              > if (true)
              > continuedStatement();
              >
              > if (true) {
              > indentedStatement();
              > }
              >
              > if (true)
              > {
              > indentedStatement();
              > }
              >
              > I do not know how to tell indent that the next line is a continuation,
              > unless it is a "{". I can write indent rules to handle the first 2 or
              > the last 2 but not all 3 at the same time.
              >
              >
              > indent .indent.java c "=\\s*$" t
              >
              > handles:
              >
              > private static final Logger LOG =
              > Logger.getLogger(PeakHourReportRunner.class);
              >

              Hi Bryan,

              We are aware of the short comings of the indentation. We have yet to come
              up with a better way of describing the indentation in terms of its
              grammer. At the moment we seem to do reasonably well with very little
              knowledge of the language in the template. All of the items that you have
              raised above require a little more information about the syntax in order
              to make them work properly. This is actually why C is burnt in because it
              is easier to handle it like this than coming up with all of the correct
              rules that are programmable.

              We have considered how we might express this, but so far have not come up
              with a sufficiently good way of minimally and generically describing the
              syntax of the target language for indentation.

              If anybody has any thoughts on how we can do this I would like to hear
              them because it is not trivial.

              Anybody looking for a Comp. Sci. project at University????

              Regards
              Jon.
            • Bryan Schofield
              I see I missed the official release... but the java indentation needs a little something to fix handling of Strings indent .indent.java e indent
              Message 6 of 29 , Oct 9, 2006
              • 0 Attachment
                I see I missed the official release... but the java indentation needs
                a little something to fix handling of Strings

                indent .indent.java e "\"" "\"" "\\"
                indent .indent.java e "\'" "\'" "\\"



                On 10/6/06, jon@... <jon@...> wrote:
                > > unfortunately, the indent syntax isn't powerful enough to describe the
                > > situtations needed.
                > >
                > > For example...
                > >
                > > if (true)
                > > continuedStatement();
                > >
                > > if (true) {
                > > indentedStatement();
                > > }
                > >
                > > if (true)
                > > {
                > > indentedStatement();
                > > }
                > >
                > > I do not know how to tell indent that the next line is a continuation,
                > > unless it is a "{". I can write indent rules to handle the first 2 or
                > > the last 2 but not all 3 at the same time.
                > >
                > >
                > > indent .indent.java c "=\\s*$" t
                > >
                > > handles:
                > >
                > > private static final Logger LOG =
                > > Logger.getLogger(PeakHourReportRunner.class);
                > >
                >
                > Hi Bryan,
                >
                > We are aware of the short comings of the indentation. We have yet to come
                > up with a better way of describing the indentation in terms of its
                > grammer. At the moment we seem to do reasonably well with very little
                > knowledge of the language in the template. All of the items that you have
                > raised above require a little more information about the syntax in order
                > to make them work properly. This is actually why C is burnt in because it
                > is easier to handle it like this than coming up with all of the correct
                > rules that are programmable.
                >
                > We have considered how we might express this, but so far have not come up
                > with a sufficiently good way of minimally and generically describing the
                > syntax of the target language for indentation.
                >
                > If anybody has any thoughts on how we can do this I would like to hear
                > them because it is not trivial.
                >
                > Anybody looking for a Comp. Sci. project at University????
                >
                > Regards
                > Jon.
                >
                >
                >
                > __________________________________________________________________________
                >
                > This is an unmoderated list. JASSPA is not responsible for the content of
                > any material posted to this list.
                >
                > To unsubscribe, send a mail message to
                >
                > mailto:jasspa-unsubscribe@yahoogroups.com
                >
                > or visit http://groups.yahoo.com/group/jasspa and
                > modify your account settings manually.
                >
                >
                >
                > Yahoo! Groups Links
                >
                >
                >
                >
                >
                >
                >
                >
                >
                >
              • Bryan Schofield
                Perhaps you add in a hook to allow a function to specified as the last argument in an indent rule. This function would return an indicator on whether the
                Message 7 of 29 , Oct 9, 2006
                • 0 Attachment
                  Perhaps you add in a hook to allow a function to specified as the last
                  argument in an indent rule. This function would return an indicator on
                  whether the indent rule should actually be applied. The function could
                  be passed the line number and do whatever language-specific analysis
                  is required.

                  indent .indent.java c "if.*)\\s*$" t java-check-if

                  define-macro java-check-if
                  ; @1 = line number
                  ; ...
                  set-variable $result true
                  !emacro
                • jon@jasspa.com
                  ... OK Thanks, As it turns out it looks like we need a patch to jst.etf so I can slip this one in as well as they are both macro problems. Fortunately there
                  Message 8 of 29 , Oct 9, 2006
                  • 0 Attachment
                    > I see I missed the official release... but the java indentation needs
                    > a little something to fix handling of Strings
                    >
                    > indent .indent.java e "\"" "\"" "\\"
                    > indent .indent.java e "\'" "\'" "\\"
                    >

                    OK Thanks,

                    As it turns out it looks like we need a patch to jst.etf so I can slip
                    this one in as well as they are both macro problems. Fortunately there are
                    no binary problems at the moment, but does mean that some of the packages
                    have to be re-built.

                    This is why one release per year is more than enough for us! As usual it
                    does look like there are some more sweeping changes in the pipeline that
                    will come fairly soon after the release on the development side however we
                    cannot afford to delay this release any longer because of the amount of
                    time it takes us to prove it is stable.

                    As an aside: In building the 2006 release I was forced back to 20050505 on
                    some platforms where I had not installed 2006 yet and was surprised by
                    some of the features that were missing (e.g. being able to delete
                    directories in the file browser, infact all of the file browser controls).
                    Obviously most users will not be aware of this but we have been using
                    these internally for the last year and miss them when they are not there -
                    hence we really cannot delay this release any more.

                    Regards
                    Jon.
                  • jon@jasspa.com
                    ... I think you are right. I did try and prototype this type of schema about a year ago and got into a real mess because of problems with the macro context
                    Message 9 of 29 , Oct 9, 2006
                    • 0 Attachment
                      > Perhaps you add in a hook to allow a function to specified as the last
                      > argument in an indent rule. This function would return an indicator on
                      > whether the indent rule should actually be applied. The function could
                      > be passed the line number and do whatever language-specific analysis
                      > is required.
                      >
                      > indent .indent.java c "if.*)\\s*$" t java-check-if
                      >
                      > define-macro java-check-if
                      > ; @1 = line number
                      > ; ...
                      > set-variable $result true
                      > !emacro

                      I think you are right.

                      I did try and prototype this type of schema about a year ago and got into
                      a real mess because of problems with the macro context (i.e. you are in a
                      macro that then calls back into native and then want to come out and run a
                      macro again) - anyway I ran out of time doing some other stuff. I do
                      believe that this is the way to go but have not found enough time to
                      follow it through to a conclusion and get it working.

                      The only problem with this type of scheme is if you mess up in your macro
                      the editor will die a horrible death - error recovery is likely to be
                      difficult.

                      Jon.
                    Your message has been successfully submitted and would be delivered to recipients shortly.