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

Re: [jasspa] Turning off auto-indent

Expand Messages
  • Jon Green
    ... I think you asked this before a very long time ago. FAQ(26) http://www.jasspa.com/me/amicr067.html Regards Jon.
    Message 1 of 8 , Sep 9, 2009
    • 0 Attachment
      Jeremy Cowgar wrote:
      > How can I turn off "smart" indent for all modes? i.e. when I type
      >
      > if (1) { ENTER
      >
      > I do not want it to automatically indent. I find that auto-indent works
      > most of the time, but not in every situation, it then makes it hard to
      > indent properly on those cases it fails. I do want it to keep the
      > previous line's indent, for example, say you are inside of the above IF
      > statement, and you have manually indented 4 spaces (1 tab or whatever),
      > and you hit enter. I want it to copy the previous line's indent.
      >
      > Thanks,
      >
      > Jeremy
      >

      I think you asked this before a very long time ago.

      FAQ(26) http://www.jasspa.com/me/amicr067.html

      Regards
      Jon.

      >
      >
      > ------------------------------------
      >
      > __________________________________________________________________________
      >
      > This is an unmoderated list, but new members are moderated to ensure that there are no spam users. JASSPA is not responsible for the content of
      > any material posted to this list.
      >
      > To un-subscribe, 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
      >
      >
      >
      >
    • Steven Phillips
      Wow, that FAQ is showing its age! Since then we have added major-mode-setup (Tools - Major mode setup) you probably want to use this instead as it disables
      Message 2 of 8 , Sep 9, 2009
      • 0 Attachment
        Wow, that FAQ is showing its age! Since then we have added major-mode-setup (Tools -> Major mode setup) you probably want to use this instead as it disables the auto indent for any files of the current buffer type forever.

        Steve

        Jon Green wrote:
         

        Jeremy Cowgar wrote:
        > How can I turn off "smart" indent for all modes? i.e. when I type
        >
        > if (1) { ENTER
        >
        > I do not want it to automatically indent. I find that auto-indent works
        > most of the time, but not in every situation, it then makes it hard to
        > indent properly on those cases it fails. I do want it to keep the
        > previous line's indent, for example, say you are inside of the above IF
        > statement, and you have manually indented 4 spaces (1 tab or whatever),
        > and you hit enter. I want it to copy the previous line's indent.
        >
        > Thanks,
        >
        > Jeremy
        >

        I think you asked this before a very long time ago.

        FAQ(26) http://www.jasspa. com/me/amicr067. html

        Regards
        Jon.

        >
        >
        > ------------ --------- --------- ------
        >
        > ____________ _________ _________ _________ _________ _________ _
        >
        > This is an unmoderated list, but new members are moderated to ensure that there are no spam users. JASSPA is not responsible for the content of
        > any material posted to this list.
        >
        > To un-subscribe, 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
        >
        >
        >
        >

      • Jeremy Cowgar
        On Wed, 09 Sep 2009 19:00:59 -0400, Steven Phillips ... I can make this work for C/C++ but it does not seem to work on my own mode. I am
        Message 3 of 8 , Sep 14, 2009
        • 0 Attachment
          On Wed, 09 Sep 2009 19:00:59 -0400, Steven Phillips <bill@...>
          wrote:

          > Wow, that FAQ is showing its age! Since then we have added
          > major-mode-setup (Tools -> Major mode setup) you probably want to use
          > this instead as it disables the auto indent for any files of the current
          > buffer type forever.
          >

          I can make this work for C/C++ but it does not seem to work on my own
          mode. I am unsure what I am doing. I have all sorts of indents that makes
          almost all things work but a common formatting method in Euphoria cannot
          be supported by the indent scheme and the indenting of the other items
          causes this to really mess up, so I have to get rid of all indenting :-/

          The mode I am using is: http://jeremy.cowgar.com/files/hkeuphoria.emf

          When I turn off "Indent" in the Major Mode Setup, it seems to still
          indent. An example file you can test with is simply:

          procedure abc()
          if 1 then
          puts(1, "Hello, World!\n")
          end if
          end procedure

          Does anyone have an idea what I am doing wrong in my mode that causes me
          to not allow ignoring of the Smart Indent stuff? If I comment out all of
          the indent code, then indent of course does not work. However, it will not
          even remember the previous lines indent. i.e.

          procedure abc()
          if 1 then -- ENTER
          ^ this is where my cursor goes, I would have expected it to be at the same
          indent level as "if"

          Jeremy
        • Jon Green
          ... Hi Jeremy, I think your buffer-init mask is set up incorrectly, you currently have: set-variable .fhook-euphoria.setup ® /history/fhook/euphoria
          Message 4 of 8 , Sep 14, 2009
          • 0 Attachment
            Jeremy Cowgar wrote:
            > On Wed, 09 Sep 2009 19:00:59 -0400, Steven Phillips <bill@...>
            > wrote:
            >
            >> Wow, that FAQ is showing its age! Since then we have added
            >> major-mode-setup (Tools -> Major mode setup) you probably want to use
            >> this instead as it disables the auto indent for any files of the current
            >> buffer type forever.
            >>
            >
            > I can make this work for C/C++ but it does not seem to work on my own
            > mode. I am unsure what I am doing. I have all sorts of indents that makes
            > almost all things work but a common formatting method in Euphoria cannot
            > be supported by the indent scheme and the indenting of the other items
            > causes this to really mess up, so I have to get rid of all indenting :-/
            >
            > The mode I am using is: http://jeremy.cowgar.com/files/hkeuphoria.emf
            >
            > When I turn off "Indent" in the Major Mode Setup, it seems to still
            > indent. An example file you can test with is simply:
            >
            > procedure abc()
            > if 1 then
            > puts(1, "Hello, World!\n")
            > end if
            > end procedure
            >
            > Does anyone have an idea what I am doing wrong in my mode that causes me
            > to not allow ignoring of the Smart Indent stuff? If I comment out all of
            > the indent code, then indent of course does not work. However, it will not
            > even remember the previous lines indent. i.e.
            >
            > procedure abc()
            > if 1 then -- ENTER
            > ^ this is where my cursor goes, I would have expected it to be at the same
            > indent level as "if"
            >
            > Jeremy
            >

            Hi Jeremy,

            I think your buffer-init mask is set up incorrectly, you currently have:

            set-variable .fhook-euphoria.setup ® "/history/fhook/euphoria"
            "bdfghnopxlqv"
            set-variable .fhook-euphoria.setup-mask "abdefghikmnoptuxclqrvy"


            I would suggest that these are not quite correct and should be using:

            ; buffer-init variables
            set-variable .fhook-euphoria.setup ® "/history/fhook/euphoria"
            "bdfghnopx"
            set-variable .fhook-euphoria.setup-mask "abdefghikmnoptux"
            set-variable .fhook-euphoria.comment "|/*| */|*| * | * |fr|"
            set-variable .fhook-euphoria.comment-1 "|--||--|-- | --|r|"
            set-variable .fhook-euphoria.indent-width 4

            That seems to work OK when I ran it and then turned auto-indent off.

            So when you run up buffer-setup then you need to:

            a) Turn off Use-auto indent (turns off the auto indent!)
            b) Enable indent (This lines up with the previous line)

            I do not think you had "indent" enabled if it goes back to the beginning
            of the line.

            The indentation in the example provided seemed to work OK. Have you got
            an example where it is failing for you and messing up?

            Thanks
            Jon.

            >
            > ------------------------------------
            >
            > __________________________________________________________________________
            >
            > This is an unmoderated list, but new members are moderated to ensure that there are no spam users. JASSPA is not responsible for the content of
            > any material posted to this list.
            >
            > To un-subscribe, 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
            >
            >
            >
            >
          • Jeremy Cowgar
            ... Ok, thanks, that did work as I was expecting. ... Yes. I believe we have went over this before and the answer was that it s not possible. All the current
            Message 5 of 8 , Sep 14, 2009
            • 0 Attachment
              On Mon, 14 Sep 2009 17:04:38 -0400, Jon Green <jon@...> wrote:

              > I would suggest that these are not quite correct and should be using:
              >
              > ; buffer-init variables
              > set-variable .fhook-euphoria.setup ® "/history/fhook/euphoria"
              > "bdfghnopx"
              > set-variable .fhook-euphoria.setup-mask "abdefghikmnoptux"
              > set-variable .fhook-euphoria.comment "|/*| */|*| * | * |fr|"
              > set-variable .fhook-euphoria.comment-1 "|--||--|-- | --|r|"
              > set-variable .fhook-euphoria.indent-width 4
              >
              > That seems to work OK when I ran it and then turned auto-indent off.
              >
              > So when you run up buffer-setup then you need to:
              >
              > a) Turn off Use-auto indent (turns off the auto indent!)
              > b) Enable indent (This lines up with the previous line)
              >
              > I do not think you had "indent" enabled if it goes back to the beginning
              > of the line.
              >

              Ok, thanks, that did work as I was expecting.

              > The indentation in the example provided seemed to work OK. Have you got
              > an example where it is failing for you and messing up?
              >

              Yes. I believe we have went over this before and the answer was that it's
              not possible. All the current constructs work. What doesn't work is:

              public constant
              ABC = "abc",
              DEF = "def",
              XYZ = "xyz"

              Now, to make matters worse:

              public enum
              --** User ID
              USER_ID,
              --** User name (code used to login as)
              USER_NAME,
              --** The real name of the user
              USER_REALNAME

              if 10 then
              bye()
              end if

              Sort of got the , at the end of the line to indent properly, however I
              could not make it stop indenting when a line was reached that didn't
              contain a comma.

              Jeremy
            • Bryan Schofield
              This may not be appropriate for your euphoria language mode, but I ve solved a complex indent/highlight problem by switching schemes in the middle. For
              Message 6 of 8 , Sep 14, 2009
              • 0 Attachment
                This may not be appropriate for your euphoria language mode, but I've
                solved a complex indent/highlight problem by switching schemes in the
                middle. For example, on the "alternate" java (hkjava.emf) I switch
                to .indent.java-comm indent scheme when I detect the start of block
                comment, then later switch back to .indent.java.

                Perhaps you could create an extra .indent.euphoria-const indent scheme
                that handles the "public constant" and "public enum" case only.

                HTML mode does trickery with switching indent schemes, too.

                If memory serves, indent <scheme> "t" and indent <scheme> "x" are used.

                Cheers
                -- bryan

                On Sep 14, 2009, at 5:18 PM, "Jeremy Cowgar" <jeremy@...> wrote:

                > On Mon, 14 Sep 2009 17:04:38 -0400, Jon Green <jon@...> wrote:
                >
                >> I would suggest that these are not quite correct and should be using:
                >>
                >> ; buffer-init variables
                >> set-variable .fhook-euphoria.setup ® "/history/fhook/euphoria"
                >> "bdfghnopx"
                >> set-variable .fhook-euphoria.setup-mask "abdefghikmnoptux"
                >> set-variable .fhook-euphoria.comment "|/*| */|*| * | * |fr|"
                >> set-variable .fhook-euphoria.comment-1 "|--||--|-- | --|r|"
                >> set-variable .fhook-euphoria.indent-width 4
                >>
                >> That seems to work OK when I ran it and then turned auto-indent off.
                >>
                >> So when you run up buffer-setup then you need to:
                >>
                >> a) Turn off Use-auto indent (turns off the auto indent!)
                >> b) Enable indent (This lines up with the previous line)
                >>
                >> I do not think you had "indent" enabled if it goes back to the
                >> beginning
                >> of the line.
                >>
                >
                > Ok, thanks, that did work as I was expecting.
                >
                >> The indentation in the example provided seemed to work OK. Have you
                >> got
                >> an example where it is failing for you and messing up?
                >>
                >
                > Yes. I believe we have went over this before and the answer was that
                > it's
                > not possible. All the current constructs work. What doesn't work is:
                >
                > public constant
                > ABC = "abc",
                > DEF = "def",
                > XYZ = "xyz"
                >
                > Now, to make matters worse:
                >
                > public enum
                > --** User ID
                > USER_ID,
                > --** User name (code used to login as)
                > USER_NAME,
                > --** The real name of the user
                > USER_REALNAME
                >
                > if 10 then
                > bye()
                > end if
                >
                > Sort of got the , at the end of the line to indent properly, however I
                > could not make it stop indenting when a line was reached that didn't
                > contain a comma.
                >
                > Jeremy
                >
                >
                > ------------------------------------
                >
                > __________________________________________________________________________


                >
                > This is an unmoderated list, but new members are moderated to ensure
                > that there are no spam users. JASSPA is not responsible for the
                > content of
                > any material posted to this list.
                >
                > To un-subscribe, 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
                >
                >
                >
              • Jon Green
                ... Hi Bryan, I looked at this last night running multiple schemes using a block ending of ^ s*$ (empty line). It worked for all of the given examples when
                Message 7 of 8 , Sep 15, 2009
                • 0 Attachment
                  Bryan Schofield wrote:
                  > This may not be appropriate for your euphoria language mode, but I've
                  > solved a complex indent/highlight problem by switching schemes in the
                  > middle. For example, on the "alternate" java (hkjava.emf) I switch
                  > to .indent.java-comm indent scheme when I detect the start of block
                  > comment, then later switch back to .indent.java.
                  >
                  > Perhaps you could create an extra .indent.euphoria-const indent scheme
                  > that handles the "public constant" and "public enum" case only.
                  >
                  > HTML mode does trickery with switching indent schemes, too.
                  >
                  > If memory serves, indent <scheme> "t" and indent <scheme> "x" are used.
                  >
                  > Cheers
                  > -- bryan
                  >

                  Hi Bryan,

                  I looked at this last night running multiple schemes using a block
                  ending of "^\\s*$" (empty line). It worked for all of the given examples
                  when working in-line however failed for a restyle-buffer. The problem is
                  that there is not a good anchor to end the block. Using a blank line is
                  also very spurious as there are too many of them.

                  I know Jeremy tried anchoring on the ',', but given that this also
                  appears in bracketed expressions then this is not a good choice. Also it
                  fails for the construct which includes the comments.

                  It is quite a nasty construct and I was thinking you almost want
                  something like a indent 'c' (continue) which ends when it reaches a
                  blank line. ('c' in its current form will not work either).

                  Still thinking about it.

                  Regards
                  Jon

                  >>
                  >> public constant
                  >> ABC = "abc",
                  >> DEF = "def",
                  >> XYZ = "xyz"
                  >>
                  >> Now, to make matters worse:
                  >>
                  >> public enum
                  >> --** User ID
                  >> USER_ID,
                  >> --** User name (code used to login as)
                  >> USER_NAME,
                  >> --** The real name of the user
                  >> USER_REALNAME
                  >>
                  >> if 10 then
                  >> bye()
                  >> end if
                  >>
                  >> Sort of got the , at the end of the line to indent properly, however I
                Your message has been successfully submitted and would be delivered to recipients shortly.