]> rtime.felk.cvut.cz Git - sojka/company-mode.git/blobdiff - company-template.el
Run tests non-interactively
[sojka/company-mode.git] / company-template.el
index ea1db86bca7a695711f62b51f0251fb7a7bf673f..576b246ecdd8db682932e6aa745394e0212b21a6 100644 (file)
@@ -21,7 +21,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
 
 (defface company-template-field
   '((((background dark)) (:background "yellow" :foreground "black"))
 (defvar company-template-nav-map
   (let ((keymap (make-sparse-keymap)))
     (define-key keymap [tab] 'company-template-forward-field)
+    (define-key keymap (kbd "TAB") 'company-template-forward-field)
     keymap))
 
-(defvar company-template--buffer-templates nil)
-(make-variable-buffer-local 'company-template--buffer-templates)
+(defvar-local company-template--buffer-templates nil)
 
 ;; interactive ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
@@ -58,8 +58,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))
@@ -70,9 +70,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))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
@@ -97,7 +97,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))
@@ -163,7 +163,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)