]> code.delx.au - gnu-emacs-elpa/commitdiff
company-grab-lisp-symbol -> company-elisp--prefix; mark other privates
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 31 Mar 2013 15:58:49 +0000 (19:58 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 31 Mar 2013 16:16:02 +0000 (20:16 +0400)
company-elisp.el
company-tests.el

index a27edaedec3366499c17810859bc9a596f667e99..53b48855cc2d84604ba78026e4c3dfc31fd0c357 100644 (file)
@@ -44,7 +44,7 @@ first in the candidates list."
   :type '(choice (const :tag "Off" nil)
                  (const :tag "On" t)))
 
-(defun company-grab-lisp-symbol ()
+(defun company-elisp--prefix ()
   (let ((prefix (company-grab-symbol)))
     (if prefix
         (unless (and (company-in-string-or-comment)
@@ -52,7 +52,7 @@ first in the candidates list."
           prefix)
       'stop)))
 
-(defun company-elisp-predicate (symbol)
+(defun company-elisp--predicate (symbol)
   (or (boundp symbol)
       (fboundp symbol)
       (facep symbol)
@@ -75,7 +75,7 @@ first in the candidates list."
   (concat "\\_<\\(?:cl-\\)?" (regexp-opt '("flet" "labels")) "\\*?\\_>")
   "Regular expression matching head of a function bindings form.")
 
-(defun company-elisp-locals (prefix functions-p)
+(defun company-elisp--locals (prefix functions-p)
   (let ((regexp (concat "[ \t\n]*\\(\\_<" (regexp-quote prefix)
                         "\\(?:\\sw\\|\\s_\\)*\\_>\\)"))
         (pos (point))
@@ -114,9 +114,9 @@ first in the candidates list."
     res))
 
 (defun company-elisp-candidates (prefix)
-  (let* ((predicate (company-elisp-candidates-predicate prefix))
-         (locals (company-elisp-locals prefix (eq predicate 'fboundp)))
-         (globals (company-elisp-globals prefix predicate))
+  (let* ((predicate (company-elisp--candidates-predicate prefix))
+         (locals (company-elisp--locals prefix (eq predicate 'fboundp)))
+         (globals (company-elisp--globals prefix predicate))
          (locals (loop for local in locals
                        when (not (member local globals))
                        collect local)))
@@ -125,10 +125,10 @@ first in the candidates list."
                 (sort globals 'string<))
       (append locals globals))))
 
-(defun company-elisp-globals (prefix predicate)
+(defun company-elisp--globals (prefix predicate)
   (all-completions prefix obarray predicate))
 
-(defun company-elisp-candidates-predicate (prefix)
+(defun company-elisp--candidates-predicate (prefix)
   (let* ((completion-ignore-case nil)
          (before (char-before (- (point) (length prefix)))))
     (if (and company-elisp-detect-function-context
@@ -146,9 +146,9 @@ first in the candidates list."
                            (looking-at company-elisp-var-binding-regexp))))))
             'fboundp
           'boundp)
-      'company-elisp-predicate)))
+      'company-elisp--predicate)))
 
-(defun company-elisp-doc (symbol)
+(defun company-elisp--doc (symbol)
   (let* ((symbol (intern symbol))
          (doc (if (fboundp symbol)
                   (documentation symbol t)
@@ -164,10 +164,10 @@ first in the candidates list."
   (case command
     (interactive (company-begin-backend 'company-elisp))
     (prefix (and (eq (derived-mode-p 'emacs-lisp-mode) 'emacs-lisp-mode)
-                 (company-grab-lisp-symbol)))
+                 (company-elisp--prefix)))
     (candidates (company-elisp-candidates arg))
     (sorted company-elisp-show-locals-first)
-    (meta (company-elisp-doc arg))
+    (meta (company-elisp--doc arg))
     (doc-buffer (let ((symbol (intern arg)))
                   (save-window-excursion
                     (ignore-errors
index d053965c4646591d9f8f501302c69f629c5a6021..011b67fb7857cd825ea30d509786d68bc443dd56 100644 (file)
   (company-elisp-with-buffer
     "(foo ba|)"
     (should (eq (let ((company-elisp-detect-function-context t))
-                  (company-elisp-candidates-predicate "ba"))
+                  (company-elisp--candidates-predicate "ba"))
                 'boundp))
     (should (eq (let (company-elisp-detect-function-context)
-                  (company-elisp-candidates-predicate "ba"))
-                'company-elisp-predicate)))
+                  (company-elisp--candidates-predicate "ba"))
+                'company-elisp--predicate)))
   (company-elisp-with-buffer
     "(foo| )"
     (should (eq (let ((company-elisp-detect-function-context t))
-                  (company-elisp-candidates-predicate "foo"))
+                  (company-elisp--candidates-predicate "foo"))
                 'fboundp))
     (should (eq (let (company-elisp-detect-function-context)
-                  (company-elisp-candidates-predicate "foo"))
-                'company-elisp-predicate)))
+                  (company-elisp--candidates-predicate "foo"))
+                'company-elisp--predicate)))
   (company-elisp-with-buffer
     "(foo 'b|)"
     (should (eq (let ((company-elisp-detect-function-context t))
-                  (company-elisp-candidates-predicate "b"))
-                'company-elisp-predicate))))
+                  (company-elisp--candidates-predicate "b"))
+                'company-elisp--predicate))))
 
 ;; This one's also an integration test.
 (ert-deftest company-elisp-candidates-recognizes-binding-form ()
         (bar t)
         (baz t))
     (should (equal '("bar" "baz")
-                   (company-elisp-globals "ba" 'boundp)))))
+                   (company-elisp--globals "ba" 'boundp)))))
 
 (ert-deftest company-elisp-finds-functions ()
   (let ((obarray [when what whelp])
         (what t)
         (whelp t))
     (should (equal '("when")
-                   (company-elisp-globals "wh" 'fboundp)))))
+                   (company-elisp--globals "wh" 'fboundp)))))
 
 (ert-deftest company-elisp-finds-things ()
   (let ((obarray [when what whelp])
         (what t)
         (whelp t))
     (should (equal '("what" "whelp" "when")
-                   (sort (company-elisp-globals "wh" 'company-elisp-predicate)
+                   (sort (company-elisp--globals "wh" 'company-elisp--predicate)
                          'string<)))))
 
 (ert-deftest company-elisp-locals-vars ()
          (lambda (boo baz)
            b|)))"
     (should (equal '("bar" "baz" "boo")
-                   (company-elisp-locals "b" nil)))))
+                   (company-elisp--locals "b" nil)))))
 
 (ert-deftest company-elisp-locals-single-var ()
   (company-elisp-with-buffer
        (dolist (item items)
          it|))"
     (should (equal '("itk" "item")
-                   (company-elisp-locals "it" nil)))))
+                   (company-elisp--locals "it" nil)))))
 
 (ert-deftest company-elisp-locals-funs ()
   (company-elisp-with-buffer
        (let ((fun 4))
          (f| )))"
     (should (equal '("fee" "foo")
-                   (sort (company-elisp-locals "f" t) 'string<)))))
+                   (sort (company-elisp--locals "f" t) 'string<)))))
 
 (ert-deftest company-elisp-locals-skips-current-varlist ()
   (company-elisp-with-buffer
     "(let ((foo 1)
            (f| )))"
-    (should (null (company-elisp-locals "f" nil)))))
+    (should (null (company-elisp--locals "f" nil)))))
 
 (ert-deftest company-elisp-show-locals-first ()
   (company-elisp-with-buffer