X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/c4cfb77e99c090562179c8f8afb9ee93392312dc..2d44e7fef7e7388759518cba1a424495119679d1:/packages/company/company-template.el diff --git a/packages/company/company-template.el b/packages/company/company-template.el index ab180166c..576b246ec 100644 --- a/packages/company/company-template.el +++ b/packages/company/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")) @@ -35,8 +35,7 @@ (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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -59,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)) @@ -71,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)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -98,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)) @@ -164,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)