'Find the completions and create the AutoCompleteWindow.
Return True if successful (no syntax error or so found).
if complete is True, then if there\'s nothing to complete and no
start of completion, won\'t open completions and return False.
If mode is given, will open a completion list only in this mode.'

def open_completions(self, evalfuncs, complete, userWantsWin, mode=None):

    if (self._delayed_completion_id is not None):
        self.text.after_cancel(self._delayed_completion_id)
        self._delayed_completion_id = None
    hp = HyperParser(self.editwin, 'insert')
    curline = self.text.get('insert    linestart', 'insert')
    i = j = len(curline)
    if (hp.is_in_string() and ((not mode) or (mode == COMPLETE_FILES))):
        self._remove_autocomplete_window()
        mode = COMPLETE_FILES
        while (i and (curline[(i - 1)] not in ('\'"' + SEPS))):
            i -= 1
        comp_start = curline[i:j]
        j = i
        while (i and (curline[(i - 1)] not in '\'"')):
            i -= 1
        comp_what = curline[i:j]
    elif (hp.is_in_code() and ((not mode) or (mode == COMPLETE_ATTRIBUTES))):
        self._remove_autocomplete_window()
        mode = COMPLETE_ATTRIBUTES
        while (i and ((curline[(i - 1)] in ID_CHARS) or (ord(curline[(i - 1)]) > 127))):
            i -= 1
        comp_start = curline[i:j]
        if (i and (curline[(i - 1)] == '.')):
            hp.set_index(('insert-%dc' % (len(curline) - (i - 1))))
            comp_what = hp.get_expression()
            if ((not comp_what) or ((not evalfuncs) and (comp_what.find('(') != (-1)))):
                return None
        else:
            comp_what = ''
    else:
        return None
    if (complete and (not comp_what) and (not comp_start)):
        return None
    comp_lists = self.fetch_completions(comp_what, mode)
    if (not comp_lists[0]):
        return None
    self.autocompletewindow = self._make_autocomplete_window()
    return (not self.autocompletewindow.show_window(comp_lists, ('insert-%dc' % len(comp_start)), complete, mode, userWantsWin))
