The purpose of this task is to add documentation to the interface and
internals in a programmatic way using
Here are some notes taken in 2012 while thinking about the problems related to this task. Please note that they might not be up to date. In particular some of these ideas might have already been implemented or dropped.
In a first approximation, a list of the available shortcuts should be compiled depending on the current mode and presented in a new buffer. Besides each shortcut, the corresponding menu entry (see below for some comments on the menu tag) should be displayed along with a little explanation and link to relevant documentation. Although highly desirable, this feature is far from optimal: it would be best to allow configuration of the shortcuts at the same place where they are displayed. Maybe implement a shortcut editor?
Every action the user can take using the interface should be documented. Besides the obvious tooltip, one mechanism to achieve it is a “What's this?” feature. Here are some requirements and ideas related to it.
Popups should be full
All menu items should be documented in a standard location for documentation: "doc/some/module/maindoc.tm#funcname", for instance. The documentation should be command dependent: relocating the commands in new menus or widgets should have no effect.
The documentation of a particular item should reflect the places
where this item is accesible. For instance, the documentation for
“Update all” should include the fact that the command
is accessible via
A new “What's this?” mode should be added to the editor:
S+F1 should pop up the “What's this?” balloon for the widget under the pointer or at least enter the mode and let the user click on anything he wants explained. Then ESC or some key to exit it.
Better: just pressing some modifier key activates this mode: any click over a widget should tell it to display its “What's this” information. This can be sent up the chain of widgets until someone catches it.
The mouse pointer should change to an arrow with a question mark or something similar.
Support for the feature must be added to abstract widgets, WidKit and the Qt port. This is needed to better document dialogs, since items in dialogs have no meaning isolated from the others or aren't even linked to commands, as is the case for forms.
There is already a
(tm-widget (tooltip)
(balloon "Some nice text" "Some nice
tooltip"))
Scheme]
(show tooltip)
Scheme]
But what we'd like is balloon to provide a tooltip for the widget it encloses
We want a SLOT_WHATSTHIS (do we?). How do we implement it, exactly? Keep in mind that the popup must support full texmacs trees.
Maybe new properties for widgets: string whatsthis; url docs;
Problem: things will inevitably go out of sync. A possibility is to add a timestamp check on the module definition file and the documentation file, then warn the user in the help page or even in the popup that the docs might be outdated (ugly).
Some steps have been taken with the items in the menu
Detailed documentation of each exported function and each module in TeXmacs. This should include functions in the glue. In progress, but this is a huge task.
Contextual help inside scheme tags and sessions and open scheme files. Either using right click and a menu, or some modifer + click to jump directly to the docs (use the same as in the “what's this?” feature). See link-navigate.scm. A side panel could be showing them constantly. (Done, but the list of symbols is not complete. Needs a real parser.)
This includes seeing the documentation as well as being able to edit it, for example adding a menu item to help buffers: "Save documentation". This would really help to improve the docs.
Add some "Search in public functions…"
which does not grep. It has to be fast. (Done
with the widget in
Tab completion inside scheme sessions and open scheme files. This includes a list with the arguments of functions and their type (extra markup needed in the docs to tag this). (In progress: the list is incomplete (no glued functions, no builtin functions) and no parameters. Needs a real parser.)
Make everything inside scm, scm-code tags clickable using something like Alt++Click to navigate. Done.
Things will go out of sync. Some time-stamping or checksum is necessary to check whether the docs might be outdated. Alternatively, developers should be very careful of updating their documentation.
The list of available modules and exported functions is huge. Keeping the documentation in conventional files organized in directories can become a mess. But a central database can be bad for version control.
Modules documentation
This is an example of the format the module documentation has (we make
extensive use of folds and links which won't display on the web). To
see it in TeXmacs use the
(synopsis for the module, as found in the
code)
Module family:
Dependencies:
Total exported symbols:
35
Undocumented symbols:
33
The amazing tasks performed by the functions in this module can be succintly described as follows: first they do things, then other things. They specifically check the flux capacitor and the inverted space compressor in a recursive, non-regressive but intrinsically aggresive way. |
This function takes argumens with, and
args which must be of type
Example…
(with bla (absolute-function some arg) (do this and that))
Source code…
(tm-define (absolute-function some arg) (perform-ultimate-computation) 42)
This function takes argumens with, and
args which must be of type
Click the link to jump to that line in the file. Here you have lines of context:
(list ,@(map (lambda (m) `(list ,@(compile-interface-spec m))) modules)))) ;; FIXME: why does this not work? ;; (define-macro (import-from . modules) ;; (define (import-from-body module) ;; `(module-use! (current-module) (resolve-module ',module)))
Click the link to jump to that line in the file. Here you have lines of context:
(if (guile-a?) (define-macro (define-public-macro head . body) `(define-public ,(car head) ;; FIXME: why can't we use procedure->macro ;; for a non-memoizing variant? (procedure->memoizing-macro (lambda (cmd env) (apply (lambda ,(cdr head) ,@body) (cdr cmd)))))))
Add a menu entry with the "documentation tree". Clicking on an item should add a link to that section in the current document. Maybe a tree representation in the side panel would be better.
The link shouldn't be a simple hlink tag. Use a specific tag which substitutes either the title of the section (while browsing the manual online) or the chapter/section number (if in book mode).
Problem: the current help menu is built manually in help-menu.scm, no tree is available, so we'd have to traverse the docs first and build it (maybe check the manual generation routines).
Some of the things considered above are first steps to TeXmacs as an IDE to itself, with other desirable features being:
Jump to code when clicking on an item in the GUI.
Setting breakpoints inside open scheme files.
Having a scheme session in a split window. This is already achievable with the new widgets, but having a REPL acting on the “main” buffer would be cool.
Reliable mechanism to reload modules.
Jump to the definition of any symbol clicking on it. Done, but needs a real parser. Yes, yes…