]> code.delx.au - gnu-emacs-elpa/commitdiff
Make sure completing stops further automatic completion.
authorNikolaj Schumacher <git@nschum.de>
Wed, 11 Mar 2009 13:23:38 +0000 (14:23 +0100)
committerNikolaj Schumacher <git@nschum.de>
Thu, 19 Mar 2009 19:56:00 +0000 (20:56 +0100)
company.el

index cd7237a4f167576abd791eab7615ca4fed397b5d..8eb9477b36e64ba58665f88e508f4f0419becd6f 100644 (file)
                            company-idle-delay))
     (remove-hook 'pre-command-hook 'company-pre-command t)
     (remove-hook 'post-command-hook 'company-post-command t)
-    (company-cancel)))
+    (company-cancel)
+    (kill-local-variable 'company-point)))
 
 ;;; backends ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defun company-idle-begin ()
   (and company-mode
        (not company-candidates)
+       (not (equal (point) company-point))
        (let ((company-idle-delay t))
          (company-begin)
          (company-post-command))))
   (company-pseudo-tooltip-hide)
   (company-echo-hide))
 
+(defun company-abort ()
+  (company-cancel)
+  ;; Don't start again, unless started manually.
+  (setq company-point (point)))
+
 (defun company-pre-command ()
   (company-preview-hide)
   (company-pseudo-tooltip-hide)
 (defun company-complete-selection ()
   (interactive)
   (when (company-manual-begin)
-    (insert (company-strip-prefix (nth company-selection company-candidates)))))
+    (insert (company-strip-prefix (nth company-selection company-candidates)))
+    (company-abort)))
 
 (defun company-complete-common ()
   (interactive)