The following notes are derived from the reply to a question about adding an emacspeak interface to Versor.
Most versor commands have a macro wrapped around most of the command,
defined in versor-commands.el.
versor-as-versor-command is a recent hack to let me turn versor
off quickly, thus making eligible to be a minor mode; if
versor-mode is nil, it just looks for whatever was previously
on the key that triggered this command, and runs that instead.
More interesting is
versor-as-motion-command (probably a bit of
a misnomer by now) which is what updates the versor selection
highlight at the end of each command. To do this, it calls
versor-clear-current-item-indication before running the main
logic of the command, to get rid of the old highlight, then after
running the command-specific code that it is wrapped around, it calls
versor-indicate-current-item, which does the complicated bit.
After that, it runs any functions on
versor-indicate-current-item is probably the thing to advise,
but I'm happy to include emacspeak-specific code in it. It first
checks whether the internal variables indicating the selection have
been set (by the command-specific logic calling
it is a multi-part selection); if they haven't, it uses a heuristic to
set them, again using
versor-indicate-current-item, which is
what generates the colourful overlays.
Then it (
versor-describe-selection on the selection, which gets a
description of the selection, puts it in the echo area, and calls
versor-speak, which is my rudimentary attempt to interface to
I'm already planning to upgrade
(which is part of languide) to give more information. From the versor
/ languide point of view, it is probably the best place to get more
As it stands now, it calls some mode-specific stuff (using
modal-functions.el, which is part of the download) to discover stuff
about the specified part of a buffer. Each mode's definition (see
languide-lisp-like.el, languide-c-like.el for the current support)
defines a function
languide-region-type which returns things like
defun-body, to describe the specified text.
also set the variable
languide-region-detail-string to give more
region-type-description converts the result of
languide-region-type into human-readable text.
There is another function which could be used to give more information
that should probably be spoken, which is
establish-current-statement, which works out the statement type
at point. If
languide-region-type says that the text is a
establish-current-statement could be used to
tell you what the statement is; if it is multiple statements, it could
be used several times, to describe the region (or selection when used
by versor) succintly.