]> git.eshelyaron.com Git - emacs.git/commitdiff
Make eglot--clangd-version more robust
authorRobert Pluim <rpluim@gmail.com>
Wed, 22 Mar 2023 11:46:11 +0000 (12:46 +0100)
committerRobert Pluim <rpluim@gmail.com>
Wed, 22 Mar 2023 11:48:49 +0000 (12:48 +0100)
* test/lisp/progmodes/eglot-tests.el (eglot--clangd-version): Check
for 'version ' followed by a combination of numbers and dots to
extract the clangd version.

test/lisp/progmodes/eglot-tests.el

index c4b23bfd64e148e3264b9a1587efb070b49d6367..71d9d7270dd317ceb7b3b58da16d7c757cab02cd 100644 (file)
@@ -316,9 +316,10 @@ then restored."
 
 (defun eglot--clangd-version ()
   "Report on the clangd version used in various tests."
-  (replace-regexp-in-string
-   ".*version[[:space:]]+\\(.*\\)" "\\1"
-   (car (split-string (shell-command-to-string "clangd --version") "\n"))))
+  (let ((version (shell-command-to-string "clangd --version")))
+    (when (string-match "version[[:space:]]+\\([0-9.]*\\)"
+                        version)
+      (match-string 1 version))))
 
 \f
 ;;; Unit tests