[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 28/35: Use cl-lib
From: |
Dmitry Gutov |
Subject: |
[elpa] 28/35: Use cl-lib |
Date: |
Sat, 19 Apr 2014 10:12:20 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 8f2c03248b5517d82588a05f357805cbb0f384ed
Author: Bozhidar Batsov <address@hidden>
Date: Wed Apr 9 18:25:01 2014 +0300
Use cl-lib
---
company-abbrev.el | 4 +-
company-bbdb.el | 12 +++---
company-capf.el | 10 ++--
company-clang.el | 8 ++--
company-cmake.el | 4 +-
company-css.el | 4 +-
company-dabbrev-code.el | 4 +-
company-dabbrev.el | 8 ++--
company-eclim.el | 14 +++---
company-elisp-tests.el | 16 ++++----
company-elisp.el | 14 +++---
company-etags.el | 4 +-
company-files.el | 6 +-
company-gtags.el | 4 +-
company-ispell.el | 4 +-
company-keywords.el | 4 +-
company-nxml.el | 10 ++--
company-oddmuse.el | 6 +-
company-pysmell.el | 4 +-
company-ropemacs.el | 4 +-
company-semantic.el | 4 +-
company-template.el | 16 ++++----
company-tempo.el | 4 +-
company-tests.el | 39 ++++++++---------
company-xcode.el | 4 +-
company-yasnippet.el | 3 +-
company.el | 108 +++++++++++++++++++++++-----------------------
27 files changed, 161 insertions(+), 161 deletions(-)
diff --git a/company-abbrev.el b/company-abbrev.el
index 0c4e327..a454aaa 100644
--- a/company-abbrev.el
+++ b/company-abbrev.el
@@ -26,7 +26,7 @@
;;; Code:
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(require 'abbrev)
(defun company-abbrev-insert (match)
@@ -37,7 +37,7 @@
(defun company-abbrev (command &optional arg &rest ignored)
"`company-mode' completion back-end for abbrev."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-abbrev
'company-abbrev-insert))
(prefix (company-grab-symbol))
diff --git a/company-bbdb.el b/company-bbdb.el
index 8e4705f..acdd30a 100644
--- a/company-bbdb.el
+++ b/company-bbdb.el
@@ -20,7 +20,7 @@
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(declare-function bbdb-record-get-field "bbdb")
(declare-function bbdb-records "bbdb")
@@ -31,17 +31,17 @@
(defun company-bbdb (command &optional arg &rest ignore)
"`company-mode' completion back-end for `bbdb'."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-bbdb))
(prefix (and (eq major-mode 'message-mode)
(featurep 'bbdb-com)
(looking-back "^\\(To\\|Cc\\|Bcc\\):.*"
(line-beginning-position))
(company-grab-symbol)))
- (candidates (mapcan (lambda (record)
- (mapcar (lambda (mail) (bbdb-dwim-mail record mail))
- (bbdb-record-get-field record 'mail)))
- (bbdb-search (bbdb-records) arg nil arg)))
+ (candidates (cl-mapcan (lambda (record)
+ (mapcar (lambda (mail) (bbdb-dwim-mail record
mail))
+ (bbdb-record-get-field record 'mail)))
+ (bbdb-search (bbdb-records) arg nil arg)))
(sorted t)
(no-cache t)))
diff --git a/company-capf.el b/company-capf.el
index 17be772..04f8413 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -25,7 +25,7 @@
;;; Code:
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defvar company--capf-data nil)
(make-variable-buffer-local 'company--capf-data)
@@ -38,10 +38,10 @@
(defun company--capf-data ()
;; Ignore tags-completion-at-point-function because it subverts company-etags
;; in the default value of company-backends, where the latter comes later.
- (letf* (((default-value 'completion-at-point-functions) nil)
- (data (run-hook-wrapped 'completion-at-point-functions
- ;; Ignore misbehaving functions.
- #'completion--capf-wrapper 'optimist)))
+ (cl-letf* (((default-value 'completion-at-point-functions) nil)
+ (data (run-hook-wrapped 'completion-at-point-functions
+ ;; Ignore misbehaving functions.
+ #'completion--capf-wrapper 'optimist)))
(when (and (consp (cdr data)) (numberp (nth 1 data))) data)))
(defun company-capf (command &optional arg &rest _args)
diff --git a/company-clang.el b/company-clang.el
index 4c7b0c7..14b6753 100644
--- a/company-clang.el
+++ b/company-clang.el
@@ -27,7 +27,7 @@
(require 'company)
(require 'company-template)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defgroup company-clang nil
"Completion back-end for Clang."
@@ -115,7 +115,7 @@ or automatically through a custom
`company-clang-prefix-guesser'."
"objective-c" "objective-c++")
(substring (symbol-name major-mode) 0 -5)))
-(defun company-clang--parse-output (prefix objc)
+(defun company-clang--parse-output (prefix _objc)
(goto-char (point-min))
(let ((pattern (format company-clang--completion-pattern
(regexp-quote prefix)))
@@ -277,7 +277,7 @@ or automatically through a custom
`company-clang-prefix-guesser'."
(if (< (point) end)
(insert " ")
(throw 'stop t))
- (incf cnt))))
+ (cl-incf cnt))))
(company-template-move-to-first templ)))
(defun company-clang (command &optional arg &rest ignored)
@@ -293,7 +293,7 @@ With Clang versions before 2.9, we have to save the buffer
before
performing completion. With Clang 2.9 and later, buffer contents are
passed via standard input."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-clang))
(init (when (memq major-mode company-clang-modes)
(unless company-clang-executable
diff --git a/company-cmake.el b/company-cmake.el
index 34359dc..a466f60 100644
--- a/company-cmake.el
+++ b/company-cmake.el
@@ -25,8 +25,8 @@
;;; Code:
-(eval-when-compile (require 'cl))
(require 'company)
+(require 'cl-lib)
(defgroup company-cmake nil
"Completion back-end for CMake."
@@ -112,7 +112,7 @@ They affect which types of symbols we get completion
candidates for.")
"`company-mode' completion back-end for CMake.
CMake is a cross-platform, open-source make system."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-cmake))
(init (when (memq major-mode company-cmake-modes)
(unless company-cmake-executable
diff --git a/company-css.el b/company-css.el
index 11e195a..c4154c2 100644
--- a/company-css.el
+++ b/company-css.el
@@ -24,7 +24,7 @@
;;; Code:
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defconst company-css-property-alist
;; see http://www.w3.org/TR/CSS21/propidx.html
@@ -280,7 +280,7 @@ Returns \"\" if no property found, but feasible at this
position."
(defun company-css (command &optional arg &rest ignored)
"`company-mode' completion back-end for `css-mode'."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-css))
(prefix (and (derived-mode-p 'css-mode)
(or (company-grab company-css-tag-regexp 1)
diff --git a/company-dabbrev-code.el b/company-dabbrev-code.el
index 6f827cd..1039e4a 100644
--- a/company-dabbrev-code.el
+++ b/company-dabbrev-code.el
@@ -27,7 +27,7 @@
(require 'company)
(require 'company-dabbrev)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defgroup company-dabbrev-code nil
"dabbrev-like completion back-end for code."
@@ -80,7 +80,7 @@ See also `company-dabbrev-code-time-limit'."
The back-end looks for all symbols in the current buffer that aren't in
comments or strings."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-dabbrev-code))
(prefix (and (or (eq t company-dabbrev-code-modes)
(apply 'derived-mode-p company-dabbrev-code-modes))
diff --git a/company-dabbrev.el b/company-dabbrev.el
index c0cd0e0..ee3f658 100644
--- a/company-dabbrev.el
+++ b/company-dabbrev.el
@@ -26,7 +26,7 @@
;;; Code:
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defgroup company-dabbrev nil
"dabbrev-like completion back-end."
@@ -73,7 +73,7 @@ If you set this value to nil, you may also want to set
(while ,test
,@body
(and ,limit
- (eq (incf company-time-limit-while-counter) 25)
+ (eq (cl-incf company-time-limit-while-counter) 25)
(setq company-time-limit-while-counter 0)
(> (float-time (time-since ,start)) ,limit)
(throw 'done 'company-time-out))))))
@@ -123,14 +123,14 @@ If you set this value to nil, you may also want to set
limit ignore-comments))))
(and limit
(> (float-time (time-since start)) limit)
- (return))))
+ (cl-return))))
symbols))
;;;###autoload
(defun company-dabbrev (command &optional arg &rest ignored)
"dabbrev-like `company-mode' completion back-end."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-dabbrev))
(prefix (company-grab-word))
(candidates
diff --git a/company-eclim.el b/company-eclim.el
index 65fb215..24f05f5 100644
--- a/company-eclim.el
+++ b/company-eclim.el
@@ -32,7 +32,7 @@
(require 'company)
(require 'company-template)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defgroup company-eclim nil
"Completion back-end for Eclim."
@@ -45,7 +45,7 @@
(and (file-exists-p (setq file (expand-file-name "plugins"
eclipse-root)))
(setq file (car (last (directory-files file t "^org.eclim_"))))
(file-exists-p (setq file (expand-file-name "bin/eclim" file)))
- (return file)))))
+ (cl-return file)))))
(defcustom company-eclim-executable
(or (executable-find "eclim") (company-eclim-executable-find))
@@ -100,9 +100,9 @@ eclim can only complete correctly when the buffer has been
saved."
(let ((dir (company-eclim--project-dir)))
(when dir
(setq company-eclim--project-name
- (loop for project in (company-eclim--project-list)
- when (equal (cdr (assoc 'path project)) dir)
- return (cdr (assoc 'name project))))))))
+ (cl-loop for project in (company-eclim--project-list)
+ when (equal (cdr (assoc 'path project)) dir)
+ return (cdr (assoc 'name project))))))))
(defun company-eclim--candidates (prefix)
(interactive "d")
@@ -134,7 +134,7 @@ eclim can only complete correctly when the buffer has been
saved."
(all-completions prefix completions))))
(defun company-eclim--search-point (prefix)
- (if (or (plusp (length prefix)) (eq (char-before) ?.))
+ (if (or (cl-plusp (length prefix)) (eq (char-before) ?.))
(1- (point))
(point)))
@@ -163,7 +163,7 @@ Eclim version 1.7.13 or newer (?) is required.
Completions only work correctly when the buffer has been saved.
`company-eclim-auto-save' determines whether to do this automatically."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-eclim))
(prefix (and (derived-mode-p 'java-mode 'jde-mode)
buffer-file-name
diff --git a/company-elisp-tests.el b/company-elisp-tests.el
index 432d8ca..9b7cba3 100644
--- a/company-elisp-tests.el
+++ b/company-elisp-tests.el
@@ -80,14 +80,14 @@
(company-elisp-candidates "wh"))))))
(ert-deftest company-elisp-candidates-predicate-binding-without-value ()
- (loop for (text prefix predicate) in '(("(let (foo|" "foo" boundp)
- ("(let (foo (bar|" "bar" boundp)
- ("(let (foo) (bar|" "bar" fboundp))
- do
- (eval `(company-elisp-with-buffer
- ,text
- (should (eq ',predicate
- (company-elisp--candidates-predicate
,prefix)))))))
+ (cl-loop for (text prefix predicate) in '(("(let (foo|" "foo" boundp)
+ ("(let (foo (bar|" "bar" boundp)
+ ("(let (foo) (bar|" "bar" fboundp))
+ do
+ (eval `(company-elisp-with-buffer
+ ,text
+ (should (eq ',predicate
+ (company-elisp--candidates-predicate
,prefix)))))))
(ert-deftest company-elisp-finds-vars ()
(let ((obarray [boo bar baz backquote])
diff --git a/company-elisp.el b/company-elisp.el
index 0ea4c69..5efd8d0 100644
--- a/company-elisp.el
+++ b/company-elisp.el
@@ -26,7 +26,7 @@
;;; Code:
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(require 'help-mode)
(require 'find-func)
@@ -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<))
@@ -195,7 +195,7 @@ first in the candidates list."
(defun company-elisp (command &optional arg &rest ignored)
"`company-mode' completion back-end for Emacs Lisp."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-elisp))
(prefix (and (derived-mode-p 'emacs-lisp-mode 'inferior-emacs-lisp-mode)
(company-elisp--prefix)))
diff --git a/company-etags.el b/company-etags.el
index 6f4912f..8634103 100644
--- a/company-etags.el
+++ b/company-etags.el
@@ -25,8 +25,8 @@
;;; Code:
-(eval-when-compile (require 'cl))
(require 'company)
+(require 'cl-lib)
(require 'etags)
(defgroup company-etags nil
@@ -76,7 +76,7 @@ buffer automatically."
(defun company-etags (command &optional arg &rest ignored)
"`company-mode' completion back-end for etags."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-etags))
(prefix (and (apply 'derived-mode-p company-etags-modes)
(not (company-in-string-or-comment))
diff --git a/company-files.el b/company-files.el
index b897e3d..a450526 100644
--- a/company-files.el
+++ b/company-files.el
@@ -26,7 +26,7 @@
;;; Code:
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defun company-files-directory-files (dir prefix)
(ignore-errors
@@ -47,7 +47,7 @@
(let (file dir)
(and (dolist (regexp company-files-regexps)
(when (setq file (company-grab-line regexp 1))
- (return file)))
+ (cl-return file)))
(setq dir (file-name-directory file))
(not (string-match "//" dir))
(file-exists-p dir)
@@ -78,7 +78,7 @@
(defun company-files (command &optional arg &rest ignored)
"`company-mode' completion back-end existing file names."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-files))
(prefix (company-files-grab-existing-name))
(candidates (company-files-complete arg))
diff --git a/company-gtags.el b/company-gtags.el
index 6451007..0ae98d7 100644
--- a/company-gtags.el
+++ b/company-gtags.el
@@ -26,7 +26,7 @@
;;; Code:
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defgroup company-gtags nil
"Completion back-end for GNU Global."
@@ -75,7 +75,7 @@
(defun company-gtags (command &optional arg &rest ignored)
"`company-mode' completion back-end for GNU Global."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-gtags))
(prefix (and company-gtags-executable
(memq major-mode company-gtags-modes)
diff --git a/company-ispell.el b/company-ispell.el
index 3e599f0..1561bee 100644
--- a/company-ispell.el
+++ b/company-ispell.el
@@ -26,8 +26,8 @@
;;; Code:
(require 'company)
+(require 'cl-lib)
(require 'ispell)
-(eval-when-compile (require 'cl))
(defgroup company-ispell nil
"Completion back-end using Ispell."
@@ -56,7 +56,7 @@ If nil, use `ispell-complete-word-dict'."
(defun company-ispell (command &optional arg &rest ignored)
"`company-mode' completion back-end using Ispell."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-ispell))
(prefix (when (company-ispell-available)
(company-grab-word)))
diff --git a/company-keywords.el b/company-keywords.el
index 461fdf6..c700af7 100644
--- a/company-keywords.el
+++ b/company-keywords.el
@@ -26,7 +26,7 @@
;;; Code:
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defun company-keywords-upper-lower (&rest lst)
;; Upcase order is different for _.
@@ -218,7 +218,7 @@
(defun company-keywords (command &optional arg &rest ignored)
"`company-mode' back-end for programming language keywords."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-keywords))
(prefix (and (assq major-mode company-keywords-alist)
(not (company-in-string-or-comment))
diff --git a/company-nxml.el b/company-nxml.el
index 62e6e31..70e1c09 100644
--- a/company-nxml.el
+++ b/company-nxml.el
@@ -26,7 +26,7 @@
;;; Code:
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defvar rng-open-elements)
(defvar rng-validate-mode)
@@ -76,7 +76,7 @@
,@body)))
(defun company-nxml-tag (command &optional arg &rest ignored)
- (case command
+ (cl-case command
(prefix (and (derived-mode-p 'nxml-mode)
rng-validate-mode
(company-grab company-nxml-in-tag-name-regexp 1)))
@@ -86,7 +86,7 @@
(sorted t)))
(defun company-nxml-attribute (command &optional arg &rest ignored)
- (case command
+ (cl-case command
(prefix (and (derived-mode-p 'nxml-mode)
rng-validate-mode
(memq (char-after) '(?\ ?\t ?\n)) ;; outside word
@@ -99,7 +99,7 @@
(sorted t)))
(defun company-nxml-attribute-value (command &optional arg &rest ignored)
- (case command
+ (cl-case command
(prefix (and (derived-mode-p 'nxml-mode)
rng-validate-mode
(and (memq (char-after) '(?' ?\" ?\ ?\t ?\n)) ;; outside word
@@ -123,7 +123,7 @@
(defun company-nxml (command &optional arg &rest ignored)
"`company-mode' completion back-end for `nxml-mode'."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-nxml))
(prefix (or (company-nxml-tag 'prefix)
(company-nxml-attribute 'prefix)
diff --git a/company-oddmuse.el b/company-oddmuse.el
index 358d5ea..aa30f2a 100644
--- a/company-oddmuse.el
+++ b/company-oddmuse.el
@@ -26,7 +26,7 @@
;;; Code:
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(eval-when-compile (require 'yaooddmuse nil t))
(eval-when-compile (require 'oddmuse nil t))
@@ -34,7 +34,7 @@
"\\(\\<[A-Z][[:alnum:]]*\\>\\)\\|\\[\\[\\([[:alnum:]]+\\>\\|\\)")
(defun company-oddmuse-get-page-table ()
- (case major-mode
+ (cl-case major-mode
(yaoddmuse-mode (with-no-warnings
(yaoddmuse-get-pagename-table yaoddmuse-wikiname)))
(oddmuse-mode (with-no-warnings
@@ -44,7 +44,7 @@
(defun company-oddmuse (command &optional arg &rest ignored)
"`company-mode' completion back-end for `oddmuse-mode'."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-oddmuse))
(prefix (let ((case-fold-search nil))
(and (memq major-mode '(oddmuse-mode yaoddmuse-mode))
diff --git a/company-pysmell.el b/company-pysmell.el
index fdb1b78..d9cf86b 100644
--- a/company-pysmell.el
+++ b/company-pysmell.el
@@ -27,8 +27,8 @@
;;; Code:
-(eval-when-compile (require 'cl))
(require 'pysmell)
+(require 'cl-lib)
(defvar company-pysmell--available-p 'unknown)
(make-variable-buffer-local 'company-pysmell--available-p)
@@ -56,7 +56,7 @@
"`company-mode' completion back-end for pysmell.
This requires pysmell.el and pymacs.el."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-pysmell))
(prefix (and (derived-mode-p 'python-mode)
buffer-file-name
diff --git a/company-ropemacs.el b/company-ropemacs.el
index 0ba26e6..677c453 100644
--- a/company-ropemacs.el
+++ b/company-ropemacs.el
@@ -25,7 +25,7 @@
;;; Code:
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defun company-ropemacs--grab-symbol ()
(let ((symbol (company-grab-symbol)))
@@ -58,7 +58,7 @@
Depends on third-party code: Pymacs (both Python and Emacs packages),
rope, ropemacs and ropemode."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(init (when (and (derived-mode-p 'python-mode)
(not (fboundp 'rope-completions)))
(require 'pymacs)
diff --git a/company-semantic.el b/company-semantic.el
index 372a6f6..110d4fd 100644
--- a/company-semantic.el
+++ b/company-semantic.el
@@ -26,7 +26,7 @@
;;; Code:
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defvar semantic-idle-summary-function)
(declare-function semantic-documentation-for-tag "semantic/doc" )
@@ -121,7 +121,7 @@ Symbols are chained by \".\" or \"->\"."
(defun company-semantic (command &optional arg &rest ignored)
"`company-mode' completion back-end using CEDET Semantic."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-semantic))
(prefix (and (featurep 'semantic)
(semantic-active-p)
diff --git a/company-template.el b/company-template.el
index ab18016..d689183 100644
--- a/company-template.el
+++ b/company-template.el
@@ -21,7 +21,7 @@
;;; Code:
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defface company-template-field
'((((background dark)) (:background "yellow" :foreground "black"))
@@ -59,8 +59,8 @@
(let* ((start (point))
(templates (company-template-templates-at (point)))
(minimum (apply 'max (mapcar 'overlay-end templates)))
- (fields (loop for templ in templates
- append (overlay-get templ 'company-template-fields))))
+ (fields (cl-loop for templ in templates
+ append (overlay-get templ
'company-template-fields))))
(dolist (pos (mapcar 'overlay-start fields))
(and pos
(> pos (point))
@@ -71,9 +71,9 @@
(company-template-remove-field (company-template-field-at start))))
(defun company-template-field-at (&optional point)
- (loop for ovl in (overlays-at (or point (point)))
- when (overlay-get ovl 'company-template-parent)
- return ovl))
+ (cl-loop for ovl in (overlays-at (or point (point)))
+ when (overlay-get ovl 'company-template-parent)
+ return ovl))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -98,7 +98,7 @@
"Add new field to template TEMPL at POS, inserting TEXT.
When DISPLAY is non-nil, set the respective property on the overlay.
Leave point at the end of the field."
- (assert templ)
+ (cl-assert templ)
(goto-char pos)
(insert text)
(when (> (point) (overlay-end templ))
@@ -164,7 +164,7 @@ Leave point at the end of the field."
(save-excursion
(company-template-add-field templ (match-beginning 1)
(format "arg%d" cnt) sig))
- (incf cnt)))
+ (cl-incf cnt)))
(company-template-move-to-first templ))))))
(provide 'company-template)
diff --git a/company-tempo.el b/company-tempo.el
index feea698..ac91988 100644
--- a/company-tempo.el
+++ b/company-tempo.el
@@ -26,7 +26,7 @@
;;; Code:
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(require 'tempo)
(defsubst company-tempo-lookup (match)
@@ -50,7 +50,7 @@
(defun company-tempo (command &optional arg &rest ignored)
"`company-mode' completion back-end for tempo."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-tempo
'company-tempo-insert))
(prefix (or (car (tempo-find-match-string tempo-match-finder)) ""))
diff --git a/company-tests.el b/company-tests.el
index 9e678af..abd9704 100644
--- a/company-tests.el
+++ b/company-tests.el
@@ -25,7 +25,6 @@
;;; Code:
-(eval-when-compile (require 'cl))
(require 'ert)
(require 'company)
(require 'company-keywords)
@@ -62,7 +61,7 @@
(let (company-frontends
(company-backends
(list (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix (buffer-substring (point-min) (point)))
(candidates '("abc" "abd")))))))
(company-manual-begin)
@@ -91,11 +90,11 @@
(ert-deftest company-multi-backend-with-lambdas ()
(let ((company-backend
(list (lambda (command &optional arg &rest ignore)
- (case command
+ (cl-case command
(prefix "z")
(candidates '("a" "b"))))
(lambda (command &optional arg &rest ignore)
- (case command
+ (cl-case command
(prefix "z")
(candidates '("c" "d")))))))
(should (equal (company-call-backend 'candidates "z") '("a" "b" "c"
"d")))))
@@ -103,19 +102,19 @@
(ert-deftest company-multi-backend-remembers-candidate-backend ()
(let ((company-backend
(list (lambda (command &optional arg)
- (case command
+ (cl-case command
(ignore-case nil)
(annotation "1")
(candidates '("a" "c"))
(post-completion "13")))
(lambda (command &optional arg)
- (case command
+ (cl-case command
(ignore-case t)
(annotation "2")
(candidates '("b" "d"))
(post-completion "42")))
(lambda (command &optional arg)
- (case command
+ (cl-case command
(annotation "3")
(candidates '("e"))
(post-completion "74"))))))
@@ -131,11 +130,11 @@
(ert-deftest company-multi-backend-handles-keyword-with ()
(let ((primo (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix "a")
(candidates '("abb" "abc" "abd")))))
(secundo (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix "a")
(candidates '("acc" "acd"))))))
(let ((company-backend (list 'ignore 'ignore :with secundo)))
@@ -154,7 +153,7 @@
(let (company-frontends
(company-backends
(list (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix "a")
(candidates '("a" "ab" "ac")))))))
(let (this-command)
@@ -169,7 +168,7 @@
(company-require-match 'company-explicit-action-p)
(company-backends
(list (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix (buffer-substring (point-min) (point)))
(candidates '("abc" "abd")))))))
(let (this-command)
@@ -187,7 +186,7 @@
(company-require-match 'company-explicit-action-p)
(company-backends
(list (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix (buffer-substring (point-min) (point)))
(candidates '("abc" "abd")))))))
(company-idle-begin (current-buffer) (selected-window)
@@ -205,7 +204,7 @@
company-begin-commands
(company-backends
(list (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix (buffer-substring (point-min) (point)))
(candidates '("abc" "abd")))))))
(let ((company-continue-commands nil))
@@ -227,7 +226,7 @@
company-begin-commands
(company-backends
(list (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix (buffer-substring (point-min) (point)))
(candidates '("abc" "abd")))))))
(let ((company-continue-commands '(not backward-delete-char)))
@@ -250,7 +249,7 @@
(company-auto-complete-chars '(? ))
(company-backends
(list (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix (buffer-substring (point-min) (point)))
(candidates '("abcd" "abef")))))))
(let (this-command)
@@ -268,7 +267,7 @@
(company-auto-complete-chars '(? ))
(company-backends
(list (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix (buffer-substring (point-min) (point)))
(candidates '("abcd" "abef")))))))
(company-idle-begin (current-buffer) (selected-window)
@@ -293,7 +292,7 @@
company-end-of-buffer-workaround
(company-backends
(list (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix (buffer-substring (point-min) (point)))
(candidates '("abcd" "abef"))
(ignore-case t))))))
@@ -313,7 +312,7 @@
(let (company-frontends
(company-backends
(list (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix (buffer-substring (point-min) (point)))
(candidates '("abcd" "abef"))
(ignore-case 'keep-prefix))))))
@@ -330,7 +329,7 @@
company-end-of-buffer-workaround
(company-backends
(list (lambda (command &optional arg)
- (case command
+ (cl-case command
(prefix (buffer-substring (point-min) (point)))
(candidates '("tea-cup" "teal-color")))))))
(let (this-command)
@@ -350,7 +349,7 @@
(company-begin-commands '(self-insert-command))
(company-backends
(list (lambda (c &optional arg)
- (case c (prefix "") (candidates '("a" "b" "c")))))))
+ (cl-case c (prefix "") (candidates '("a" "b" "c")))))))
(let (this-command)
(company-call 'complete))
(company-call 'open-line 1)
diff --git a/company-xcode.el b/company-xcode.el
index ac8d133..7a985aa 100644
--- a/company-xcode.el
+++ b/company-xcode.el
@@ -26,7 +26,7 @@
;;; Code:
(require 'company)
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defgroup company-xcode nil
"Completion back-end for Xcode projects."
@@ -109,7 +109,7 @@ valid in most contexts."
(defun company-xcode (command &optional arg &rest ignored)
"`company-mode' completion back-end for Xcode projects."
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-xcode))
(prefix (and company-xcode-xcodeindex-executable
(company-xcode-tags)
diff --git a/company-yasnippet.el b/company-yasnippet.el
index ae370c7..4730b21 100644
--- a/company-yasnippet.el
+++ b/company-yasnippet.el
@@ -25,6 +25,7 @@
;;; Code:
+(require 'cl-lib)
(require 'yasnippet)
(defun company-yasnippet--candidates (prefix)
@@ -74,7 +75,7 @@ shadow back-ends that come after it. Recommended usages:
(global-set-key (kbd \"C-c y\") 'company-yasnippet)
"
(interactive (list 'interactive))
- (case command
+ (cl-case command
(interactive (company-begin-backend 'company-yasnippet))
(prefix
;; Should probably use `yas--current-key', but that's bound to be slower.
diff --git a/company.el b/company.el
index 6204c01..7b185e3 100644
--- a/company.el
+++ b/company.el
@@ -7,7 +7,7 @@
;; URL: http://company-mode.github.io/
;; Version: 0.8.0-cvs
;; Keywords: abbrev, convenience, matching
-;; Package-Requires: ((emacs "24.1"))
+;; Package-Requires: ((emacs "24.1") (cl-lib "0.5"))
;; This file is part of GNU Emacs.
@@ -69,7 +69,7 @@
;;; Code:
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(require 'newcomment)
;; FIXME: Use `user-error'.
@@ -295,7 +295,7 @@ This doesn't include the margins and the scroll bar."
(unless (if (consp backend)
(company-safe-backends-p backend)
(assq backend company-safe-backends))
- (return t))))))
+ (cl-return t))))))
(defvar company--include-capf (version< "24.3.50" emacs-version))
@@ -624,7 +624,7 @@ asynchronous call into synchronous.")
(unless (memq backend company--disabled-backends)
(message "Company back-end '%s' could not be initialized:\n%s"
backend (error-message-string err)))
- (pushnew backend company--disabled-backends)
+ (cl-pushnew backend company--disabled-backends)
nil)))
;; No initialization for lambdas.
((functionp backend) t)
@@ -833,10 +833,10 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
company-backend (error-message-string err) args))))
(defun company--multi-backend-adapter (backends command &rest args)
- (let ((backends (loop for b in backends
- when (not (and (symbolp b)
- (eq 'failed (get b 'company-init))))
- collect b)))
+ (let ((backends (cl-loop for b in backends
+ when (not (and (symbolp b)
+ (eq 'failed (get b 'company-init))))
+ collect b)))
(setq backends
(if (eq command 'prefix)
(butlast backends (length (member :with backends)))
@@ -851,7 +851,7 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
(dolist (backend backends)
(when (setq value (company--force-sync
backend (cons command args) backend))
- (return value)))))
+ (cl-return value)))))
(_
(let ((arg (car args)))
(when (> (length arg) 0)
@@ -860,16 +860,16 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
(apply backend command args))))))))
(defun company--multi-backend-adapter-candidates (backends prefix)
- (let ((pairs (loop for backend in (cdr backends)
- when (equal (funcall backend 'prefix)
- prefix)
- collect (cons (funcall backend 'candidates prefix)
- (let ((b backend))
- (lambda (candidates)
- (mapcar
- (lambda (str)
- (propertize str 'company-backend b))
- candidates)))))))
+ (let ((pairs (cl-loop for backend in (cdr backends)
+ when (equal (funcall backend 'prefix)
+ prefix)
+ collect (cons (funcall backend 'candidates prefix)
+ (let ((b backend))
+ (lambda (candidates)
+ (mapcar
+ (lambda (str)
+ (propertize str 'company-backend
b))
+ candidates)))))))
(when (equal (funcall (car backends) 'prefix) prefix)
;; Small perf optimization: don't tag the candidates received
;; from the first backend in the group.
@@ -879,12 +879,12 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
(company--merge-async pairs (lambda (values) (apply #'append values)))))
(defun company--merge-async (pairs merger)
- (let ((async (loop for pair in pairs
- thereis
- (eq :async (car-safe (car pair))))))
+ (let ((async (cl-loop for pair in pairs
+ thereis
+ (eq :async (car-safe (car pair))))))
(if (not async)
- (funcall merger (loop for (val . mapper) in pairs
- collect (funcall mapper val)))
+ (funcall merger (cl-loop for (val . mapper) in pairs
+ collect (funcall mapper val)))
(cons
:async
(lambda (callback)
@@ -1048,7 +1048,7 @@ can retrieve meta-data for them."
company-candidates candidates)
(when selected
(while (and candidates (string< (pop candidates) selected))
- (incf company-selection))
+ (cl-incf company-selection))
(unless candidates
;; Make sure selection isn't out of bounds.
(setq company-selection (min (1- company-candidates-length)
@@ -1085,7 +1085,7 @@ can retrieve meta-data for them."
(when (setq prev (cdr (assoc (substring prefix 0 (- len i))
company-candidates-cache)))
(setq candidates (all-completions prefix prev))
- (return t)))))
+ (cl-return t)))))
;; no cache match, call back-end
(setq candidates
(company--process-candidates
@@ -1173,7 +1173,7 @@ point. The rest of the list is appended unchanged.
Keywords and function definition names are ignored."
(let* (occurs
(noccurs
- (delete-if
+ (cl-delete-if
(lambda (candidate)
(when (or
(save-excursion
@@ -1250,7 +1250,7 @@ Keywords and function definition names are ignored."
(company-cancel)
(dolist (backend next)
(when (ignore-errors (company-begin-backend backend))
- (return t))))
+ (cl-return t))))
(company-manual-begin))
(unless company-candidates
(error "No other back-end")))
@@ -1371,7 +1371,7 @@ Keywords and function definition names are ignored."
(run-hook-with-args 'company-completion-started-hook
(company-explicit-action-p))
(company-call-frontends 'show)))
- (return c)))))
+ (cl-return c)))))
(defun company-begin ()
(or (and company-candidates (company--continue))
@@ -1498,8 +1498,8 @@ Keywords and function definition names are ignored."
(i 0))
(dolist (line lines)
(when (string-match quoted line (length company-prefix))
- (return i))
- (incf i))))
+ (cl-return i))
+ (cl-incf i))))
(defun company-search-printing-char ()
(interactive)
@@ -1594,10 +1594,10 @@ Keywords and function definition names are ignored."
(define-key keymap [t] 'company-search-other-char)
(while (< i ?\s)
(define-key keymap (make-string 1 i) 'company-search-other-char)
- (incf i))
+ (cl-incf i))
(while (< i 256)
(define-key keymap (vector i) 'company-search-printing-char)
- (incf i))
+ (cl-incf i))
(let ((meta-map (make-sparse-keymap)))
(define-key keymap (char-to-string meta-prefix-char) meta-map)
(define-key keymap [escape] meta-map))
@@ -1720,10 +1720,10 @@ and invoke the normal binding."
(let* ((col-row (posn-actual-col-row (event-start event)))
(col (car col-row))
(row (cdr col-row)))
- (incf col (window-hscroll))
+ (cl-incf col (window-hscroll))
(and header-line-format
(version< "24" emacs-version)
- (decf row))
+ (cl-decf row))
(cons col row)))
(defun company-select-mouse (event)
@@ -1795,7 +1795,7 @@ To show the number next to the candidates in some
back-ends, enable
(when (company-manual-begin)
(and (< n 1) (> n company-candidates-length)
(error "No candidate number %d" n))
- (decf n)
+ (cl-decf n)
(company-finish (nth n company-candidates))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1976,26 +1976,26 @@ If SHOW-VERSION is non-nil, show the version in the
echo area."
(make-variable-buffer-local 'company-tooltip-offset)
(defun company-tooltip--lines-update-offset (selection num-lines limit)
- (decf limit 2)
+ (cl-decf limit 2)
(setq company-tooltip-offset
(max (min selection company-tooltip-offset)
(- selection -1 limit)))
(when (<= company-tooltip-offset 1)
- (incf limit)
+ (cl-incf limit)
(setq company-tooltip-offset 0))
(when (>= company-tooltip-offset (- num-lines limit 1))
- (incf limit)
+ (cl-incf limit)
(when (= selection (1- num-lines))
- (decf company-tooltip-offset)
+ (cl-decf company-tooltip-offset)
(when (<= company-tooltip-offset 1)
(setq company-tooltip-offset 0)
- (incf limit))))
+ (cl-incf limit))))
limit)
-(defun company-tooltip--simple-update-offset (selection num-lines limit)
+(defun company-tooltip--simple-update-offset (selection _num-lines limit)
(setq company-tooltip-offset
(if (< selection company-tooltip-offset)
selection
@@ -2114,13 +2114,13 @@ If SHOW-VERSION is non-nil, show the version in the
echo area."
(length lst)))
(defun company--replacement-string (lines old column nl &optional align-top)
- (decf column company-tooltip-margin)
+ (cl-decf column company-tooltip-margin)
(let ((width (length (car lines)))
(remaining-cols (- (+ (company--window-width) (window-hscroll))
column)))
(when (> width remaining-cols)
- (decf column (- width remaining-cols))))
+ (cl-decf column (- width remaining-cols))))
(let ((offset (and (< column 0) (- column)))
new)
@@ -2184,14 +2184,14 @@ If SHOW-VERSION is non-nil, show the version in the
echo area."
remainder (when (> remainder 0)
(setq remainder (format "...(%d)" remainder))))))
- (decf selection company-tooltip-offset)
+ (cl-decf selection company-tooltip-offset)
(setq width (max (length previous) (length remainder))
lines (nthcdr company-tooltip-offset company-candidates)
len (min limit len)
lines-copy lines)
- (decf window-width (* 2 company-tooltip-margin))
- (when scrollbar-bounds (decf window-width))
+ (cl-decf window-width (* 2 company-tooltip-margin))
+ (when scrollbar-bounds (cl-decf window-width))
(dotimes (_ len)
(let* ((value (pop lines-copy))
@@ -2228,8 +2228,8 @@ If SHOW-VERSION is non-nil, show the version in the echo
area."
(right (company-space-string company-tooltip-margin))
(width width))
(when (< numbered 10)
- (decf width 2)
- (incf numbered)
+ (cl-decf width 2)
+ (cl-incf numbered)
(setq right (concat (format " %d" (mod numbered 10)) right)))
(push (concat
(company-fill-propertize str annotation
@@ -2366,7 +2366,7 @@ Returns a negative number if the tooltip should be
displayed above point."
(defun company-pseudo-tooltip-frontend (command)
"`company-mode' front-end similar to a tooltip but based on overlays."
- (case command
+ (cl-case command
(pre-command (company-pseudo-tooltip-hide-temporarily))
(post-command
(let ((old-height (if (overlayp company-pseudo-tooltip-overlay)
@@ -2497,8 +2497,8 @@ Returns a negative number if the tooltip should be
displayed above point."
(progn
(setq comp (propertize (format "%d: %s" i comp)
'face 'company-echo))
- (incf len 3)
- (incf i)
+ (cl-incf len 3)
+ (cl-incf i)
(add-text-properties 3 (+ 3 (length company-common))
'(face company-echo-common) comp))
(setq comp (propertize comp 'face 'company-echo))
@@ -2525,8 +2525,8 @@ Returns a negative number if the tooltip should be
displayed above point."
(when (< i 10)
;; Add number.
(setq comp (format "%s (%d)" comp i))
- (incf len 4)
- (incf i))
+ (cl-incf len 4)
+ (cl-incf i))
(if (>= len limit)
(setq candidates nil)
(push (propertize comp 'face 'company-echo) msg)))
- [elpa] 26/35: Merge pull request #100 from bbatsov/version-fix, (continued)
- [elpa] 26/35: Merge pull request #100 from bbatsov/version-fix, Dmitry Gutov, 2014/04/19
- [elpa] 27/35: Try to use the more up-to-date snapshot packages, Dmitry Gutov, 2014/04/19
- [elpa] 29/35: Merge pull request #101 from bbatsov/master, Dmitry Gutov, 2014/04/19
- [elpa] 15/35: Merge branch 'clang-async', Dmitry Gutov, 2014/04/19
- [elpa] 30/35: Fix the test breakage (probably), Dmitry Gutov, 2014/04/19
- [elpa] 31/35: Introduce company-clang-insert-arguments, Dmitry Gutov, 2014/04/19
- [elpa] 05/35: Update NEWS, Dmitry Gutov, 2014/04/19
- [elpa] 34/35: Release 0.8.0, Dmitry Gutov, 2014/04/19
- [elpa] 33/35: Always include company-capf in the backends, Dmitry Gutov, 2014/04/19
- [elpa] 35/35: Merge commit '51c140ca9ee32d27cacc7b2b07d4539bf98ae575' from company-master, Dmitry Gutov, 2014/04/19
- [elpa] 28/35: Use cl-lib,
Dmitry Gutov <=
- [elpa] 32/35: `company-other-backend': don't use `company-manual-begin', Dmitry Gutov, 2014/04/19
- [elpa] 01/35: New option company-abort-manual-when-too-short, Dmitry Gutov, 2014/04/19