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

62766Re: racket (:mz) SEGV's vim

Expand Messages
  • Tim Brown
    Oct 5, 2011
    • 0 Attachment
      Please find attached a patch for the following issue:

      :mzscheme could be invoked before the mzscheme/racket libraries were
      initialised, e.g. in startup scripts and on the command line.

      Therefore the following would SEGV:
      vim +':mz 1'

      Even though:
      :mz 1
      works when editing a file.

      mzscheme expects to be invoked by a "trampoline" that wraps around the
      main() of the embedding environment -- and this trampoline is around
      main_loop().

      exe_pre_commands() and source_startup_scripts() are outside the scope
      of the trampoline.

      This patch causes main() to be called in two parts. The first part
      sets up vim's environment and globals, but does not execute any vim
      commands (as far as I can tell). It then calls to mzscheme_init, which
      eventually recurs into main(); which skips the initialisation, and
      proceeds with anything that may perform commands.

      Notes:
      * I pass fname and params between invocations of main() through the
      static variables save_mz_fname and save_mz_params. There is
      justification at the top of main() for doing so. I'm not so keen on
      statics, myself -- so I've not re-declared fname and params
      themselves.
      * The other option would be to split main into two parts -- an
      "initialisation" and a "commands" part. Then start up vim with:
      main(argc, argv)
      calls mzscheme_init(argc, argv, fname, params)
      calls ... main_part2(argc, argv, fname, params)

      [or, in the case of !FEAT_MZSCHEME: main(argc,argv) calls
      main_part2(argc, argv, fname, params)]

      I think I've done enough in main already! And, unless there is more
      general merit in such a refactoring, this is as much disruption as I
      need to cause :-)

      Thanks Sergey and Bram for your help!

      Tim

      --
      | Tim Brown <tim.brown@...> | M:+44(0)7771714159 | H:01372747875 |

      --
      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
    • Show all 29 messages in this topic