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

[PATCH] Add runtime files for the Clojure programming language

Expand Messages
  • Sung Pae
    Hello, Attached is a patch adding runtime files (syntax, indent, ftplugin, and an autoloaded completion script) for the Clojure programming language. In 2007,
    Message 1 of 8 , Jan 30, 2013
    • 0 Attachment
      Hello,

      Attached is a patch adding runtime files (syntax, indent, ftplugin, and
      an autoloaded completion script) for the Clojure programming language.

      In 2007, Toralf Wittner posted a vim syntax script to the Clojure
      mailing list, and in 2008 Meikel Brandmeyer included it in VimClojure,
      a sophisticated Clojure development plugin. Meikel authored indent and
      ftplugin scripts for VimClojure and developed these files through 2012.

      Earlier this month¹ I became the maintainer for the static portion of
      VimClojure and re-released it as vim-clojure-static². I have since
      refined and prepared it for inclusion into the Vim source tree so that
      new Clojure users may have builtin support when editing Clojure (*.clj)
      and ClojureScript (*.cljs) files.

      I am eager to see Vim ship with Clojure support and am ready to answer
      any questions about the implementation.

      Thank you,
      Sung Pae

      ¹ https://groups.google.com/forum/?fromgroups=#!topic/vimclojure/B-UU8qctd5A
      ² https://github.com/guns/vim-clojure-static
    • Bram Moolenaar
      ... Thanks. I ll include the files later. Please don t forget to send me updates when you make improvements. -- There can t be a crisis today, my schedule is
      Message 2 of 8 , Jan 31, 2013
      • 0 Attachment
        Sung Pae wrote:

        > Attached is a patch adding runtime files (syntax, indent, ftplugin, and
        > an autoloaded completion script) for the Clojure programming language.
        >
        > In 2007, Toralf Wittner posted a vim syntax script to the Clojure
        > mailing list, and in 2008 Meikel Brandmeyer included it in VimClojure,
        > a sophisticated Clojure development plugin. Meikel authored indent and
        > ftplugin scripts for VimClojure and developed these files through 2012.
        >
        > Earlier this month=C2=B9 I became the maintainer for the static portion of
        > VimClojure and re-released it as vim-clojure-static=C2=B2. I have since
        > refined and prepared it for inclusion into the Vim source tree so that
        > new Clojure users may have builtin support when editing Clojure (*.clj)
        > and ClojureScript (*.cljs) files.
        >
        > I am eager to see Vim ship with Clojure support and am ready to answer
        > any questions about the implementation.

        Thanks. I'll include the files later.

        Please don't forget to send me updates when you make improvements.

        --
        There can't be a crisis today, my schedule is already full.

        /// 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.
      • Sung Pae
        ... Hello, A few bugs have been fixed and a couple of syntax keywords added over the past week since I submitted the first patch. Changes include: * Fix for
        Message 3 of 8 , Feb 5, 2013
        • 0 Attachment
          On Thu, Jan 31, 2013 at 09:28:07PM +0100, Bram Moolenaar wrote:

          > Sung Pae wrote:
          >
          > > Attached is a patch adding runtime files (syntax, indent, ftplugin,
          > > and an autoloaded completion script) for the Clojure programming
          > > language.
          >
          > Thanks. I'll include the files later.
          >
          > Please don't forget to send me updates when you make improvements.

          Hello,

          A few bugs have been fixed and a couple of syntax keywords added over
          the past week since I submitted the first patch. Changes include:

          * Fix for literal octal character notation
          * Standardize bracket groups for compatibility with third-party
          rainbow paren scripts
          * Refine some regexps for syntax matches
          * Replace complicated custom top cluster with contains=TOP

          I have attached both a patch against current hg HEAD and an incremental
          diff to see differences from the last patch.

          Thank you,
          Sung Pae
        • Bram Moolenaar
          ... I have included the files now. The syntax file is using the old style HiLink command. You can just use hi def . The syntax file changes the iskeyword
          Message 4 of 8 , Feb 6, 2013
          • 0 Attachment
            Sung Pae wrote:

            > > > Attached is a patch adding runtime files (syntax, indent, ftplugin,
            > > > and an autoloaded completion script) for the Clojure programming
            > > > language.
            > >
            > > Thanks. I'll include the files later.
            > >
            > > Please don't forget to send me updates when you make improvements.
            >
            > Hello,
            >
            > A few bugs have been fixed and a couple of syntax keywords added over
            > the past week since I submitted the first patch. Changes include:
            >
            > * Fix for literal octal character notation
            > * Standardize bracket groups for compatibility with third-party
            > rainbow paren scripts
            > * Refine some regexps for syntax matches
            > * Replace complicated custom top cluster with contains=TOP
            >
            > I have attached both a patch against current hg HEAD and an incremental
            > diff to see differences from the last patch.

            I have included the files now.

            The syntax file is using the old style HiLink command. You can just use
            "hi def".

            The syntax file changes the 'iskeyword' option. This has many side
            effects. Can you use "syn match" instead of "syn keyword" and avoid
            setting 'iskeyword'?

            --
            Shaw's Principle: Build a system that even a fool can use, and
            only a fool will want to use it.

            /// 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.
          • Sung Pae
            ... Gladly. I believe this was simply cargo-culted from existing syntax files. Should I also remove the if version
            Message 5 of 8 , Feb 6, 2013
            • 0 Attachment
              On Wed, Feb 06, 2013 at 04:06:01PM +0100, Bram Moolenaar wrote:

              > The syntax file is using the old style HiLink command. You can just
              > use "hi def".

              Gladly. I believe this was simply cargo-culted from existing syntax
              files. Should I also remove the

              if version < 600
              syntax clear


              at the top of the file, since the apparent reason for HiLink is
              backwards compatibility?

              > The syntax file changes the 'iskeyword' option. This has many side
              > effects. Can you use "syn match" instead of "syn keyword" and avoid
              > setting 'iskeyword'?

              The Clojure language, being a Lisp, accepts many non-word characters in
              its identifiers¹, so the purpose of augmenting 'iskeyword' is not just
              for the benefit of the `syntax keyword` definitions.

              The existing suite of Vim plugins that are designed to work with these
              runtime files actually assume these additions to 'iskeyword' in order to
              find word boundaries, so removing this would cause breakage, and then
              plugin authors would simply augment 'iskeyword' themselves.

              However, I can see now that setting 'iskeyword' in the syntax file
              instead of the ftplugin is problematic because the setting becomes local
              to the buffer and not to the filetype, which will cause confusion if a
              user changes filetypes for a buffer.

              Do you think it is an acceptable compromise if I change the `syntax
              keyword` definitions to `syntax match` and move the 'iskeyword' setting
              to the ftplugin?

              Thank you for your attention.

              Sung Pae

              ¹ In Clojure, word boundaries are defined by whitespace, brackets, and
              metacharacters for the Lisp reader.

              For example, these functions and variables are in the standard lib:

              *command-line-args*
              list*
              ->
              cond->>
              zero?
              set!

              These non-word characters, along with a few others, are very widely
              used as identifiers in the Clojure community

              --
              --
              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
              ... There is no local to filetype . Filetype plugins make settings that are local to the buffer. When a user changes filetypes for a buffer, Vim and the
              Message 6 of 8 , Feb 6, 2013
              • 0 Attachment
                On 2013-02-06, Sung Pae wrote:

                > However, I can see now that setting 'iskeyword' in the syntax file
                > instead of the ftplugin is problematic because the setting becomes local
                > to the buffer and not to the filetype, which will cause confusion if a
                > user changes filetypes for a buffer.

                There is no "local to filetype". Filetype plugins make settings
                that are local to the buffer.

                When a user changes filetypes for a buffer, Vim and the filetype
                plugins take care of setting or resetting filetype-dependent
                buffer-local options appropriately.

                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.
              • Sung Pae
                ... I should clarify: I meant local to filetype in a loose way. Previously, the syntax file set `setlocal iskeyword+=…` instead of the ftplugin (where we
                Message 7 of 8 , Feb 6, 2013
                • 0 Attachment
                  On Wed, Feb 06, 2013 at 07:11:35PM -0800, Gary Johnson wrote:

                  > On 2013-02-06, Sung Pae wrote:
                  >
                  > > However, I can see now that setting 'iskeyword' in the syntax file
                  > > instead of the ftplugin is problematic because the setting becomes
                  > > local to the buffer and not to the filetype, which will cause
                  > > confusion if a user changes filetypes for a buffer.
                  >
                  > There is no "local to filetype". Filetype plugins make settings that
                  > are local to the buffer.
                  >
                  > When a user changes filetypes for a buffer, Vim and the filetype
                  > plugins take care of setting or resetting filetype-dependent
                  > buffer-local options appropriately.

                  I should clarify: I meant "local to filetype" in a loose way.
                  Previously, the syntax file set `setlocal iskeyword+=…` instead of the
                  ftplugin (where we can add 'setlocal iskeyword<' to b:undo_ftplugin).
                  Should the user open a new buffer then do:

                  :setf clojure | setf foo

                  The buffer will now have loaded foo's filetype settings, but will still
                  have the additions to 'iskeyword' from Clojure's syntax script since
                  this setting is buffer-local. This is broken and should be fixed.

                  Bram, I have attached new patches (cumulative and incremental as before)
                  with my proposed changes:

                  * HiLink command is replaced with 'hi def link' and the version
                  compat check with < 600 is removed.
                  * 'iskeyword' is moved to ftplugin/clojure.vim

                  I tried several variations of changing the `syntax keyword` definitions
                  to `syntax match`, but the performance degrades from 4-10x, depending on
                  the buffer. Both startup and scrolling are noticeably affected.

                  If I can convince you that iskeyword+=… is justified for the Clojure
                  filetype, then I think the syntax groups in question should remain in
                  `syntax keyword` form in the interest of performance.

                  Thank you,
                  Sung Pae
                • Ben Fritz
                  ... For what it s worth, I personally expect that iskeyword should reflect the rules for the specific filetype being edited. As long as the ftplugin sets it,
                  Message 8 of 8 , Feb 7, 2013
                  • 0 Attachment
                    On Wednesday, February 6, 2013 10:06:32 PM UTC-6, Sung Pae wrote:
                    >
                    > If I can convince you that iskeyword+=… is justified for the Clojure
                    >
                    > filetype, then I think the syntax groups in question should remain in
                    >
                    > `syntax keyword` form in the interest of performance.
                    >

                    For what it's worth, I personally expect that 'iskeyword' should reflect the rules for the specific filetype being edited.

                    As long as the ftplugin sets it, and also includes a reset in the b:undo_ftplugin variable, I don't see a problem with it.

                    --
                    --
                    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.