Another step towards HyDE
Posted April 06, 2016 at 04:41 PM | categories: hylang | tags:
(In case that isn't clear, it is a Python with a Lisp, and somewhat how I feel trying to see what this is all about ;)
I have been chipping away at HyDE, the Hy Development Environment. So far I have reasonable support for eldoc in hy code, and some integration into lispy.
The executive summary here is:
- We have a first approach at getting eldoc to work.
- We have better integration with lispy, including the inline describe and arg functionality, and jump to symbol.
You may want to just watch the video to see what it is about: https://www.youtube.com/watch?v=m62oiB6Feeo
The full details of these implementations are described at the end of this post. For now, we just load the functionality here:
Some examples of usage:
(list (butlast [12 34 56]))
For details of the implementations see the following discussion.
- Setting up hy-mode with a repl (partly from lispy)
- an eldoc function
- some hooks for hy-mode to setup some functionality.
- A hy src block expansion template for org-mode
- the contents of what I previously called ob-hy.el
These things don't work without the code at https://github.com/jkitchin/hy/blob/hydoc/hy/core/hylp.hy which provides some hy functions to get eldoc strings, and file locations. These are still work in progress, but functional at this point.
I also adapted some parts of lispy to support hy better in my fork:
These are not fully ready to be integrated to lispy yet, as the functionality here depends on the hy code (in hylp.hy) that isn't part of hy yet. I hacked lispy anyway to see how easy it would be to extend it for hy. So far, it looks promising.
All of these put together lead to:
- eldoc support in hy code
- lispy support for C-1 descriptions and C-2 args inline.
- lispy support for M-. to jump to symbol definitions (although it is a tad hacky and uses hy to generate an org-link to open the code files at the line of the definition ;).
It is far from fully functional and there are some issues to resolve. The code will also probably change as I resolve some of those issues, but it works well enough to put some ideas out there. Feedback is welcome!
The eldoc functions work pretty well for the hy stuff. They don't work too well on the python side. The function at https://github.com/jkitchin/hy/blob/hydoc/hy/core/hylp.hy#L120 is where some improvement is needed. Right now it really only catches a few types of symbols.
For learning hylang a documentation sprint would be great.
- Add examples to the functions.
- Add documentation to the compiler @build definitions. Find a way to make this discoverable the way they are for functions and macros.
- Figure out how to get Python help in. It might be confusing because the syntax and examples will be different.
Copyright (C) 2016 by John Kitchin. See the License for information about copying.
Org-mode version = 8.2.10