- (or (company-continue-or-cancel)
- (let (prefix)
- (dolist (backend company-backends)
- (unless (fboundp backend)
- (ignore-errors (require backend nil t)))
- (if (fboundp backend)
- (when (setq prefix (funcall backend 'prefix))
- (when (company-should-complete prefix)
- (setq company-backend backend
- company-prefix prefix
- company-candidates
- (funcall company-backend 'candidates prefix)
- company-common
- (let ((completion-ignore-case (funcall backend
- 'ignore-case)))
- (try-completion prefix company-candidates))
- company-selection 0
- company-point (point))
- (unless (funcall company-backend 'sorted)
- (setq company-candidates
- (sort company-candidates 'string<)))
- (company-call-frontends 'update))
- (return prefix))
- (unless (memq backend company-disabled-backends)
- (push backend company-disabled-backends)
- (message "Company back-end '%s' could not be initialized"
- backend))))
- (unless (and company-candidates
- (not (eq t company-common)))
- (company-cancel)))))
+ (company-continue)
+ (unless company-candidates
+ (let (prefix)
+ (dolist (backend company-backends)
+ (unless (fboundp backend)
+ (ignore-errors (require backend nil t)))
+ (if (fboundp backend)
+ (when (setq prefix (funcall backend 'prefix))
+ (when (company-should-complete prefix)
+ (setq company-backend backend
+ company-prefix prefix
+ company-candidates
+ (funcall company-backend 'candidates prefix)
+ company-selection 0)
+ (unless (funcall company-backend 'sorted)
+ (setq company-candidates
+ (sort company-candidates 'string<)))
+ (company-call-frontends 'update))
+ (return prefix))
+ (unless (memq backend company-disabled-backends)
+ (push backend company-disabled-backends)
+ (message "Company back-end '%s' could not be initialized"
+ backend))))))
+ (if (or (not company-candidates)
+ (eq t (let ((completion-ignore-case (funcall company-backend
+ 'ignore-case)))
+ (setq company-common
+ (try-completion company-prefix company-candidates)))))
+ (company-cancel)
+ (setq company-point (point))))