refactor completers
This is a squashed commit of the branch refactor-completers, not including
the feature read-url-kill-item, which will hopefully be in a forthcoming
patch.
The completions system is refactored into an object-oriented design. This
makes it easier to understand and more flexible, for accomodating new
features in the future. Completions are now typed objects. Related
systems such as webjumps and index-webjump have also been refactored and
updated. Read-file-path and friends have also been refactored (a major
reason for the whole project) and issue77 (insertion of space instead of
path separator) has been resolved.
* Breaking Changes
- completers are now instantiated with the 'new' keyword, so calls like
"all_word_completer(...)" become "new all_word_completer(...)".
- javascript_completer no longer treats the current buffer or window as
special. Instead of taking a buffer as its argument, it takes any
object, and that object is the scope from which it draws completions.
- define_webjump keyword $description was renamed to $doc.
- define_webjump keyword $argument has been removed. It was found
unnecessary for this value to be provided explicitly by webjumps, as
it can be derived from other webjump properties.
- get_shell_command_completer replaced by shell_command_completer.
- 'require_match' is now a property of webjumps instead of a property of
completions objects. Further discussion of this change is here below:
Nested completers present a hard problem with respect to the
require_match property, and where exactly this flag belongs when a
nested completer, like webjump_completer, needs it (in some cases).
As a UI concern, it is clear that it breaks abstraction to use
completions objects to carry this flag from webjump to reader, and
it necessitates overmuch plumbing to do so. It makes more sense to
put the property on webjumps, because it is in a very literal sense
a property of the webjumps that a match is required. But the reader
doesn't know anything about webjumps, so in order to communicate
with the reader, we need to carry the flag from webjump to reader
via the completer. This still needs explicit support from
merged_completer, and it is still a break of abstraction, but a
lesser one, and we eliminate fragile checks for the
'get_require_match' property to dispatch special behavior.
23 files changed: