[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 6ddeae2 43/78: Rework Clang version handling
From: |
Dmitry Gutov |
Subject: |
[elpa] master 6ddeae2 43/78: Rework Clang version handling |
Date: |
Sun, 18 Feb 2018 07:40:21 -0500 (EST) |
branch: master
commit 6ddeae2badd16ce1ecb117e3cb51435952c06c54
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Rework Clang version handling
#749
---
company-clang.el | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/company-clang.el b/company-clang.el
index 69e9eaa..e512178 100644
--- a/company-clang.el
+++ b/company-clang.el
@@ -277,18 +277,26 @@ or automatically through a custom
`company-clang-prefix-guesser'."
(defvar company-clang--version nil)
(defun company-clang--auto-save-p ()
- (< company-clang--version 2.9))
+ (not
+ (company-clang--check-version 2.9 3.1)))
+
+(defun company-clang--check-version (min apple-min)
+ (pcase company-clang--version
+ (`(apple . ,ver) (>= ver apple-min))
+ (`(normal . ,ver) (>= ver min))
+ (_ (error "pcase-exhaustive is not in Emacs 24.3!"))))
(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)
- (let ((ver (string-to-number (match-string-no-properties 1))))
- (if (> ver 100)
- (/ ver 100)
- ver))
+ (if (re-search-forward "\\(clang\\|Apple LLVM\\) version \\([0-9.]+\\)"
nil t)
+ (cons
+ (if (equal (match-string-no-properties 1) "Apple LLVM")
+ 'apple
+ 'normal)
+ (string-to-number (match-string-no-properties 2)))
0)))
(defun company-clang (command &optional arg &rest ignored)
@@ -311,7 +319,8 @@ passed via standard input."
(error "Company found no clang executable"))
(setq company-clang--version (company-clang-version))
(when (< company-clang--version company-clang-required-version)
- (error "Company requires clang version 1.1"))))
+ (error "Company requires clang version %s"
+ company-clang-required-version))))
(prefix (and (memq major-mode company-clang-modes)
buffer-file-name
company-clang-executable
- [elpa] master 556fe45 45/78: Specify type, (continued)
- [elpa] master 556fe45 45/78: Specify type, Dmitry Gutov, 2018/02/18
- [elpa] master e97d26f 51/78: Specify :type for company-dabbrev -ignore-case and -downcase, Dmitry Gutov, 2018/02/18
- [elpa] master d789f26 54/78: Merge pull request #754 from jabranham/fix-defcustom, Dmitry Gutov, 2018/02/18
- [elpa] master 3959af9 52/78: Specify :type for company-semantic-begin-after-member-access, Dmitry Gutov, 2018/02/18
- [elpa] master 7c5408c 57/78: company-clang--start-process: Kill the existing process, if any, Dmitry Gutov, 2018/02/18
- [elpa] master 0efc9f3 58/78: Reindent, Dmitry Gutov, 2018/02/18
- [elpa] master b22df34 60/78: Use inhibit-redisplay, Dmitry Gutov, 2018/02/18
- [elpa] master 307b620 59/78: Simplify how async backends are called (WIP), Dmitry Gutov, 2018/02/18
- [elpa] master 82d41b7 70/78: Avoid an extra redisplay call, Dmitry Gutov, 2018/02/18
- [elpa] master 4004c7f 42/78: Merge pull request #748 from nikital/tng-dont-require-match, Dmitry Gutov, 2018/02/18
- [elpa] master 6ddeae2 43/78: Rework Clang version handling,
Dmitry Gutov <=
- [elpa] master 0bd111d 49/78: Add keywords for kotlin-mode, Dmitry Gutov, 2018/02/18
- [elpa] master f3910a2 71/78: Add a comment justifying the duplication [ci skip], Dmitry Gutov, 2018/02/18
- [elpa] master b079bd2 75/78: Revert "Break idle re-starting loop", Dmitry Gutov, 2018/02/18
- [elpa] master 7cc0901 77/78: Release 0.9.5, Dmitry Gutov, 2018/02/18
- [elpa] master d033112 28/78: Merge pull request #720 from aaronjensen/abort-dabbrev-on-input, Dmitry Gutov, 2018/02/18
- [elpa] master 3b5415a 41/78: company-tng: default config: Disable company-require-match, Dmitry Gutov, 2018/02/18
- [elpa] master 9b4488f 69/78: Rephrase, Dmitry Gutov, 2018/02/18
- [elpa] master e5e2c23 61/78: Make company-clang use cache again, Dmitry Gutov, 2018/02/18
- [elpa] master fe275d6 63/78: Tiny hack for better latency, Dmitry Gutov, 2018/02/18
- [elpa] master cf7141c 65/78: Fix noninteractive runs, Dmitry Gutov, 2018/02/18