unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: master 0d5036061b5: Skip Eglot test if using very old clangd
Date: Wed, 22 Mar 2023 11:14:05 +0000	[thread overview]
Message-ID: <CALDnm51Z_fkf85XFMh06SR6ENKsxb6s9a4GwHp0YX5Z+PjciQg@mail.gmail.com> (raw)
In-Reply-To: <87h6udnip7.fsf@gmail.com>

On Wed, Mar 22, 2023 at 11:12 AM Robert Pluim <rpluim@gmail.com> wrote:
>
> >>>>> On Wed, 22 Mar 2023 10:49:41 +0000, João Távora <joaotavora@gmail.com> said:
>
>     João> On Wed, Mar 22, 2023 at 10:38 AM Robert Pluim <rpluim@gmail.com> wrote:
>     >> Not all clangd have the version string and only the version string at
>     >> the end of 'clangd --version'. Hereʼs one I installed from git earlier:
>     >>
>     >> clangd version 16.0.0 (https://github.com/llvm/llvm-project.git 08d094a0e457360ad8b94b017d2dc277e697ca76)
>     >> Features: linux
>     >> Platform: x86_64-unknown-linux-gnu
>     >>
>     >> So how about the following (or we could just say 'everything
>     >> non-space', but Iʼm assuming clangd versions are always made up of
>     >> numbers and '.')
>     >>
>     >> diff --git c/test/lisp/progmodes/eglot-tests.el i/test/lisp/progmodes/eglot-tests.el
>     >> index c4b23bfd64e..557bd899ab7 100644
>     >> --- c/test/lisp/progmodes/eglot-tests.el
>     >> +++ i/test/lisp/progmodes/eglot-tests.el
>     >> @@ -317,7 +317,7 @@ eglot--simulate-key-event
>     >> (defun eglot--clangd-version ()
>     >> "Report on the clangd version used in various tests."
>     >> (replace-regexp-in-string
>     >> -   ".*version[[:space:]]+\\(.*\\)" "\\1"
>     >> +   ".*version[[:space:]]+\\([0-9.]*\\).*" "\\1"
>     >> (car (split-string (shell-command-to-string "clangd --version") "\n"))))
>
>
>     João> Sure, thanks.  Bonus points for getting rid of the split-string
>     João> and using a regexp that looks at the whole string and
>     João> catches the version.  I tried and failed.
>
> This doesnʼt care where 'version ' appears:
>
> (defun eglot--clangd-version ()
>   "Report on the clangd version used in various tests."
>   (let ((version (shell-command-to-string "clangd --version")))
>     (when (string-match "version[[:space:]]+\\([0-9.]*\\)"
>                         version)
>       (match-string 1 version))))

Looks good, can you push?  I wonder why this is so difficult
to do with replace-regexp-in-string.

João



  reply	other threads:[~2023-03-22 11:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <167942421231.13373.16122455155218245677@vcs2.savannah.gnu.org>
     [not found] ` <20230321184332.93736C13913@vcs2.savannah.gnu.org>
2023-03-22 10:38   ` master 0d5036061b5: Skip Eglot test if using very old clangd Robert Pluim
2023-03-22 10:49     ` João Távora
2023-03-22 11:12       ` Robert Pluim
2023-03-22 11:14         ` João Távora [this message]
2023-03-22 11:51           ` Robert Pluim
2023-03-22 18:24             ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALDnm51Z_fkf85XFMh06SR6ENKsxb6s9a4GwHp0YX5Z+PjciQg@mail.gmail.com \
    --to=joaotavora@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).