+;; common ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun company-template-c-like-templatify (call)
+ (let* ((end (point-marker))
+ (beg (- (point) (length call)))
+ (cnt 0))
+ (goto-char beg)
+ (when (search-forward "(" end 'move)
+ (if (eq (char-after) ?\))
+ (forward-char 1)
+ (let ((templ (company-template-declare-template beg end)))
+ (while (re-search-forward (concat " *\\([^,)]*\\)[,)]") end t)
+ (let ((sig (match-string 1)))
+ (delete-region (match-beginning 1) (match-end 1))
+ (save-excursion
+ (company-template-add-field templ (match-beginning 1)
+ (format "arg%d" cnt) sig))
+ (incf cnt)))
+ (company-template-move-to-first templ))))))
+