diff options
author | 2006-02-09 19:03:38 +0000 | |
---|---|---|
committer | 2006-02-09 19:03:38 +0000 | |
commit | 31b0c300c83f8e3930e9b810737509785aa3595e (patch) | |
tree | 195dec4d0fab85cd76e33799ce7a23aa9b09b93f /coq | |
parent | da363a9788ff145ed9ec5e9de455d889935dafda (diff) |
Cleanup version testing, prevent crash in case version string doesn't match.
Diffstat (limited to 'coq')
-rw-r--r-- | coq/coq-syntax.el | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/coq/coq-syntax.el b/coq/coq-syntax.el index 6ed5834f..db90a4fc 100644 --- a/coq/coq-syntax.el +++ b/coq/coq-syntax.el @@ -53,21 +53,19 @@ version of coq by doing 'coqtop -v'." ) (coq-version-is-V8 (setq coq-version-is-V8-0 t coq-version-is-V8-1 nil) (message v80)) (t;; otherwise do coqtop -v and see which version we have - (let ((str (shell-command-to-string (concat coq-prog-name " -v")))) - ;; this match sets match-string below - (string-match "version \\([.0-9]*\\)" str) + (let* ((str (shell-command-to-string (concat coq-prog-name " -v"))) + ;; this match sets match-string below + (ver (string-match "version \\([.0-9]*\\)" str))) (message str) - (let ((num (match-string 1 str))) - ;; da: added this to avoid type error in case coq command fails - (if (null num) (setq num "")) - (cond - ((or (string-match "\\<8.1" num)) - (message v81) - (setq coq-version-is-V8-1 t)) - (t ;; temporary, should be 8.1 when it is officially out - (message (concat "Falling back to default: " v80)) - (setq coq-version-is-V8-0 t) - )))))))) + (let ((num (and ver (match-string 1 str)))) + (cond + ((and num (string-match "\\<8.1" num)) + (message v81) + (setq coq-version-is-V8-1 t)) + (t ;; temporary, should be 8.1 when it is officially out + (message (concat "Falling back to default: " v80)) + (setq coq-version-is-V8-0 t))))))))) + ;; ----- keywords for font-lock. |