Xavier de Gaye wrote: > On Fri, May 17, 2013 at 9:22 PM, Bram Moolenaar wrote: > > > > ZyX wrote: > > > >> > Interesting. So we would have a $VIMRUNTIME/python directory and we can > >> > put Python scripts there that we include with the distribution. > >> > > >> > I'm sure it is only a small step that users will ask to have a python > >> > directory in ~/.vim/python. Or more general, using 'runtimepath'. > >> > > >> > Then a plugin does not require to have its Python code in between a > >> > :python << EOF and EOF. That would be a lot nicer, right? > >> > > >> > What do others think? > >> > >> Automatically adding all items from `&rtp` to sys.path would be good. > >> It (and python3/) is already a standard directory in frawor for python > >> files. > >> > >> But I would vote against the patch to os.chdir implemented in python > >> and (as there is no better variant) for the solution based on > >> comparing current directories before and after `os.chdir`: > >> > >> 1. Implementation based on comparing current directories can be > >> written once and easily applied to all other interfaces. > >> 2. `os.chdir` is most common, but not the only way to change > >> directories from python: there are also at least `posix.chdir` and > > os.fchdir can also be used to change the current directory. > New patch attached. > > The alternative to this low level hook suggested by Bram is to check > wether the current directory has changed at the end of the invocation > of each ':python' command. However this last solution does not handle > the case when the current directory is being changed from within > another python thread (multi-threading is not possible in the > vim-python interface at the moment).
Thanks. Yeah, multi-threading can be very tricky. Let's not try to optimize something that likely happens infrequently and then create an obscure bug. -- Living on Earth includes an annual free trip around the Sun. /// Bram Moolenaar -- [email protected] -- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
