0)))
(defun company-clang-objc-templatify (selector)
- (let* ((end (point))
+ (let* ((end (point-marker))
(beg (- (point) (length selector)))
(templ (company-template-declare-template beg end))
(cnt 0))
(save-excursion
(goto-char beg)
- (while (search-forward ":" end t)
- (let* ((name (format "arg%d" cnt))
- (len (length name)))
- (incf end len)
- (let ((pt (point)))
- (insert name)
- (company-template-add-field templ pt (point)))
- (when (< (point) end)
- (insert " ")
- (incf end))
+ (catch 'stop
+ (while (search-forward ":" end t)
+ (company-template-add-field templ (point) (format "arg%d" cnt))
+ (if (< (point) end)
+ (insert " ")
+ (throw 'stop t))
(incf cnt))))
(company-template-move-to-first templ)))