refactor completers
commitc17ada48c2013760455d663003a8d9fc2544435c
authorJohn Foerch <jjfoerch@earthlink.net>
Sun, 22 Dec 2013 23:35:59 +0000 (22 18:35 -0500)
committerJohn Foerch <jjfoerch@earthlink.net>
Thu, 1 May 2014 17:53:56 +0000 (1 13:53 -0400)
tree3bbcf1f792782883649150d6991fcd098bf94aac
parenta6d7244af1977495a5b2390bec2f3ed152dbe70c
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:
modules/array.js
modules/buffer.js
modules/commands.js
modules/completers.js [new file with mode: 0644]
modules/conkeror.js
modules/content-buffer.js
modules/download-manager.js
modules/element.js
modules/history.js
modules/index-webjump.js
modules/media.js
modules/minibuffer-completion.js [deleted file]
modules/minibuffer-read-file.js
modules/minibuffer-read-mime-type.js
modules/minibuffer-read.js
modules/opensearch.js
modules/spawn-process.js
modules/string.js
modules/utils.js
modules/webjump.js
tests/simple/completers.js [new file with mode: 0644]
tests/simple/index-webjump.js
tests/simple/webjump.js