X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/dd7ce94b2bb4a8967cd442c601cb4bcb765306a8..3c666787bf15c85809ca0c4f3813169b819d3270:/company-clang.el diff --git a/company-clang.el b/company-clang.el index 966ef79ec..e239c615d 100644 --- a/company-clang.el +++ b/company-clang.el @@ -181,16 +181,19 @@ Prefix files (-include ...) can be selected with ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defconst company-clang-required-version "1.1") +(defconst company-clang-required-version 1.1) (defsubst company-clang-version () "Return the version of `company-clang-executable'." (with-temp-buffer (call-process company-clang-executable nil t nil "--version") (goto-char (point-min)) - (if (re-search-forward "clang version \\([0-9.]+\\)" nil t) - (match-string-no-properties 1) - "0"))) + (if (re-search-forward "clang\\(?: version \\|-\\)\\([0-9.]+\\)" nil t) + (let ((ver (string-to-number (match-string-no-properties 1)))) + (if (> ver 100) + (/ ver 100) + ver)) + 0))) (defun company-clang-objc-templatify (selector) (let* ((end (point)) @@ -222,8 +225,7 @@ Completions only work correctly when the buffer has been saved. (interactive (company-begin-backend 'company-clang)) (init (unless company-clang-executable (error "Company found no clang executable")) - (when (version< (company-clang-version) - company-clang-required-version) + (when (< (company-clang-version) company-clang-required-version) (error "Company requires clang version 1.1"))) (prefix (and (memq major-mode company-clang-modes) buffer-file-name