]> code.delx.au - gnu-emacs-elpa/blobdiff - company-elisp.el
Merge pull request #531 from juergenhoetzel/master
[gnu-emacs-elpa] / company-elisp.el
index 5bfc27e043fee12b431a4ec5c16b3846de5f4ce9..3db0d8b83f0b5e73df484999eda1df67b85357c9 100644 (file)
@@ -1,4 +1,4 @@
-;;; company-elisp.el --- company-mode completion back-end for Emacs Lisp -*- lexical-binding: t -*-
+;;; company-elisp.el --- company-mode completion backend for Emacs Lisp -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2009, 2011-2013  Free Software Foundation, Inc.
 
 ;;; Code:
 
 (require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
 (require 'help-mode)
 (require 'find-func)
 
 (defgroup company-elisp nil
-  "Completion back-end for Emacs Lisp."
+  "Completion backend for Emacs Lisp."
   :group 'company)
 
 (defcustom company-elisp-detect-function-context t
@@ -131,14 +131,14 @@ first in the candidates list."
                             (when (looking-at "[ \t\n]*(")
                               (down-list 1))
                             (when (looking-at regexp)
-                              (pushnew (match-string-no-properties 1) res)))
+                              (cl-pushnew (match-string-no-properties 1) res)))
                           (forward-sexp))
                       (scan-error nil)))
                    ((unless functions-p
                       (looking-at company-elisp-var-binding-regexp-1))
                     (down-list 1)
                     (when (looking-at regexp)
-                      (pushnew (match-string-no-properties 1) res)))))))))
+                      (cl-pushnew (match-string-no-properties 1) res)))))))))
       (scan-error nil))
     res))
 
@@ -146,9 +146,9 @@ first in the candidates list."
   (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)))
+         (locals (cl-loop for local in locals
+                          when (not (member local globals))
+                          collect local)))
     (if company-elisp-show-locals-first
         (append (sort locals 'string<)
                 (sort globals 'string<))
@@ -193,11 +193,11 @@ first in the candidates list."
 
 ;;;###autoload
 (defun company-elisp (command &optional arg &rest ignored)
-  "`company-mode' completion back-end for Emacs Lisp."
+  "`company-mode' completion backend for Emacs Lisp."
   (interactive (list 'interactive))
-  (case command
+  (cl-case command
     (interactive (company-begin-backend 'company-elisp))
-    (prefix (and (eq (derived-mode-p 'emacs-lisp-mode) 'emacs-lisp-mode)
+    (prefix (and (derived-mode-p 'emacs-lisp-mode 'inferior-emacs-lisp-mode)
                  (company-elisp--prefix)))
     (candidates (company-elisp-candidates arg))
     (sorted company-elisp-show-locals-first)