]> code.delx.au - gnu-emacs-elpa/commitdiff
Add experimental backend command 'common
authorDmitry Gutov <dgutov@yandex.ru>
Thu, 21 Mar 2013 17:10:08 +0000 (21:10 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Thu, 21 Mar 2013 18:13:12 +0000 (22:13 +0400)
NEWS.md
company-clang.el
company.el

diff --git a/NEWS.md b/NEWS.md
index de36cbde3e7bff1b23755802395af42c83f287cc..0be44ad7e4536d1a5460e81e3bbb7e7128532b94 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
 
 ## Next
 
+* `company-clang` ObjC arguments template insertion now requires explicit user action.
 * `company-clang-objc-templatify` does not insert spaces after colons anymore.
 * `company-clang` is now only initialized in supported buffers.
   So, no error messages if you don't have Clang until you open a C file.
index 7fc66a93b9c0e725fb7e731e89589e59f0e8f13e..6135f24d00400be3d787182052288ed1d581c59c 100644 (file)
@@ -239,6 +239,9 @@ Completions only work correctly when the buffer has been saved.
                "#]" " "
                (replace-regexp-in-string "[<{[]#\\|#[>}]" "" meta t)
                t))))
+    (common (and (derived-mode-p 'objc-mode)
+                 (string-match ":" arg)
+                 (substring arg 0 (match-beginning 0))))
     (post-completion (and (derived-mode-p 'objc-mode)
                           (string-match ":" arg)
                           (company-clang-objc-templatify arg)))))
index df758e10e75553439873ad3c475fba49e3646f5d..fe87eed697945834b3bb9ece4fafd6a1c3f979f9 100644 (file)
@@ -787,7 +787,9 @@ can retrieve meta-data for them."
   (push (cons company-prefix company-candidates) company-candidates-cache)
   ;; Calculate common.
   (let ((completion-ignore-case (company-call-backend 'ignore-case)))
-    (setq company-common (try-completion company-prefix company-candidates)))
+    (let ((common (try-completion company-prefix company-candidates)))
+      (setq company-common (or (company-call-backend 'common common)
+                               common))))
   (when (eq company-common t)
     (setq company-candidates nil)))
 
@@ -823,9 +825,9 @@ can retrieve meta-data for them."
              (or (cdr candidates)
                  (not (eq t (compare-strings (car candidates) nil nil
                                              prefix nil nil ignore-case)))))
-        ;; Don't start when already completed and unique.
         candidates
-      ;; Not the right place? maybe when setting?
+      ;; Already completed and unique; don't start.
+      ;; FIXME: Not the right place? maybe when setting?
       (and company-candidates t))))
 
 (defun company-idle-begin (buf win tick pos)