X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/cb753c3ace486a17e1f3fbb3cbee29dfd20ae68d..f099954042d140841dd89e50350195cbd97c536a:/packages/company/company-template.el diff --git a/packages/company/company-template.el b/packages/company/company-template.el index 6ffd648f3..ea1db86bc 100644 --- a/packages/company/company-template.el +++ b/packages/company/company-template.el @@ -1,6 +1,6 @@ ;;; company-template.el -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009, 2010, 2013 Free Software Foundation, Inc. ;; Author: Nikolaj Schumacher @@ -34,6 +34,9 @@ (define-key keymap [tab] 'company-template-forward-field) keymap)) +(defvar company-template--buffer-templates nil) +(make-variable-buffer-local 'company-template--buffer-templates) + ;; interactive ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun company-template-templates-at (pos) @@ -73,9 +76,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defvar company-template--buffer-templates nil) -(make-variable-buffer-local 'company-template--buffer-templates) - (defun company-template-declare-template (beg end) (let ((ov (make-overlay beg end))) ;; (overlay-put ov 'face 'highlight) @@ -134,7 +134,7 @@ Leave point at the end of the field." ;; hooks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun company-template-insert-hook (ovl after-p &rest ignore) +(defun company-template-insert-hook (ovl after-p &rest _ignore) "Called when a snippet input prompt is modified." (unless after-p (company-template-remove-field ovl t))) @@ -150,6 +150,8 @@ Leave point at the end of the field." (let* ((end (point-marker)) (beg (- (point) (length call))) (cnt 0)) + (when (re-search-backward ")" beg t) + (delete-region (match-end 0) end)) (goto-char beg) (when (search-forward "(" end 'move) (if (eq (char-after) ?\))