GNU bug report logs - #53644
29.0.50; xref-search-program breaks if programm not installed on a remote host

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Philip Kaludercic <philipk@HIDDEN>; dated Sun, 30 Jan 2022 23:39:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 14 Feb 2022 14:40:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 14 09:40:40 2022
Received: from localhost ([127.0.0.1]:40411 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nJcWu-0007yg-DO
	for submit <at> debbugs.gnu.org; Mon, 14 Feb 2022 09:40:40 -0500
Received: from mail-wr1-f50.google.com ([209.85.221.50]:44006)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1nJcWo-0007yK-Er
 for 53644 <at> debbugs.gnu.org; Mon, 14 Feb 2022 09:40:38 -0500
Received: by mail-wr1-f50.google.com with SMTP id i14so27172079wrc.10
 for <53644 <at> debbugs.gnu.org>; Mon, 14 Feb 2022 06:40:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:message-id:date:mime-version:user-agent:subject
 :content-language:to:cc:references:from:in-reply-to
 :content-transfer-encoding;
 bh=rW9OGpLbvTZz4lCRnZqWEVOwUt5c2nMTrSv6njBVqDM=;
 b=dQu11Zyr5JwVhRcdIT9/Xe11dBidjQbM00G9dYPG39T1bd47+l6Vg/g527yp3NflzX
 S3E74XlO4wbRu4iLoi8MjeT0ZR2wfJVlxNAyoL/tP3ZUNlCCacwDKeGEBLPdkCdoXlWw
 r7WTzGa6dL4FP9zUSRObkVzMhyezab5+fRqVRcSHdxvVTrfDrwmkG1O9g365KFCm4tyu
 2G6u3vdrq53iAkyp36qdkE2zYREsJA7oCMXGZlwjBL6Gatf2qAX9SObtMQJBLtk/to9v
 +qIQjHG0OFmS62q3Z7Gqc7mcqrMB0D6428DVovew/WTO681oapuvpkRoU1M9e6SQoXrz
 V5CA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:message-id:date:mime-version:user-agent
 :subject:content-language:to:cc:references:from:in-reply-to
 :content-transfer-encoding;
 bh=rW9OGpLbvTZz4lCRnZqWEVOwUt5c2nMTrSv6njBVqDM=;
 b=yqqZmXEA816EeeuNK0XdK4qE1zRu6rLCOWcKmi2xUq3Ul8BWBARSB1tnQPjdKQaXC0
 bOIdJjtWeZpLa653W2QtkpTs1g3SKZ1Kv8nWWZ0V3hHMqyIxVZ0nt0mkixDBuqURWkjM
 +vFeELl2oVZ3lfkvht5bVxErJh5zQCTXdSchPrsapI2EKi3rR6yNbU0pSr8uXK/KkUV4
 8Roxn7d996WxlfOolhmJ9K1W1N06EAE/zswPMsGMWTL2rIdYo6RMwf0uFaL+CBjryADA
 W4/eaYvj/p1I7O29Syr6MyZPjnL+WBpk0SUmDyWKpXzhw/ru4BolrUK6kRD+4Z83JOhi
 B50w==
X-Gm-Message-State: AOAM530g3vlE8z91ayVKnO+E3BfTp/pfqBGJg5mjk84hAWtLjfM9t3VE
 9FkflkBIIqy+BCg9vRnHOtY=
X-Google-Smtp-Source: ABdhPJwFmSIQj51seBhNkOoGB//NeeFiyYN6RMC8ca6ts5BUcDkKR5d0sYe0YiIfS90O2/3lee9vUQ==
X-Received: by 2002:adf:ffca:: with SMTP id x10mr11722610wrs.248.1644849628421; 
 Mon, 14 Feb 2022 06:40:28 -0800 (PST)
Received: from [192.168.0.6] ([46.251.119.176])
 by smtp.googlemail.com with ESMTPSA id n9sm10444881wrx.76.2022.02.14.06.40.27
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Mon, 14 Feb 2022 06:40:27 -0800 (PST)
Message-ID: <ffdbaf57-263e-1e72-e506-d9eb69f688a7@HIDDEN>
Date: Mon, 14 Feb 2022 16:40:26 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.5.0
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
Content-Language: en-US
To: Philip Kaludercic <philipk@HIDDEN>
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN> <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN> <87leypml9i.fsf@HIDDEN>
 <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN> <875ypp624b.fsf@HIDDEN>
 <87iltptnem.fsf@HIDDEN> <87k0e5uvtp.fsf@HIDDEN> <87a6f1tdlt.fsf@HIDDEN>
 <87bkzhrrd2.fsf@HIDDEN> <875ypotqwj.fsf@HIDDEN>
 <878ruk4cwo.fsf@HIDDEN> <828ff352-8a6c-b768-a4cc-427f6fd955f7@HIDDEN>
 <87leydy2iz.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
In-Reply-To: <87leydy2iz.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 53644
Cc: Michael Albinus <michael.albinus@HIDDEN>, 53644 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

On 14.02.2022 15:57, Philip Kaludercic wrote:
>> And use a simpler test: (only when the host is remote) write some text
>> to a file in the temp dir, then search through it. Only doing it once,
>> of course, when the connection-local value is initialized.
> I am afraid I don't understand what you mean here, specifically "some
> text".
> 

Well, we need some file to search and some knowledge about its contents 
in advance (so the search can succeed).

Since we don't know anything about the remote system, we probably have 
to create the file ourselves. Put something like "aaa\nbbb\nccc" in it, 
and then search for "bbb".




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 14 Feb 2022 13:57:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 14 08:57:19 2022
Received: from localhost ([127.0.0.1]:40316 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nJbqx-0002FZ-Nd
	for submit <at> debbugs.gnu.org; Mon, 14 Feb 2022 08:57:19 -0500
Received: from mout01.posteo.de ([185.67.36.65]:42827)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1nJbqu-0002FI-Pc
 for 53644 <at> debbugs.gnu.org; Mon, 14 Feb 2022 08:57:18 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 8861C240028
 for <53644 <at> debbugs.gnu.org>; Mon, 14 Feb 2022 14:57:10 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1644847030; bh=fYg5fMdESgZodb6cKyfHYki3cmzIHjoeJ/HfFHUDOWk=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=CYaG2FDs/+5NNSGvhtvY5uRRhdFHkCinE2l9auWYloin+nborKpjB2StgfGNwKd59
 +MX1VRo9imfb44Ol2dakM0LJmlsBazzIM3kuLjz4+m1V8z1ly4pcqeOHHAd2Yn1j4a
 voIB7gf5WbPAE74rwaVGz8CcfaA3PCc4KpuA/UqO/DkvrFkZsQMZ4uUOeWoRV1JqRt
 p/GQwwmMRI18s8nTxRPjy2afzyQnicJxMOYwszfUPARDxEwmn5/9xZ3oRDUy0m9mA/
 O6xS0XF17CfMcd01HgJiLy+TU/RVS3pTzgQCC41oZMioSeVona++Sd4YVPSntFfxB8
 ZbORMJv+3q1Vg==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Jy5Pd4mlMz6tnM;
 Mon, 14 Feb 2022 14:57:09 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
 <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN>
 <87leypml9i.fsf@HIDDEN>
 <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN>
 <875ypp624b.fsf@HIDDEN> <87iltptnem.fsf@HIDDEN>
 <87k0e5uvtp.fsf@HIDDEN> <87a6f1tdlt.fsf@HIDDEN>
 <87bkzhrrd2.fsf@HIDDEN> <875ypotqwj.fsf@HIDDEN>
 <878ruk4cwo.fsf@HIDDEN>
 <828ff352-8a6c-b768-a4cc-427f6fd955f7@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Mon, 14 Feb 2022 13:57:08 +0000
In-Reply-To: <828ff352-8a6c-b768-a4cc-427f6fd955f7@HIDDEN> (Dmitry Gutov's
 message of "Sat, 12 Feb 2022 03:04:02 +0200")
Message-ID: <87leydy2iz.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 53644
Cc: Michael Albinus <michael.albinus@HIDDEN>, 53644 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Dmitry Gutov <dgutov@HIDDEN> writes:

> On 09.02.2022 11:17, Philip Kaludercic wrote:
>> In that case, I'd propose this patch:
>
> Thanks!
>
> Could you extract the detection logic to outside of the main function?
> I think the result would be easier to read. The diff, too.

Ok.

> And use a simpler test: (only when the host is remote) write some text
> to a file in the temp dir, then search through it. Only doing it once,
> of course, when the connection-local value is initialized.

I am afraid I don't understand what you mean here, specifically "some
text".

> I'd prefer an even simpler test than that, but I guess the current
> structure of xref-search-program-alist doesn't give us specific values
> to call 'executable-find' on. And that's probably fine.
>

-- 
	Philip Kaludercic




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 12 Feb 2022 01:04:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 11 20:04:25 2022
Received: from localhost ([127.0.0.1]:33017 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nIgpn-0006bb-Ca
	for submit <at> debbugs.gnu.org; Fri, 11 Feb 2022 20:04:24 -0500
Received: from mail-wm1-f49.google.com ([209.85.128.49]:39435)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1nIgpg-0006bF-6v
 for 53644 <at> debbugs.gnu.org; Fri, 11 Feb 2022 20:04:17 -0500
Received: by mail-wm1-f49.google.com with SMTP id
 j9-20020a05600c190900b0037bff8a24ebso3808755wmq.4
 for <53644 <at> debbugs.gnu.org>; Fri, 11 Feb 2022 17:04:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:message-id:date:mime-version:user-agent:subject
 :content-language:to:cc:references:from:in-reply-to
 :content-transfer-encoding;
 bh=lV424vs4bPsCOaIO2oYiRvEV12f+uevVX7Reyw5zQho=;
 b=dbkxZ7OiAWcntQahnG5Tl6yE91gK5e2sRG8lqAko3WtcYy746ZA6BkxPfWU5imoToV
 mWU67+U5mUGg532dR6KYnrbReVhGxf1B+Y5PQIZhyacvJA/K46JiZgNht/uHADdZz0OA
 OOvpNINwBC46PQNsqpBztQFkS7l6mMQ8fhAR96dh1AYC6f7zLWCXTyUGEtxPNVp44jAi
 7vdc8xHqMPXDu2bD7q0aZftFlxG2IerjlaxGbsYtg4x1rDblWy3RrwRnz2ZByf2NPMKe
 Zim/lA/NzeZ9UTkfMyOqo9XCZy8HkeKXmOzZl8Ef3J9EAkbd278nOoZHn+IlUJBlN7NY
 DPGw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:message-id:date:mime-version:user-agent
 :subject:content-language:to:cc:references:from:in-reply-to
 :content-transfer-encoding;
 bh=lV424vs4bPsCOaIO2oYiRvEV12f+uevVX7Reyw5zQho=;
 b=l4k0UyAoYwGjGn+jYjT7rdFOXg/qlAWLuoiWgW45uR0LFCgN1QbYWKUjCLGQawR0m0
 H8LaWv+7tIuNPLLN3BYeIliKwBtilYzfuNd17tr1SRn6M6wmCdrrSorlB2QlcP33fhiE
 YxNBx0rOmk7qQKI8mJf/Q1BEc0cH6uvMlix5A4Np7Pe/ecYWECOkbKqnpxFL9gROIAzS
 q3npWulCt815oviHtdkIwfFB+w8kFZeeRWju9vjqhX4dB3dcoddfwn4Txfgl6Xp/4IAx
 CbzPd7dnEw0ZGQAy6FfPpSh9aS3d70d/oPDXiokoHzNVO7qjY+YGJyHy059UDER9sLZa
 9qGA==
X-Gm-Message-State: AOAM530bv8TgNFOy3jNkdV0jYxQhsJnWeVX3Z/AQvxGOkuHm4cDsJRjF
 qdCW7ErA6BPjaXHRJB9G2dA=
X-Google-Smtp-Source: ABdhPJxnjZBn0tsn3rRZLM++lLTd4KT5IZJDZHVRW6VjQ5p2IELYIPA+OzYSX0TLYHK+i2qfmMHCnw==
X-Received: by 2002:a05:600c:1151:: with SMTP id
 z17mr2228657wmz.169.1644627845280; 
 Fri, 11 Feb 2022 17:04:05 -0800 (PST)
Received: from [192.168.0.6] ([46.251.119.176])
 by smtp.googlemail.com with ESMTPSA id n7sm4267287wra.5.2022.02.11.17.04.04
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Fri, 11 Feb 2022 17:04:04 -0800 (PST)
Message-ID: <828ff352-8a6c-b768-a4cc-427f6fd955f7@HIDDEN>
Date: Sat, 12 Feb 2022 03:04:02 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.5.0
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
Content-Language: en-US
To: Philip Kaludercic <philipk@HIDDEN>,
 Michael Albinus <michael.albinus@HIDDEN>
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN> <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN> <87leypml9i.fsf@HIDDEN>
 <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN> <875ypp624b.fsf@HIDDEN>
 <87iltptnem.fsf@HIDDEN> <87k0e5uvtp.fsf@HIDDEN> <87a6f1tdlt.fsf@HIDDEN>
 <87bkzhrrd2.fsf@HIDDEN> <875ypotqwj.fsf@HIDDEN>
 <878ruk4cwo.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
In-Reply-To: <878ruk4cwo.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 53644
Cc: 53644 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

On 09.02.2022 11:17, Philip Kaludercic wrote:
> In that case, I'd propose this patch:

Thanks!

Could you extract the detection logic to outside of the main function? I 
think the result would be easier to read. The diff, too.

And use a simpler test: (only when the host is remote) write some text 
to a file in the temp dir, then search through it. Only doing it once, 
of course, when the connection-local value is initialized.

I'd prefer an even simpler test than that, but I guess the current 
structure of xref-search-program-alist doesn't give us specific values 
to call 'executable-find' on. And that's probably fine.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 9 Feb 2022 09:17:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 09 04:17:38 2022
Received: from localhost ([127.0.0.1]:49795 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nHj6X-0007lK-Hx
	for submit <at> debbugs.gnu.org; Wed, 09 Feb 2022 04:17:37 -0500
Received: from mout02.posteo.de ([185.67.36.66]:33635)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1nHj6V-0007fS-IW
 for 53644 <at> debbugs.gnu.org; Wed, 09 Feb 2022 04:17:36 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 6D4FD240101
 for <53644 <at> debbugs.gnu.org>; Wed,  9 Feb 2022 10:17:29 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1644398249; bh=9O6cSZB443j6GMhK4ZcYZKsxZT3Gc5SFZDkpBAX2fXA=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=fM9Y+b7vvEMuDTuRBPWoS4pNI9a6EYfjU5YV3SMG7wds0wQi1npvALWFo/jHPkOWv
 hV4drtcfEjwEusA4uaQNqPRd0B5nWACibag1u6W5LwPHTVM8N337nadeBw4xCHI/n4
 MhicEXlh0E8ARf1WWGYY3mNICnk0QLZIpiUjeZof0lry6l7k2Wyp3gVQCoI1DjwXvx
 79bGqHgOrau4OersoeokxZBE92vZe5NnhiyFeGzheLa/f0VwrU8FBfFOga4a4rHjLj
 BfXcod3qyzZbUIZPKnqXVkqXL23P33rlel76OlW4RDYq5y4u4FbQOt8KMpM1oDYfwV
 vGtatL6zI/l5g==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4JtvRD59vYz9rxM;
 Wed,  9 Feb 2022 10:17:28 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: Michael Albinus <michael.albinus@HIDDEN>
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
 <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN>
 <87leypml9i.fsf@HIDDEN>
 <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN>
 <875ypp624b.fsf@HIDDEN> <87iltptnem.fsf@HIDDEN>
 <87k0e5uvtp.fsf@HIDDEN> <87a6f1tdlt.fsf@HIDDEN>
 <87bkzhrrd2.fsf@HIDDEN> <875ypotqwj.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Wed, 09 Feb 2022 09:17:27 +0000
In-Reply-To: <875ypotqwj.fsf@HIDDEN> (Michael Albinus's message of "Wed, 09
 Feb 2022 08:55:56 +0100")
Message-ID: <878ruk4cwo.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 53644
Cc: 53644 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Michael Albinus <michael.albinus@HIDDEN> writes:

> Philip Kaludercic <philipk@HIDDEN> writes:
>
> Hi Philip,
>
>> But the question here remains precisely what to use instead of the
>> literal "/bin/sh"?
>
> Well, if there isn't a better value, "/bin/sh" should serve as
> fallback. In my experience with Tramp, it works on most of the remote
> systems. It doesn't work on remote Android devices, for example. But
> the
> number of Emacs < 27 users, running xref-* on a remote Android device,
> is rather limited I believe.
>
> POSIX declines this assumptions. It recommends to call "command -v sh"
> in order to determine the shell path, see
> <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html>.
>
> Best regards, Michael.

In that case, I'd propose this patch:


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-Check-if-xref-search-program-exists-on-a-remote-syst.patch

From da83d403688b4b5771d08c95975c73a1cfd593c1 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Wed, 9 Feb 2022 10:14:38 +0100
Subject: [PATCH] Check if xref-search-program exists on a remote system

* lisp/progmodes/xref.el (xref-matches-in-files): Loop through all
programmes in xref-search-program-alist as a fallback before raising
an error that the search query couldn't be executed.
---
 lisp/progmodes/xref.el | 84 ++++++++++++++++++++++++++++--------------
 1 file changed, 57 insertions(+), 27 deletions(-)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 6677b4f004..759dbb9778 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1751,44 +1751,74 @@ xref-matches-in-files
        (remote-id (file-remote-p dir))
        ;; The 'auto' default would be fine too, but ripgrep can't handle
        ;; the options we pass in that case.
-       (grep-highlight-matches nil)
-       (command (grep-expand-template (cdr
-                                       (or
-                                        (assoc
-                                         xref-search-program
-                                         xref-search-program-alist)
-                                        (user-error "Unknown search program `%s'"
-                                                    xref-search-program)))
-                                      (xref--regexp-to-extended regexp))))
+       (grep-highlight-matches nil))
     (when remote-id
       (require 'tramp)
       (setq files (mapcar
                    (if (tramp-tramp-file-p dir)
                        #'tramp-file-local-name
-                       #'file-local-name)
+                     #'file-local-name)
                    files)))
     (when (file-name-quoted-p (car files))
       (setq files (mapcar #'file-name-unquote files)))
     (with-current-buffer output
-      (erase-buffer)
       (with-temp-buffer
         (insert (mapconcat #'identity files "\0"))
-        (setq default-directory dir)
-        (setq status
-              (xref--process-file-region (point-min)
-                                         (point-max)
-                                         shell-file-name
-                                         output
-                                         nil
-                                         shell-command-switch
-                                         command)))
-      (goto-char (point-min))
-      (when (and (/= (point-min) (point-max))
-                 (not (looking-at grep-re))
-                 ;; TODO: Show these matches as well somehow?
-                 (not (looking-at "Binary file .* matches")))
-        (user-error "Search failed with status %d: %s" status
-                    (buffer-substring (point-min) (line-end-position))))
+        (let* ((default-directory dir)
+               (xref-search-program-alist xref-search-program-alist)
+               (program (if (bound-and-true-p enable-connection-local-variables)
+                            (with-connection-local-variables
+                             xref-search-program)
+                          xref-search-program))
+               (process-file-side-effects nil))
+          ;; In case `xref-search-program' is not installed on a
+          ;; remote system, we will speculatively try to start a
+          ;; different searcher to see if it is installed and works.
+          (catch 'ok
+            (while xref-search-program-alist
+              (with-current-buffer output
+                (erase-buffer))
+              (setq status
+                    (let ((sfn shell-file-name)
+                          (scs shell-command-switch))
+                      (when remote-id
+                        (if (bound-and-true-p enable-connection-local-variables)
+                            (with-connection-local-variables
+                             (setq sfn shell-file-name
+                                   scs shell-command-switch))
+                          (setq sfn "/bin/sh")))
+                      (xref--process-file-region
+                       (point-min) (point-max)
+                       sfn output nil scs
+                       (grep-expand-template
+                        (or (alist-get program xref-search-program-alist)
+                            (user-error "Unknown search program `%s'" program))
+                        (xref--regexp-to-extended regexp)))))
+              (with-current-buffer output
+                (goto-char (point-min))
+                (unless (and (/= (point-min) (point-max))
+                             (not (looking-at grep-re))
+                             ;; TODO: Show these matches as well somehow?
+                             (not (looking-at "Binary file .* matches")))
+                  (when (and (not (eq program xref-search-program))
+                             (version<= "27" emacs-version))
+                    ;; If possible and necessary, save whatever program
+                    ;; was found as a connection local variable.
+                    (let* ((host (file-remote-p dir 'host))
+                           (profile (intern (concat "xref-remote-" host))))
+                      (connection-local-set-profile-variables
+                       profile `((xref-search-program . ,program)))
+                      (connection-local-set-profiles
+                       (list :machine host) profile)))
+                  (throw 'ok t)))
+              (setq xref-search-program-alist
+                    (remq (assq program xref-search-program-alist)
+                          xref-search-program-alist)
+                    program (caar xref-search-program-alist)))
+            (with-current-buffer output
+              (user-error "Search failed with status %d: %s" status
+                          (buffer-string)
+                          (buffer-substring (point-min) (line-end-position)))))))
       (while (re-search-forward grep-re nil t)
         (push (list (string-to-number (match-string line-group))
                     (match-string file-group)
-- 
2.34.0


--=-=-=
Content-Type: text/plain


-- 
	Philip Kaludercic

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 9 Feb 2022 07:56:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 09 02:56:12 2022
Received: from localhost ([127.0.0.1]:49566 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nHhpi-0000TO-DJ
	for submit <at> debbugs.gnu.org; Wed, 09 Feb 2022 02:56:12 -0500
Received: from mout.gmx.net ([212.227.15.15]:50795)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1nHhpc-0000Sn-NQ
 for 53644 <at> debbugs.gnu.org; Wed, 09 Feb 2022 02:56:08 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1644393358;
 bh=NGKWd7M3cxCQV9kAOJsIPn02o14BGcELMoa7lBNj2NQ=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=GC8Aa9zP/tNSURNKsp5AOJi4ckWIPnirqsif8m9s2AaYmJmpqaZPj99ssr1JYPPAs
 gucgDumjObYLou+AlWqk8RzqzGsRsw69UqZItX5RETdsf3eloJ2aMvMVKrM5/NNoyc
 Cd3WWuhj1xcV4nGRY6dU5T9/WKp4Ytwv8waRDdcY=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([213.220.149.97]) by mail.gmx.net (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MdefD-1nqlSu3q3F-00ZhxO; Wed, 09
 Feb 2022 08:55:58 +0100
From: Michael Albinus <michael.albinus@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
 <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN>
 <87leypml9i.fsf@HIDDEN>
 <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN>
 <875ypp624b.fsf@HIDDEN> <87iltptnem.fsf@HIDDEN>
 <87k0e5uvtp.fsf@HIDDEN> <87a6f1tdlt.fsf@HIDDEN>
 <87bkzhrrd2.fsf@HIDDEN>
Date: Wed, 09 Feb 2022 08:55:56 +0100
In-Reply-To: <87bkzhrrd2.fsf@HIDDEN> (Philip Kaludercic's message of "Tue, 
 08 Feb 2022 21:16:41 +0000")
Message-ID: <875ypotqwj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:oGMJll1WWXo1Nij4ceX8KaBiW8cyeQrZ157VScWl4CDIxesatQj
 ZaOTyBQyzUOScR3d/HQ6AiNdgdvMO61l8P2sS9wHpkSiZWAI6JbYfIzZ64YJvl32pfwY2OO
 snYEVkoe3j0kjwL7b6T0A/ygJbml2+geqcHFgar76KJgVxDY52SYn0GWOLQuiiB8FeDOeIy
 hxtRJysLYEF3SQOrqZGYQ==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:alZliBMBs58=:F3EWcgNiSMjDSQZ//AnX+Z
 FNslZA1oFUrG43gyW2L5+FzDgGBqAxSsFFjI4r8SJ2sXHwodWhppsLG3CTf6GaRReJ/JowjBp
 VCIgFY9f1VwYgGkMObrM0Bjp1K3v4KrR4NbYOzeJEoHeLN8wg0wGm3Y0vmDk+5usRNF7ogof6
 dXrEXkg4NMTfyVG1K53zPa7lSKKo7gLEX0sTzTbw2hAePyjh/H7MI2axjzUPID52cuw+kNKzJ
 OHneBL52Tjv+o8+VCQrbUOldzq4+17fx7pOA4d5x1tWYlzrH6yLcZddCBiAIXWjRrdjzscBJB
 yfFym9Upfj50Sx+BUjSVSOSu310a8lFtp722wuq5TfhPEoYA+CHlKrk/vmDOZn6dPsp7dqJY+
 Nj/jIPqVQxDndwJuJpUDuGJrpAbv8Ebbne5JBii7IzF6stnVKoh5Q7KYETQ8J98CEi/VyxaAq
 aw6EFRDpjlE+Fxs/NYAGWh+9TMnOAYNy3mRHKg6zE9b2laAVfav8qg2ep0+53ZbgK/JAVgQDf
 XHUqfB5WnZW4HVbR7RJUNGDAM4ZVhvvXwJtwSCeJnNLZ8HBpQpF6Iy7ZE6FzazdbiV6B0H//w
 NB6Rl0jUwbS8HD21lsVmJKtbvuhiNYpS8D8Et5HcHdMdNn9F896LG+GkHAHkj4P/KLo/aWB4g
 /5PldBMZBwGz8iRaMi3GT8abO7Q29JAGl0HTQW7LW6LA20LS3Q0Tzk6zy967lXYwfB0nFLZd8
 X0NUR1ldhy2KUBDtVYemTsPAW8kjXPqIhbDn49S8Ci/ksyRAfb9MghFePxQfjDYoibY3YXM6g
 PQ3uDeOGNpNBCjUpJF7L8HBB1fT4+Xcrgf2PtcMkO5OscJ8b3fD4XbX/zhqXP/BaweiJttrsr
 +Qyx3N0LCwbvVvipxktujiKNYF6fbkPQZI1bGRiAA7APDrYAzXdHw2S9tLW4NdxgnjQ4a+JMq
 /FtRWB/zUqd/CBrey7Fay2/AKW/hBPzSx6h+Yls9hGVZC4QmrxNmT4Cu1oxM4vtyz72q59SXW
 8fjtCcrfJkjFqN8PFUJ0VWyMpFvQXy3koLtYev9NBROB3UxiZNy7DM39FIQbFjPnYBd3pC4Jk
 1guafHOr3iWyMs=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 53644
Cc: 53644 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Philip Kaludercic <philipk@HIDDEN> writes:

Hi Philip,

> But the question here remains precisely what to use instead of the
> literal "/bin/sh"?

Well, if there isn't a better value, "/bin/sh" should serve as
fallback. In my experience with Tramp, it works on most of the remote
systems. It doesn't work on remote Android devices, for example. But the
number of Emacs < 27 users, running xref-* on a remote Android device,
is rather limited I believe.

POSIX declines this assumptions. It recommends to call "command -v sh"
in order to determine the shell path, see
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html>.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 8 Feb 2022 21:16:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 08 16:16:51 2022
Received: from localhost ([127.0.0.1]:48900 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nHXr0-0004DD-Ql
	for submit <at> debbugs.gnu.org; Tue, 08 Feb 2022 16:16:51 -0500
Received: from mout02.posteo.de ([185.67.36.66]:55211)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1nHXqy-0004Cw-GQ
 for 53644 <at> debbugs.gnu.org; Tue, 08 Feb 2022 16:16:49 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 54E10240101
 for <53644 <at> debbugs.gnu.org>; Tue,  8 Feb 2022 22:16:42 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1644355002; bh=i6M3K2CEIVukIgvnQAlwaTpaKweiRZ/2xnF5tGOCNTE=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=SA7dY0JoUsmNd5CM502mv1lPVZqvpEV3i3CD+5jYoOEhUoepGu9wAOBiN1wmR+8fC
 P3K2erNJVdolAhC86wNR2EG2+EOQW2wBDP9q4iP3j8XCIenrCERlgvGAALLxOTu6Lj
 7qOynyRi73qNBra/yfZOX4v39JCE0UinfkzlJqoicIXrWM0XElvYZAqoefB7h8026L
 koQWk797RCgB6xiRLS+YAeC2VnKET2Kv8KByxGvtl+IuMR8WnYvtgAJ18I8fzZoHbV
 ja9VIcnBR4S/ww54FvrH9vVrZ+7BjYFCCQYDl56XR1PHhL6jt99g2dQaa0+tLBlFBh
 tsnpGjXBkNq5g==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4JtbRY4cbDz9rxM;
 Tue,  8 Feb 2022 22:16:41 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: Michael Albinus <michael.albinus@HIDDEN>
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
 <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN>
 <87leypml9i.fsf@HIDDEN>
 <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN>
 <875ypp624b.fsf@HIDDEN> <87iltptnem.fsf@HIDDEN>
 <87k0e5uvtp.fsf@HIDDEN> <87a6f1tdlt.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Tue, 08 Feb 2022 21:16:41 +0000
In-Reply-To: <87a6f1tdlt.fsf@HIDDEN> (Michael Albinus's message of "Tue, 08
 Feb 2022 19:30:54 +0100")
Message-ID: <87bkzhrrd2.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 53644
Cc: 53644 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Michael Albinus <michael.albinus@HIDDEN> writes:

> Philip Kaludercic <philipk@HIDDEN> writes:
>
> Hi Philip,
>
>> Ok, I missed that.  But the question still remains for versions of Emacs
>> prior to 27.1.  What would you advise to do there?
>>
>> For context: In my specific case, I am using Guix so shell-file-name
>> something like
>> /gnu/store/87kif0bpf0anwbsaw0jvg8fyciw4sz67-bash-5.0.16/bin/bash.
>> Virtually every server I might connect to does not have this path (tough
>> "/bin/sh" works in that case (which would break other systems like
>> adb)).  So I don't think a version check would suffice.  All it does in
>> the patch I provided above is provide a speedup for all greps after the
>> first one.
>
> I would do something like this (untested!):
>
> (defmacro my-with-connection-local-variables (&rest body)
>   "Ensure, that `shell-file-name' and `xref-search-program' have proper values."
>   (if (bound-and-true-p enable-connection-local-variables)
>       `(with-connection-local-variables ,@body)
>     `(if (file-remote-p default-directory)
> 	 (let ((shell-file-name "/bin/sh") ;; Adapt
> 	       (xref-search-program "/bin/gerep")) ;; Adapt

But the question here remains precisely what to use instead of the
literal "/bin/sh"?

> 	   ,@body)
>        ,@body)))
>
> Best regards, Michael.
>

-- 
	Philip Kaludercic




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 8 Feb 2022 18:31:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 08 13:31:05 2022
Received: from localhost ([127.0.0.1]:48629 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nHVGa-0005mr-Ou
	for submit <at> debbugs.gnu.org; Tue, 08 Feb 2022 13:31:05 -0500
Received: from mout.gmx.net ([212.227.15.19]:37889)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1nHVGY-0005mK-1o
 for 53644 <at> debbugs.gnu.org; Tue, 08 Feb 2022 13:31:03 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1644345055;
 bh=39dOBTK5PA/wZ9L6ka78YcOj5Z7HTYu4lWrncyOMMwU=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=aGdVOC+yNsHWfAUiomtb4fLBVdWqleiSnHy7m58ouULFFKsd6EPwzFqq4SFo61VQe
 nuNZWiubr0JC+Y+/YqCvvZ0UdJKDRy8DZ76e9Us4MfhiFM796js87InqpUY7S8e2yZ
 RDrtQX6Ps6UYlYBm0uKN6s4tnuCIMH7dbzvpdbUU=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([212.91.242.49]) by mail.gmx.net (mrgmx005
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mjj8D-1o1GDM1Nox-00lAdf; Tue, 08
 Feb 2022 19:30:55 +0100
From: Michael Albinus <michael.albinus@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
 <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN>
 <87leypml9i.fsf@HIDDEN>
 <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN>
 <875ypp624b.fsf@HIDDEN> <87iltptnem.fsf@HIDDEN>
 <87k0e5uvtp.fsf@HIDDEN>
Date: Tue, 08 Feb 2022 19:30:54 +0100
In-Reply-To: <87k0e5uvtp.fsf@HIDDEN> (Philip Kaludercic's message of "Tue, 
 08 Feb 2022 17:12:02 +0000")
Message-ID: <87a6f1tdlt.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:XbSwbOCQDOqwg0lPP5bgCzCoRD1c24c6iILhDCa/untTdflXnrS
 koxTv0cLPHCFAysG+5b0feTGMQ4A7lr1BAJSKgx972To3k29Zorzysd0rLQ3q1ft7lWYZgD
 tvHZk+YR75mEYCvhxsk0w3DXYew3G910pGtnq8rI8Ge9d5FFV7kjJJGO20ChM1S4NFxJ5e+
 6RPNQTFoWh97f277DYM8Q==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:uWizMwjQzZA=:HbaiU1PPOY3obr3oCeVHZU
 ZTIh4Wy9rgf2Nxye3ypveqUkFmT8ZA5hnyZ2M2Z/Hun3i+HbjoPiFWr1g2Rv061XWjl5MCk/t
 lvSWfvlwn8v2GHS+iWIjjfaiAPQGLpAcy3w50o75IX9Tu2OR7aFw4ZrSdTx++BDmM1WaiJlTl
 EW4ZlO+T82VUR3P4/PpCH11zpiYKTM+HmEv+TBDFuVmQKEgI4tQX1x7N/5YBy7lz72zBPrhuK
 EvnafMhzEvJy5lkTpRRR9zVMIHJWX5RfQm9jLQYCdHhCKUQjxHB8qxCjdnpTe5ettGAmtdEN7
 W3Fh+SvUK917fTeWsHR3N4NSapKQlbNvgXGFattpZek5BAr1+aR6GujI/hTsyOPf4dP6pVkQE
 UhTlqNuQsdtXLFudbkiNkx7klvsiLOR6M7yksGiqIfJIiuLrgkafEAe2m4RoUHgNcIwTIzM2n
 4pKn8pyyv5dcB6MsWpDPSuxREHI24MwkgSlaQU9bBQi/4MOEwakWKHJFcJkCrp0+3j2j0BJHn
 w9g+DMlaKgKFiQzZ6FqdHMY2FMNzMpjKiJ7MgOu17xn+HZ3+8SdHguSydT27e91BeSJCri51C
 iW5jUrQhRoNjWQODmY+Kvv2ibQ4+9N2hOi83OGzbI9OiwU2z107+PUiq+dUlqAjXeZw4D6f1i
 TB6YX2ANrici0XXThJa24Cn1APdyh+Amhd27i0lAc71YQZwy5/pyLbbfTlWxp4qktrD/u8Bb7
 h3zrryRr0Ed8BtVbgF7+FZo91AC7f9e5LhiDyE4JIg9WugKe38lWvJTV1H+wlg+UPJR1WWzJz
 MgPkipnFWIzIvdo8hY5D5DoH+cgdWlwJRQiP38GYu2PmU9l4vvDLI/eyRCMkCYQv+oeMDJ12N
 9xdyVhu2k8b0tQoK+onSSAS4BZQzCnXRT/9JbZsgdhvX/8tJCyZ73pHC02JZ9lnRNPp4/aZ25
 IP4tm56d8aPP2bemy0Rq4fh1J+cHP+GI7V9r7A0j0ugEpT0wMNRvZwLCNy2eOtaHtqobNTcsx
 5QxMchtsBKENNMgGV5RB6jita85AENZraiDTX1otiX5Xx2zSijPranmjXWBMz8iIraiokpOqK
 dXCoJkoXHlbwxs=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 53644
Cc: 53644 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Philip Kaludercic <philipk@HIDDEN> writes:

Hi Philip,

> Ok, I missed that.  But the question still remains for versions of Emacs
> prior to 27.1.  What would you advise to do there?
>
> For context: In my specific case, I am using Guix so shell-file-name
> something like
> /gnu/store/87kif0bpf0anwbsaw0jvg8fyciw4sz67-bash-5.0.16/bin/bash.
> Virtually every server I might connect to does not have this path (tough
> "/bin/sh" works in that case (which would break other systems like
> adb)).  So I don't think a version check would suffice.  All it does in
> the patch I provided above is provide a speedup for all greps after the
> first one.

I would do something like this (untested!):

--8<---------------cut here---------------start------------->8---
(defmacro my-with-connection-local-variables (&rest body)
  "Ensure, that `shell-file-name' and `xref-search-program' have proper values."
  (if (bound-and-true-p enable-connection-local-variables)
      `(with-connection-local-variables ,@body)
    `(if (file-remote-p default-directory)
	 (let ((shell-file-name "/bin/sh") ;; Adapt
	       (xref-search-program "/bin/gerep")) ;; Adapt
	   ,@body)
       ,@body)))
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 8 Feb 2022 17:12:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 08 12:12:11 2022
Received: from localhost ([127.0.0.1]:48494 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nHU2F-0003c0-JM
	for submit <at> debbugs.gnu.org; Tue, 08 Feb 2022 12:12:11 -0500
Received: from mout02.posteo.de ([185.67.36.66]:50767)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1nHU2E-0003bn-Fc
 for 53644 <at> debbugs.gnu.org; Tue, 08 Feb 2022 12:12:11 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 4E27C240101
 for <53644 <at> debbugs.gnu.org>; Tue,  8 Feb 2022 18:12:03 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1644340324; bh=YheunLwruIWclcv5YEdt5QuXInsp+vK0BwQuXZNy5EI=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=plCYbhB4C3x0b+vOoxxrKJQTrS1sMuiFDaYHYRj8DASSW3KaX10vdDRxsBfG517xp
 bw2Zaeqs5/SDIV0egus9S70CUimvZYz8RtVNLPDG8L8uQ/BiQ7/Me8geEky7oVeXVX
 szi0oVROK5DrFLsBafy6rB0gQBmpCAb8DeWLrr6llJ6EMg8U2h2/mJNoxs39fnpA5l
 CTBdTLcH3eaKytgOhHuOk5P/MpMQyzzo7/kOdAVCq6iThLhC8zhT7ocVvDMwiWFbk+
 UKTgEAnKWIqXM3X/Qoyw/qDIz5BqtOgPHwYv9C3rK4bR/ol09PWYBVrdg5fXFsqm6T
 /tMB3zp/Mh9rA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4JtV1H1Czqz9rxX;
 Tue,  8 Feb 2022 18:12:02 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: Michael Albinus <michael.albinus@HIDDEN>
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
 <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN>
 <87leypml9i.fsf@HIDDEN>
 <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN>
 <875ypp624b.fsf@HIDDEN> <87iltptnem.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Tue, 08 Feb 2022 17:12:02 +0000
In-Reply-To: <87iltptnem.fsf@HIDDEN> (Michael Albinus's message of "Tue, 08
 Feb 2022 15:59:13 +0100")
Message-ID: <87k0e5uvtp.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 53644
Cc: 53644 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Michael Albinus <michael.albinus@HIDDEN> writes:

> Philip Kaludercic <philipk@HIDDEN> writes:
>
> Hi Philip,
>
>> +                            (with-connection-local-variables
>> +                             xref-search-program)
>> +                          xref-search-program)))
>>
>> xref--process-file-region takes shell-file-name, that should depend on
>> the remote system.  I could use something like
>>
>>    (with-parsed-tramp-file-name default-directory d
>>      (tramp-get-method-parameter d 'tramp-remote-shell))
>>
>> but it seems that `with-parsed-tramp-file-name' is not used outside of
>> tramp, and byte-compiling triggers a warning.  Is there some better way
>> to do this?
>
> `shell-file-name' is already handled as connection-local variable, so
> you could apply `with-connection-local-variables shell-file-name' as well.

Ok, I missed that.  But the question still remains for versions of Emacs
prior to 27.1.  What would you advise to do there?

For context: In my specific case, I am using Guix so shell-file-name
something like
/gnu/store/87kif0bpf0anwbsaw0jvg8fyciw4sz67-bash-5.0.16/bin/bash.
Virtually every server I might connect to does not have this path (tough
"/bin/sh" works in that case (which would break other systems like
adb)).  So I don't think a version check would suffice.  All it does in
the patch I provided above is provide a speedup for all greps after the
first one.

-- 
	Philip Kaludercic




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 8 Feb 2022 14:59:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 08 09:59:23 2022
Received: from localhost ([127.0.0.1]:48268 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nHRxj-0006F9-Ny
	for submit <at> debbugs.gnu.org; Tue, 08 Feb 2022 09:59:23 -0500
Received: from mout.gmx.net ([212.227.15.15]:55075)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1nHRxh-0006Et-Ky
 for 53644 <at> debbugs.gnu.org; Tue, 08 Feb 2022 09:59:22 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1644332354;
 bh=HO0r/3BnxA2kjl/lR73qLRPqBBy4efMANg6IU/GWcJI=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=if/H1sDg/M4T9aGme7eRoOocPGhStdxsQSxFSc+GIzZ57lA0W1lmv6HYBNMTBgM8f
 evVl582wqJ9spgPlUCCdh0szwE4li3xX3ThOeFQmlKpcz4w0H3vL/zy4IMDbX8YtIX
 aMBn7Lh212wjHmBvHCPHxFvVIEllXvR9hf2nv8JU=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([212.91.242.49]) by mail.gmx.net (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MmDEg-1nzLQw1uW8-00iGkO; Tue, 08
 Feb 2022 15:59:14 +0100
From: Michael Albinus <michael.albinus@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
 <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN>
 <87leypml9i.fsf@HIDDEN>
 <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN>
 <875ypp624b.fsf@HIDDEN>
Date: Tue, 08 Feb 2022 15:59:13 +0100
In-Reply-To: <875ypp624b.fsf@HIDDEN> (Philip Kaludercic's message of "Tue, 
 08 Feb 2022 11:15:16 +0000")
Message-ID: <87iltptnem.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:heMJmTtjntVtAJl+PUhaAn1vEfuTuhhMHCxtk5JE7ji8JY7vCXt
 YGIEDjTIHM6YCTMB2yOhgDUZruScvdF+0oKj3baoBzHzTnwG4IHbIdiEXDm6OiA4vJyLup5
 yI5fO8Cp2WZN4dQ9ycYwoH0K7WPb3XV3pAobzQKjxthy86hq2Lc2+vij6wjhv0iRK/IbWZS
 fgc2MsQFbLvh3FXQ6OGlg==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:1JO4fLqv970=:gPtZea0sRo52+qweGBsowj
 kHit+KW1PFQzTdvBlpdZKaUUIIJ2jCBmeA0v+58+eY4ZaxIFYLXQ2HsfreCr1PY/CLIskS5xr
 MfpHTRlgoSY+1fKb5sRwUUQtLjfsBKdIZvWL0afvfiV2XX6XqJ6WkOLi6Y6BrU3Ly3yagp2lq
 6UNrbgBzCQyGdGtZaB04BEfY9cJYKqDXNxmHYVYWUK+wnyfONhz7/1IO8uoJRNenRNuYn7Auj
 wEOCQOXkivVpCSxoJzL2ik2MY/C7YUgPXGRIOJrM6k8cJHoG9JrckgFZqTyrX1ia/ZLxLglrp
 9F1e16TXKhkRfmba1KTm2vH26FiLjMlHetOfCLH2FjsJzUycuLMxIReKyyT5gg3Hz9isABQBb
 ODzISNFBum1HFhU1bGaxzZJB2Dv3PdPr7khJpFjCSEsFQgxKgYck5SsSVMDppGYtuYlm8Fr28
 HVdcvUZ0zVj97MBYxVH4Pka2KnghA1/4yWlfzibjpsm3pAPKQCZh6oyMkNWTKgIuX3nfhTx/D
 CAknbnE49PYsrWcHq8ogpI4gfNcxcuCP/UTl4XFDqQzww9V/vF6YNgs89OHuka6NQKNlH0Q/y
 1P3WR9F7EB4SKF5az8yQZ12ZSgJfHJDsnhymzj0KmknSTnRpJYnFbLKzcEyGsuH3vybP6Bjx6
 90pAR9fQrrgTJotSd2WqmlnHgjTFEU//kUyW4MOYgUYR3R0f6AR4WHlVXcAImCVfms5DObZ0U
 JjeX8xopETj/Zhgw1zm8RGud1vijp3RfqAcYlUWbbvV+m2WxU5xy9HVVyEJTj3NJbp59iNz+T
 Of+0YeCDoaU3UX+/xk9EWALI+j1sfLBE+vYEUmu37GwGLcOAhMqVjsLlGPfkhBH6IjGLeoo5b
 ONhrxCXbNCaap+80bsmmseNRR5cAzog+5c8EIxiAB48kC+lGtToQM6W1r+D4qdCotAEW4lP59
 ur+bOYWnCXO2K9nfiIspqRKTH1odJvTbeuY4OPn2yxNa8WFe5K6dFEJNW+9UIs1VA1LWlZjVw
 LPhRqjZtmGji7Im7EwaxchwmCRMF89i4jR5GyqJoycvWNzUlQCEfDC0BbKyxcjr3YU+xMjfw9
 Wfw7/qaorioRYY=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 53644
Cc: 53644 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Philip Kaludercic <philipk@HIDDEN> writes:

Hi Philip,

> +                            (with-connection-local-variables
> +                             xref-search-program)
> +                          xref-search-program)))
>
> xref--process-file-region takes shell-file-name, that should depend on
> the remote system.  I could use something like
>
>    (with-parsed-tramp-file-name default-directory d
>      (tramp-get-method-parameter d 'tramp-remote-shell))
>
> but it seems that `with-parsed-tramp-file-name' is not used outside of
> tramp, and byte-compiling triggers a warning.  Is there some better way
> to do this?

`shell-file-name' is already handled as connection-local variable, so
you could apply `with-connection-local-variables shell-file-name' as well.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 8 Feb 2022 11:15:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 08 06:15:27 2022
Received: from localhost ([127.0.0.1]:45580 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nHOT0-0005od-Uf
	for submit <at> debbugs.gnu.org; Tue, 08 Feb 2022 06:15:27 -0500
Received: from mout01.posteo.de ([185.67.36.65]:34793)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1nHOSy-0005oK-OP
 for 53644 <at> debbugs.gnu.org; Tue, 08 Feb 2022 06:15:25 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 7A676240027
 for <53644 <at> debbugs.gnu.org>; Tue,  8 Feb 2022 12:15:18 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1644318918; bh=Ej06ID69gzyaObhnKCBLKelmoAta1RWKvcS+3zoDwRA=;
 h=From:To:Cc:Subject:Autocrypt:Date:From;
 b=Jh48DssbGYyzi707NRgzBrW0zXK8X0m59yd/JL2Wao/ZyyggW9nCLsjDMqNzlV6mY
 oytmNvR6UbrgNI52HcNJBKig2OO7T5wf6h+fYtYCTTDAOV1YvGiIvlSpyg7+QDrQrA
 cSkQT/R7i6O/CsZhnwWblpLhU1r+qA9ixP3T6DCE+6kTZ2yL11zJclqSbQM9aZ6d5C
 nkCG5Wi5pPqkVDTfz7rgxPBerK7fnwpwMdkrJ1dpHv9FFcW2W4xwBIwX842J3CExHX
 oYgspXG8bxrh19PPunKCWvYP16QiRiP/8+J20zoo46HIJ7IIiVTeeBJ+riTpYRtwgj
 N4eBdFOWY0W3w==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4JtL5d3S6Qz9rxh;
 Tue,  8 Feb 2022 12:15:17 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
 <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN>
 <87leypml9i.fsf@HIDDEN>
 <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Tue, 08 Feb 2022 11:15:16 +0000
In-Reply-To: <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN> (Dmitry Gutov's
 message of "Mon, 7 Feb 2022 04:57:31 +0200")
Message-ID: <875ypp624b.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 53644
Cc: Michael Albinus <michael.albinus@HIDDEN>, 53644 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain

Dmitry Gutov <dgutov@HIDDEN> writes:

> On 05.02.2022 16:38, Michael Albinus wrote:
>> Dmitry Gutov <dgutov@HIDDEN> writes:
>> 
>>> Hi Michael,
>> Hi Dmitry,
>> 
>>>>>> When invoking a command that respects xref-search-program via TRAMP,
>>>>>> e.g. on a remote system that doesn't have (in my case ripgrep)
>>>>>> installed, an error is signalled indicating that the search query
>>>>>> couldn't be executed.
>>>>>
>>>>> One way to work around this will probably involve an addition to
>>>>> find-file-hook and some code which checks (file-remote-p
>>>>> buffer-file-name) and sets xref-search-program to a particular value
>>>>> buffer-locally depending on the result.
>>>>>
>>>>> Or an around-advice for xref-matches-in-files.
>>>> There are connection-local variables exactly for this use case.
>>>
>>> Is there a documented way on how to make the variable's value on
>>> remote hosts customizable for the user too?
>> Something like
>> --8<---------------cut here---------------start------------->8---
>> (connection-local-set-profile-variables
>>   'remote-xref-variables
>>   '((xref-search-program . "/bin/grep")))
>> (with-eval-after-load 'xref
>>    (connection-local-set-profiles
>>     '(:application tramp :machine "myhost")
>>     'remote-xref-variables))
>> --8<---------------cut here---------------end--------------->8---
>
> Nice. Some integration with the Customize UI probably wouldn't hurt, though.
>
> Philip, would you like to try writing a patch along the lines of
> Michael's suggestion?
>
> It would need to use version checks, though, given that
> connection-local vars were only added in Emacs 27.

The following works, with one issue:


--=-=-=
Content-Type: text/plain
Content-Disposition: inline

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 6677b4f004..b2f82f1889 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1751,15 +1751,7 @@ xref-matches-in-files
        (remote-id (file-remote-p dir))
        ;; The 'auto' default would be fine too, but ripgrep can't handle
        ;; the options we pass in that case.
-       (grep-highlight-matches nil)
-       (command (grep-expand-template (cdr
-                                       (or
-                                        (assoc
-                                         xref-search-program
-                                         xref-search-program-alist)
-                                        (user-error "Unknown search program `%s'"
-                                                    xref-search-program)))
-                                      (xref--regexp-to-extended regexp))))
+       (grep-highlight-matches nil))
     (when remote-id
       (require 'tramp)
       (setq files (mapcar
@@ -1770,25 +1762,56 @@ xref-matches-in-files
     (when (file-name-quoted-p (car files))
       (setq files (mapcar #'file-name-unquote files)))
     (with-current-buffer output
-      (erase-buffer)
       (with-temp-buffer
         (insert (mapconcat #'identity files "\0"))
-        (setq default-directory dir)
-        (setq status
-              (xref--process-file-region (point-min)
-                                         (point-max)
-                                         shell-file-name
-                                         output
-                                         nil
-                                         shell-command-switch
-                                         command)))
-      (goto-char (point-min))
-      (when (and (/= (point-min) (point-max))
-                 (not (looking-at grep-re))
-                 ;; TODO: Show these matches as well somehow?
-                 (not (looking-at "Binary file .* matches")))
-        (user-error "Search failed with status %d: %s" status
-                    (buffer-substring (point-min) (line-end-position))))
+        (let* ((default-directory dir)
+               (xref-search-program-alist xref-search-program-alist)
+               (program (if (version<= "27" emacs-version)
+                            (with-connection-local-variables
+                             xref-search-program)
+                          xref-search-program)))
+          ;; In case `xref-search-program' is not installed on a
+          ;; remote system, we will speculatively try to start a
+          ;; different searcher to see if it is installed and works.
+          (catch 'ok
+            (while xref-search-program-alist
+              (with-current-buffer output
+                (erase-buffer))
+              (setq status
+                    (xref--process-file-region
+                     (point-min) (point-max)
+                     shell-file-name
+                     output nil shell-command-switch
+                     (grep-expand-template
+                      (or (alist-get program xref-search-program-alist)
+                          (user-error "Unknown search program `%s'"
+                                      program))
+                      (xref--regexp-to-extended regexp))))
+              (with-current-buffer output
+                (goto-char (point-min))
+                (unless (and (/= (point-min) (point-max))
+                             (not (looking-at grep-re))
+                             ;; TODO: Show these matches as well somehow?
+                             (not (looking-at "Binary file .* matches")))
+                  (when (and (not (eq program xref-search-program))
+                             (version<= "27" emacs-version))
+                    ;; If possible and necessary, save whatever program
+                    ;; was found as a connection local variable.
+                    (let* ((host (file-remote-p default-directory 'host))
+                           (profile (intern (concat "xref-remote-" host))))
+                      (connection-local-set-profile-variables
+                       profile `((xref-search-program . ,program)))
+                      (connection-local-set-profiles
+                       (list :machine host) profile)))
+                  (throw 'ok t)))
+              (setq xref-search-program-alist
+                    (remq (assq program xref-search-program-alist)
+                          xref-search-program-alist)
+                    program (caar xref-search-program-alist)))
+            (with-current-buffer output
+              (user-error "Search failed with status %d: %s" status
+                          (buffer-string)
+                          (buffer-substring (point-min) (line-end-position)))))))
       (while (re-search-forward grep-re nil t)
         (push (list (string-to-number (match-string line-group))
                     (match-string file-group)

--=-=-=
Content-Type: text/plain


xref--process-file-region takes shell-file-name, that should depend on
the remote system.  I could use something like

   (with-parsed-tramp-file-name default-directory d
     (tramp-get-method-parameter d 'tramp-remote-shell))

but it seems that `with-parsed-tramp-file-name' is not used outside of
tramp, and byte-compiling triggers a warning.  Is there some better way
to do this?
  
> To get you started, here's one example of this feature's usage:
> https://github.com/company-mode/company-mode/blob/c25f1fbc3850e36e6521b77fa1641d5583365d8b/company-gtags.el#L71-L96
>
> And you can search in Emacs's own repository, of course, for other examples.

-- 
	Philip Kaludercic

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 7 Feb 2022 18:35:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 07 13:35:11 2022
Received: from localhost ([127.0.0.1]:43728 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nH8r1-0005zn-Fo
	for submit <at> debbugs.gnu.org; Mon, 07 Feb 2022 13:35:11 -0500
Received: from mout.gmx.net ([212.227.17.22]:55009)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1nH8qw-0005yx-MD
 for 53644 <at> debbugs.gnu.org; Mon, 07 Feb 2022 13:35:10 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1644258900;
 bh=FnX57m3xWtVsuVf7gl7AR1zUVPN5jRjYHREnGY7hDog=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=RyFGg9Z5Pa8D93k9N3GqF9+VDQfEfQKpGYV2O7t0Q3Iz2GbV5u3vco2QyDsriN6Xk
 40QRd4JdzDTJMfjPYIUtevk6BI+W5xGHAnzIZSdXlXVYD+R8bAzMYKKRR3mXD0WSIl
 dqmALmZchnAVS/M/uaEIVahNGX77ewAavSyxw1i8=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([79.140.125.128]) by mail.gmx.net (mrgmx104
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MyKDU-1oFjDc0e9E-00yjaT; Mon, 07
 Feb 2022 19:35:00 +0100
From: Michael Albinus <michael.albinus@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
 <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN>
 <87leypml9i.fsf@HIDDEN>
 <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN>
 <87a6f3kpb3.fsf@HIDDEN>
Date: Mon, 07 Feb 2022 19:34:59 +0100
In-Reply-To: <87a6f3kpb3.fsf@HIDDEN> (Michael Albinus's message of "Mon, 07
 Feb 2022 10:18:24 +0100")
Message-ID: <87tudazfsc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:e9swu5O6C18+iPgI7v7kKVLGi2KHdQm0xUgJDM5JFC/cciecY0j
 LGckg9IdJWc24iVmStxZGp3xNFZkNkwak+7i7rfSzpnklvzvjNHNR+81/Cahe+6t6rEe4qE
 DXLceu9eL7z6d95Sgg4+fmbcYzD32szRykTSsfqRVPhzsN0VuHCj8fK5Us8nCzMuI9O4Xos
 84JQSUXXYd7KKfF6aO1DQ==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:XgbGQ2G8gAQ=:KfuoKrSSNYvxCNx0vgBYBS
 v8mk9lYAWvC2DNCD60523hP1VV/c1HykEDPAWXOANdwLLv2xQwslCcfPOpSxFumi4INjr2mWJ
 bWl3U6086oJe+fgE+3BSujmwH4vyJ5RS275RoFHbWEnWTryf4H6j6gd4FBUNbn/THdwh0iq3g
 Wlwh4Gjeqtu2lwQlRezc1gDWNEsCe6iq4OPiWqZXGRyxrF0MBVXjZCUYxEJFIgUSFBh/pgW2b
 X+OGG6GipxSJBrTdSN4WglhJzgVzcO313qvJVBdYWYLR2Jz9QdnC/3yuiqgAYeBHo8VvdpJPk
 yJpe+lmnED7HOJawoRgUkpRrQdOodwgth4GUjkRYovbUvp6hTTOycuP1ugDK9SaDOq/cVYCTb
 8Tdxy/awI/F/tZvnlVTe43AADp+zCOq/xW30UnajMCLY1blWynw0ygKSZTZplwlY61XVe/dHJ
 HJ4AE4cJaqELYS1bJLhHEGMAwsBNQrmXG8UXwmDDc7CvIDyrdSzrzCrTcaV5NAOGRUtyg8W6Y
 OF1nUgkVJ7dWonavXegxSiM9LEm8UC87SEMxERjMZPM40v4zwzDF0xmFfoovYREIjIWKKtmY4
 EuYyzBt4v03W+PhnZfTT7+DefcuPyXK/MjaIBLbHSiJFfTiwj+ENaNM/qSLWDWtINR740mtkt
 7GnP2FvQRyr3qZeYun2VVFDlkNB7mwih0NhvAIeT/FAGaEnMnchpvwbPyFhm8PCdU2opntX7s
 pY7zvFH2Zp64otNPlBubrJuWwNtcrl9JYWIkkgIL3QQeX3LZXI6jx+F8EjeFc8+Bv3tX5eOP2
 9THGOrsyjreKIv0i4QUWjiak0h+QncInpcpadaLbf9ggTjeDvFaa3QAig4MqBZTtZK7sRHC4P
 Xy2nAH/atd3n0ODr+KCAFFP6U/Gimqo2uzUJgICb9RP5OZAFAHU7JLPmutm5i0FC1KwmH/EZJ
 JNeHlSeMTDD78ZK+qxDbrbeya1u9Ujkz4AYR8x96iiwJYBsndSBgXYmnKMeI9R0A1t0oek2jL
 7vm34AFHsEHlD4sjXkSK8QiZzB3rr1+CqPWwFmgZ94Pd3diDe9XgTPuYpnX8/2u/KRjj7U2C5
 45iaoll25Ty5tk=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 53644
Cc: Philip Kaludercic <philipk@HIDDEN>, 53644 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Michael Albinus <michael.albinus@HIDDEN> writes:

Hi Dmitry,

>> Nice. Some integration with the Customize UI probably wouldn't hurt, though.
>
> Good idea. I'll see whether I can assemble something useful.

I've converted connection-local-profile-alist and
connection-local-criteria-alist to user options. This should help a
little bit.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 7 Feb 2022 09:18:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 07 04:18:34 2022
Received: from localhost ([127.0.0.1]:40973 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nH0AM-0003Ck-Aq
	for submit <at> debbugs.gnu.org; Mon, 07 Feb 2022 04:18:34 -0500
Received: from mout.gmx.net ([212.227.15.15]:48887)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1nH0AK-0003CV-AB
 for 53644 <at> debbugs.gnu.org; Mon, 07 Feb 2022 04:18:32 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1644225505;
 bh=A6zgFR0gtpYV+z7AWKngOpGuFt/9a51FCS94PpP3lq8=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=jNWQ83L+iEXLrhdLmfZkSdIDoCcIWv2+xzHq9C7JrdeBWvKrEFVsan78a14g7bZSE
 7h9ZWl9mWusrW1VIQRa41Mwm5ov1TQK8gUoTReL5AAbIE1lZlivFNVbmbpg61rIajG
 0LsMTTwDgnR1MmWw/5LvCc47E4C6rZBEbGNYo688=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([79.140.125.128]) by mail.gmx.net (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MgvvT-1ny45c1eGb-00hMtq; Mon, 07
 Feb 2022 10:18:25 +0100
From: Michael Albinus <michael.albinus@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
 <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN>
 <87leypml9i.fsf@HIDDEN>
 <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN>
Date: Mon, 07 Feb 2022 10:18:24 +0100
In-Reply-To: <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN> (Dmitry Gutov's
 message of "Mon, 7 Feb 2022 04:57:31 +0200")
Message-ID: <87a6f3kpb3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:Nzv8VPPcIJyu+WlttWXW/pU/U1Na6pKqHVot14P/MbTy6T0SF+h
 tBiDYtPa20T0Q/DzbPMe/nEQfzkl/7M3tEW0/+t5PetqZT2yRlJASR37wEMDIu+edSjRFSG
 Kg7T78mzyWoWNwuGCNssT8ExesqpdPzMTZx0aRDyxJUbb8Mr5MW1xtdNwNuOPw4muw8KCb+
 ARnSK8UX41TOcBJu2G06g==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:lLTisuZHmhY=:hjk0DY9lEhLfEeOwyZ2yJh
 sw1QGA2QEU/gCNbtuvOfgnGRgkpaGczWBVaaYscwClBF65K0XKmUZ3b6y/LlzZ3R8LwSuuu1D
 YxEvIiECPgwFeZwFNiTCqyIIKVMmrAPYkF8zX3EkfWOSsseeXYX3MBFfmzqEs+rXqSqnT1kGR
 /MFXy8SD4RcpfjUyiDwZ8z3RVUxLlCdEr5vC3rNAujRtTVMN+6pa5ENWrJxWcYTma0aRicj0Y
 vVb41/o8aBaHJx8EAHs4sk8iGHWshVdy7WHmkSB853AWGtUbisH/upY4KBSyBrS1Pq2qr+Rat
 aezhrEit3jshUVpv2X4wZ93ML+W86DynpY/W37ATrEuavCN8QoUIsWoDGiRDCAkOLVxwiHPun
 ZJzx2JR3mBaxYq35zwHcSY7lFryaLc9OcLnvUbm+/ik47aBtR3YRn6YEkaroQMri2JuuQ8tKm
 EbPi0Zkrf6Hw46hPH4T+HAl0TvWh9863qph6nTKRPhK2nBsUBQ0PIngzQhWvV3JWlZzOetDlq
 JKkNEhmA4F4sOYMaihwQLzooJkHlffvo7uxkbD3JLUSCQKVQ4QR5M3GM9EtCNCvtXkcGQF8+I
 WUIWk6h8aVdyJews/I8s3RQ1kFgAFDiJtYihHL0S14PmAMBOiWLsNHykHwY8Llg+OQGvDfZec
 Ire8r+Pwz8qPWmGY0+pZO6IybPpqq50hCf/Q0k4sXM+eJ6XblGFBV+Ct1qyKZTsPmyki3dptq
 4mgOYz4Y/gRjG3mFw3la3scvQ9LERZOd6/J29WDvXvbre9wjruF6Sl5lwNfrfjqIuV7VfF32o
 JaHG9ZAJ1g7GYTGSSpCn8thuDV9uZmoqiXfY++eJ/ckkxsVORUoZZqsFbfcOOI3EsVmVMb44R
 8zA8sSAFi+kzABYGQdMjKCK26uv46VjmL6mkdwvqOkRe+WC3VtK44OzjpOZV1ayYY5xZ4JIc7
 uiNqg6fIVuWmaXnvx5WTa9Em9IhBoBjk1a1cU2nYhikyQkzCelW8CE5VOpZYWRQPgNq/ckGjy
 Vz/M4l+/Ektu2LiGSB7EHEx5vg5H27NZlC6CPYPcaR8kToXZ2EXz+Zo5cIDL+EhxGfsNDJL7t
 I5Fuvufoa0Z/7w=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 53644
Cc: Philip Kaludercic <philipk@HIDDEN>, 53644 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Dmitry Gutov <dgutov@HIDDEN> writes:

Hi Dmitry,

> Nice. Some integration with the Customize UI probably wouldn't hurt, though.

Good idea. I'll see whether I can assemble something useful.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 7 Feb 2022 02:57:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 06 21:57:41 2022
Received: from localhost ([127.0.0.1]:40562 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nGuDl-00018A-Fy
	for submit <at> debbugs.gnu.org; Sun, 06 Feb 2022 21:57:41 -0500
Received: from mail-wm1-f45.google.com ([209.85.128.45]:43648)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1nGuDk-00017x-6m
 for 53644 <at> debbugs.gnu.org; Sun, 06 Feb 2022 21:57:40 -0500
Received: by mail-wm1-f45.google.com with SMTP id
 k6-20020a05600c1c8600b003524656034cso7638047wms.2
 for <53644 <at> debbugs.gnu.org>; Sun, 06 Feb 2022 18:57:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:message-id:date:mime-version:user-agent:subject
 :content-language:to:cc:references:from:in-reply-to
 :content-transfer-encoding;
 bh=Tqq36sOSGMVB7FY9FwlMErF4Rx93US4wBKk8Xx5KuNc=;
 b=YOfTPogaUW9kM6gZRANfU+kl3vpb5h78rA+bWXqJ/D0TRx05nLyg/KKabfpb9/mBCr
 y87rxmVy6kVOLdfVAeUrT2S2iqvZAEgD33sJFcjNDCBhzmGYXOfFOHQqdF4GU+lkYFsk
 nu9QnlUeZ3cJYpswv2NvPLagF0Q7aHndlX/jT0f9424kgMrWgRp4fnIXyVaP1NibOeNx
 m82B0ZHbihexIUirHp5LceNUcSJfg8Sgz713DX4EFO9VdXrgdi+yn0QcGva8f39vC4XW
 O3ICSMfvhSKd8snpcnSWYWMP/aJNq193zjnQGbw+5AZdnzAo1p5nifvI6GmxvOw9bCc8
 3ymg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:message-id:date:mime-version:user-agent
 :subject:content-language:to:cc:references:from:in-reply-to
 :content-transfer-encoding;
 bh=Tqq36sOSGMVB7FY9FwlMErF4Rx93US4wBKk8Xx5KuNc=;
 b=455QzjTVn0KBgb2RuMR6+exbDjqNR/caMIhWwNaczs/V/GNZ0Vt/8CqAIOAvs/u1xG
 B53RnsbIrXHksqVWgR2f8sU55mGlSgg7bAIi5AO1lUF/tMFiQA0Q01cxA8BoeT20eUHS
 gDpJib8ZHDNaJ+8z6T/h0X9qZgbkUQcFrer1KDA3uuuWloMsDPl/LfEjP2fwR81/K7Jg
 WZpR3wW79wSs6NZDgAw33VPRHNj9L1MZO2jFfLQVkvfu//RKHhPlZGWypDJkSfkCw2pv
 AZXwTnziF6jrmUCD/y1IyQRyChcdehN/whbqCMaxWO3xfrd2ARdPKNt5M4tqlPzZUK0q
 lp+g==
X-Gm-Message-State: AOAM532WHEdFFR76EMYC033jMybCSdt/FfzsWXcGc4KQSt2nCipzMwID
 PdcXxeoZPrcRrIVyLTbw6AI=
X-Google-Smtp-Source: ABdhPJwhP3VpyTd+rHJqxdU2dlvnuYQ95qo8hfxRqe18Pjx24oqsxTvCDUEJxlh/zkMLMkaNnPWqlg==
X-Received: by 2002:a1c:2942:: with SMTP id p63mr9054266wmp.75.1644202654078; 
 Sun, 06 Feb 2022 18:57:34 -0800 (PST)
Received: from [192.168.0.6] ([46.251.119.176])
 by smtp.googlemail.com with ESMTPSA id g22sm2409717wmh.7.2022.02.06.18.57.32
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 06 Feb 2022 18:57:33 -0800 (PST)
Message-ID: <01015f05-e40c-c18a-8b03-5012a3cb44ba@HIDDEN>
Date: Mon, 7 Feb 2022 04:57:31 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.5.0
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
Content-Language: en-US
To: Michael Albinus <michael.albinus@HIDDEN>
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN> <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN> <87leypml9i.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
In-Reply-To: <87leypml9i.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 53644
Cc: Philip Kaludercic <philipk@HIDDEN>, 53644 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

On 05.02.2022 16:38, Michael Albinus wrote:
> Dmitry Gutov <dgutov@HIDDEN> writes:
> 
>> Hi Michael,
> 
> Hi Dmitry,
> 
>>>>> When invoking a command that respects xref-search-program via TRAMP,
>>>>> e.g. on a remote system that doesn't have (in my case ripgrep)
>>>>> installed, an error is signalled indicating that the search query
>>>>> couldn't be executed.
>>>>
>>>> One way to work around this will probably involve an addition to
>>>> find-file-hook and some code which checks (file-remote-p
>>>> buffer-file-name) and sets xref-search-program to a particular value
>>>> buffer-locally depending on the result.
>>>>
>>>> Or an around-advice for xref-matches-in-files.
>>> There are connection-local variables exactly for this use case.
>>
>> Is there a documented way on how to make the variable's value on
>> remote hosts customizable for the user too?
> 
> Something like
> 
> --8<---------------cut here---------------start------------->8---
> (connection-local-set-profile-variables
>   'remote-xref-variables
>   '((xref-search-program . "/bin/grep")))
> 
> (with-eval-after-load 'xref
>    (connection-local-set-profiles
>     '(:application tramp :machine "myhost")
>     'remote-xref-variables))
> --8<---------------cut here---------------end--------------->8---

Nice. Some integration with the Customize UI probably wouldn't hurt, though.

Philip, would you like to try writing a patch along the lines of 
Michael's suggestion?

It would need to use version checks, though, given that connection-local 
vars were only added in Emacs 27.

To get you started, here's one example of this feature's usage: 
https://github.com/company-mode/company-mode/blob/c25f1fbc3850e36e6521b77fa1641d5583365d8b/company-gtags.el#L71-L96

And you can search in Emacs's own repository, of course, for other examples.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 5 Feb 2022 14:38:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 05 09:38:28 2022
Received: from localhost ([127.0.0.1]:34129 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nGMCq-0006Da-09
	for submit <at> debbugs.gnu.org; Sat, 05 Feb 2022 09:38:28 -0500
Received: from mout.gmx.net ([212.227.15.19]:59011)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1nGMCn-0006DN-Mu
 for 53644 <at> debbugs.gnu.org; Sat, 05 Feb 2022 09:38:26 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1644071899;
 bh=Ca+9rIOVIZ8pT7IuDlw0+zLwNcm31QStKWI/MuGZfsE=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=OmZ9pY2YdASm+qEASUfX0HFnPp2GXZ7Lov4nzC9SDCfnR0w+qFb68arfyYxc/AhvP
 vOlqd/KTegIiMJaTqhKX4fCzo9bxa6qVw/ChTQpLxsNcaCdLzMMGAEPOKOR95fVgej
 z7iUYS4cJTMD2Q9aNBGNZQnAZUbBOO5v5caUoiss=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([213.220.149.107]) by mail.gmx.net (mrgmx005
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MTABZ-1mmTn33J55-00Udzh; Sat, 05
 Feb 2022 15:38:18 +0100
From: Michael Albinus <michael.albinus@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
 <87iltvnj3g.fsf@HIDDEN>
 <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN>
Date: Sat, 05 Feb 2022 15:38:17 +0100
In-Reply-To: <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN> (Dmitry Gutov's
 message of "Fri, 4 Feb 2022 21:45:39 +0200")
Message-ID: <87leypml9i.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:TZE7T5KOdaqlMa/BLo0w0LQ/wjRGPBf3r3tRixxl0RD9K9+WMAm
 QJTTmLOlJTnl7xadCQvbR2gLu+ZquWbhqvKMRumWeOzAL1l8mD2rhxLIregP9vZ97+MFh3r
 64cw9AbuvrOZKKBA5LB+BTqc/Dkea5NDaAtFtZjnqLx0XVLoXTJDuwKDqB/07Zgr+ohepB6
 6SzUT+pwcYXWmD9PhkNaw==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:Zv/dos/7C48=:iLXrZMRbXdiAuOvWijfaqi
 s6JaFF8aH+8s/JkcO7DDPeYn4gpP8pR3RPVVwFOBuG8YJeqDhiGqtDyLMSQvWLnUPXocvLuQP
 jbXEDoH9Ut/WPzSP3ymy6MOPArIFUcH0/uXwO1krSDBcGiWLGHPWv2DGDVblEc+rxU6BiLg+/
 pQ2NPbamkA1F1CC1hdkhRRs48WVkyAbKQeibpCzfNilTlPfNiHuRjZfxRruP0nhxMPeol60lg
 j82QQmg741aYh8POUGVWGj9+Veoy/7hyfUN4xKUnT2piYry4JXeX2Yn8c8jPVYe9HAtNRKK9q
 JkUSSwie+t16D0pEQugw+N76qxaOzxNjK6mdOa3mbIlKsLaYwmUaWyZ+QMei+fhvmtoz7aWWp
 3d3naUkrxybzhhCGdahenkuNfDWR5W49LGCqQq1hge3hJINX0mMLykVhRwPZaO7NpLI5NUcC6
 Ci4MTGvYnoZOR4/h+zzAWtGDLfCau5kQzagtmCqUNck+G0/WksVXc9a7Xvj9ddTEmXivlqWQY
 pwn3uSzGh2amBPOn2JoAzyA6o9ZH8+Af3ROO4VeYXzDO5N+MbNmtzmXxU9WTiTvCTVKmr/0mQ
 F9y+MtydB1rilGIi1pCBQxWecN5sthi/X1g55jNFJJBBQYEUBFyTUt+/tAGz95cNrFmLjQ/u0
 TkA1NekuF6uTSPTBVTMQYgbwP8JQcT1Bw4qzihLfZfUl9+Cei8AzPDXF/zJeedtVHnEz+WR5c
 CpNGdjcx1tLcrmisRiOdGbL9esaM3iHqAN9gntIk4/wxj0rlShEVAKgHvjC+soXMN9l7Mzjhl
 JWuKqimXJ8uyCu/QvKMbMi7fsMOSwjdnkgSB3zpcgiyypSANLOdFgmxch5zBi8o/zSfh58ptK
 VBpXotyJV12Ex5ryb28e/dnS/76jXB+xXEHrt2WcH6//PnKaMxAoqv3XE4MQVVE3QF8ouycM4
 w2rM+xNrqhtOVIc6u7y7pv+Mn3HOcrkjO+kKGPyYYnaePogDoCTBy5/XmBXVZeZDGPOLeCjmc
 cPyBNZiZIS7Gw6ZcRimL7tLRUlPH7rLNMf1HvP1yZigSVufcggmSBsrOPo1ni/o296DIG2LnC
 do8yIpyjjTu4rg=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 53644
Cc: Philip Kaludercic <philipk@HIDDEN>, 53644 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Dmitry Gutov <dgutov@HIDDEN> writes:

> Hi Michael,

Hi Dmitry,

>>>> When invoking a command that respects xref-search-program via TRAMP,
>>>> e.g. on a remote system that doesn't have (in my case ripgrep)
>>>> installed, an error is signalled indicating that the search query
>>>> couldn't be executed.
>>>
>>> One way to work around this will probably involve an addition to
>>> find-file-hook and some code which checks (file-remote-p
>>> buffer-file-name) and sets xref-search-program to a particular value
>>> buffer-locally depending on the result.
>>>
>>> Or an around-advice for xref-matches-in-files.
>> There are connection-local variables exactly for this use case.
>
> Is there a documented way on how to make the variable's value on
> remote hosts customizable for the user too?

Something like

--8<---------------cut here---------------start------------->8---
(connection-local-set-profile-variables
 'remote-xref-variables
 '((xref-search-program . "/bin/grep")))

(with-eval-after-load 'xref
  (connection-local-set-profiles
   '(:application tramp :machine "myhost")
   'remote-xref-variables))
--8<---------------cut here---------------end--------------->8---

> Cheers,
> Dmitry.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 4 Feb 2022 19:45:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 04 14:45:50 2022
Received: from localhost ([127.0.0.1]:32863 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nG4Wk-0000mt-4y
	for submit <at> debbugs.gnu.org; Fri, 04 Feb 2022 14:45:50 -0500
Received: from mail-wr1-f43.google.com ([209.85.221.43]:39758)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1nG4Wi-0000mX-8Q
 for 53644 <at> debbugs.gnu.org; Fri, 04 Feb 2022 14:45:48 -0500
Received: by mail-wr1-f43.google.com with SMTP id r17so4141700wrr.6
 for <53644 <at> debbugs.gnu.org>; Fri, 04 Feb 2022 11:45:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:message-id:date:mime-version:user-agent:subject
 :content-language:to:cc:references:from:in-reply-to
 :content-transfer-encoding;
 bh=vF2/sogyDsP2CvkY89S4v+qy9kLYhYOREu0bCSh535A=;
 b=oVkk0CVCDdA31RlEy766/bCuWb8M17FLPgfKp1BPRQh3fqTVs67mUfrPcZIirbQD1J
 /cxrUapmcM2eJ3S1WNpKRZX7zjypWtaCzoDkmTT/Umg/NKZuZX5EV7wqN/LlzabT9qL0
 4EWfazliLhgaqDnJf7uRY/LKCfhkCccy6toeBkn3/V7jrePGSKGe3osLFs8m3Th0mjMB
 dIzZw0dKPHWit3yaA4H4jMHRqfNMz0VpjhJkCbyDpvBcmO3u7hsv0+an/BT0eeeYU+g4
 HDdIiWGUKLcrSVNEKdxCezgjDybD14VirD7TG8EVzKraOCpSElCc+ftw1sn+ywlzCvfB
 n1/g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:message-id:date:mime-version:user-agent
 :subject:content-language:to:cc:references:from:in-reply-to
 :content-transfer-encoding;
 bh=vF2/sogyDsP2CvkY89S4v+qy9kLYhYOREu0bCSh535A=;
 b=2S6ECCn0ckpuxJx1eknXHfV3bPoKiRSIvkurpUIfxfTML3lFNNQ4W7zBAqLQsOpMm9
 ntqoT8rfQaAJ2XxKJLM0DTKzA78xxIotAQ34GTCF5lZQwYSsWGcIkjJpxuwF5BFXvYRK
 XhHT2jAkEQCns/RvtIfgJKh437uTKU4sEsaXyEBJ76wGyhHyViOvZt9n/hdtDzLswmAE
 32I7IFS3d8HWrgfqM5nJBcLsbguWnHqX18vKjhwjCY37XfMEL7RK1scDPdiKUi4pZJfv
 4o50/YMCdwYExYAhz6yOljzof1xdKH/KrFKwkiQQX04z0ZGagaxddxRNRksnPUKn9djP
 nxJg==
X-Gm-Message-State: AOAM532UAOyN9u5dPom+yWKuBalGaGKqRYyzFlnSFcZjt/WmisRDCDB8
 HNDKYPCWaZrH7mdkmddsT0A=
X-Google-Smtp-Source: ABdhPJxUkUJMpHaXp/Ly3cykfm74W4xSygWEBGJEIn2v17+hUf7lYY7D0C4uyNFXU22Yi9CNpLC9Rg==
X-Received: by 2002:adf:ebc2:: with SMTP id v2mr396979wrn.498.1644003942226;
 Fri, 04 Feb 2022 11:45:42 -0800 (PST)
Received: from [192.168.0.6] ([46.251.119.176])
 by smtp.googlemail.com with ESMTPSA id p3sm10474829wmq.40.2022.02.04.11.45.40
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Fri, 04 Feb 2022 11:45:41 -0800 (PST)
Message-ID: <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@HIDDEN>
Date: Fri, 4 Feb 2022 21:45:39 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.5.0
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
Content-Language: en-US
To: Michael Albinus <michael.albinus@HIDDEN>
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN> <87iltvnj3g.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
In-Reply-To: <87iltvnj3g.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 53644
Cc: Philip Kaludercic <philipk@HIDDEN>, 53644 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

Hi Michael,

On 04.02.2022 10:15, Michael Albinus wrote:

>>> When invoking a command that respects xref-search-program via TRAMP,
>>> e.g. on a remote system that doesn't have (in my case ripgrep)
>>> installed, an error is signalled indicating that the search query
>>> couldn't be executed.
>>
>> One way to work around this will probably involve an addition to
>> find-file-hook and some code which checks (file-remote-p
>> buffer-file-name) and sets xref-search-program to a particular value
>> buffer-locally depending on the result.
>>
>> Or an around-advice for xref-matches-in-files.
> 
> There are connection-local variables exactly for this use case.

Is there a documented way on how to make the variable's value on remote 
hosts customizable for the user too?

Or maybe it's not exactly necessary for this custom var.

>> A proper solution would probably look more similar to
>> grep-host-defaults-alist and grep-compute-defaults.
> 
> On my wishlist, there is moving grep-*-defaults to connection-local
> variables. But I fear it will break too many existing configurations.
> 
> Best regards, Michael.

Cheers,
Dmitry.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 4 Feb 2022 08:15:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 04 03:15:24 2022
Received: from localhost ([127.0.0.1]:58726 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nFtka-0003gP-IS
	for submit <at> debbugs.gnu.org; Fri, 04 Feb 2022 03:15:24 -0500
Received: from mout.gmx.net ([212.227.15.15]:53427)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1nFtkZ-0003gA-CU
 for 53644 <at> debbugs.gnu.org; Fri, 04 Feb 2022 03:15:23 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1643962516;
 bh=QpPf2mIYkciCuWg/Bn82unv+8AeLeqgwwyCnzk0/Y+4=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=ONbj+QlGIQlr9YBajrGn6Leaoav7NNthYO8UkDrsG374WHQdfAcYCxo+pcsJBLUOx
 +V0aevWUnq9/8xCNT0Z3QY4kdK1VZY2FLiffYLzFyyEJSOrera6fLzPKt67YpdqbTS
 8zzLk5D6ONGEyrknH25hYFYgJmYOyA9hf+GsY86c=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([213.220.159.97]) by mail.gmx.net (mrgmx005
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MgesQ-1mYtQG1OLk-00h6EX; Fri, 04
 Feb 2022 09:15:16 +0100
From: Michael Albinus <michael.albinus@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
In-Reply-To: <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN> (Dmitry Gutov's
 message of "Fri, 4 Feb 2022 04:00:17 +0200")
References: <87v8y0rdz3.fsf@HIDDEN>
 <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
Date: Fri, 04 Feb 2022 09:15:15 +0100
Message-ID: <87iltvnj3g.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:l+gLQTLxPPLkxmIrL6Q138NDwPhDa4jlPGKHkdy1lW3pcwbu9Aj
 gqSHUAu1tNVUQZGfUZIi/jPgiyRnU6n/ETVWMt3Pl/a5jyA2iw7uI9D0rsSoOAqU5Pfyg76
 mPaEf1qmqmfXlqYWOs+RTHOeuxhXSnYf1EwsbEim79cVo/6uSEItbgfu0PjTThm9AiyJFuJ
 vikZMxKT1xq/5dcb1w6QA==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:nlGhuSJCdtY=:xXaYxQIAj0bAqVcDiOYkIg
 1MLmERwM737JhRnScVRT6OEtIx+OVQ5b05YUELnWJ3F1wlAqoLBFSGHNrpfUwEN9ugl/4Z8PV
 C5bmMBZV4ToP7vDOQv6NJgQBrI61os6nM0MvEmRZ/7SNErvZ0cRcV8bkUMhEi4kMo8bzMnCCu
 G9BmpF9YMooG/zSq41pHVHjLoLpPOhubCG7SI/UMB8n0NSov5qaTgdxfUslJhkYzss5zs4sVx
 PyJLjodCOPKr0OrrItBFEPeyVkKHN51egxUZag9Hfh4ew4berlC5uTyHmCl53wphfmo9uwOlC
 JXNAt4XQCcy7/c2IlsFTbPPwm3YDL/aoOS2NNHlE4RRMQDAsMOkb3tILixuActnO49wsJ3GM1
 ejQPdCHveRK2CT5bpIGQDyIozgDdE8bnYNr2/QaghMcP23N7RLtcp/z44zhpNquEQi28YCVWB
 JZWgAgwhxlTp8WHPBSWSpsiKvriJ9MkwL63Ubq+OcMCbHJ/dYavxY7/gV5MX1iQNb+wVXLWZ5
 St1CViQgeOjloaLDHBoWDD9BO7ZIYGNDOcwEWZm241+PERND6iCKg1xKcQCU4Nruy3YxyR3Br
 XKZdKbc6eI5EpJDNYSl7FzQRlievAX85BoPwIY6oczy1WcN+UwIMtgcMh6rUrLCMYDTaY0etv
 sfU4szFPcsin4rpwW7hbwAiYRJsVR/yV5PQicSnF4E1CzX6Oza6PLVBBwt6G2sH5y/3Tc2xME
 rmzdRcHMI5Ya6DEFbRmZ8MBzHAXndNQSUQL70S18PdV/8jFTbKcs8A8tG2abCBK5Z2spA6tWz
 bEKmqhXwiDFW4kabwoGqbwwo0KLR+T0XhwGcWNdp0PawfbG0iMs/1OzMqjMmP52ucy5iqG5Vw
 8ELRAyJ4YCdI//uZtLV1L0waBaHenCOPzNWxKI02S43FBaP7BE1adVXwkRAxvmD0EuDcJhYuD
 zZmh8EeSP7bo5hwL1a5bwiULprBwXbvDdo8CJ6tLhO56SJnBAdDh8pRqqb5GQMwdwbOzZOWmh
 f9HTd2dtOEt2bTY69XUO3qV2TRttHQ3i0fYrsv3c5SEdy8Sys6TQt0gw7hCAXkaKVl9VE5I8t
 lwKr0LXrh0MQMU=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 53644
Cc: Philip Kaludercic <philipk@HIDDEN>, 53644 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Dmitry Gutov <dgutov@HIDDEN> writes:

> Hi Philip,

Hi Dmitry,

>> When invoking a command that respects xref-search-program via TRAMP,
>> e.g. on a remote system that doesn't have (in my case ripgrep)
>> installed, an error is signalled indicating that the search query
>> couldn't be executed.
>
> One way to work around this will probably involve an addition to
> find-file-hook and some code which checks (file-remote-p
> buffer-file-name) and sets xref-search-program to a particular value
> buffer-locally depending on the result.
>
> Or an around-advice for xref-matches-in-files.

There are connection-local variables exactly for this use case.

> A proper solution would probably look more similar to
> grep-host-defaults-alist and grep-compute-defaults.

On my wishlist, there is moving grep-*-defaults to connection-local
variables. But I fear it will break too many existing configurations.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at 53644 <at> debbugs.gnu.org:


Received: (at 53644) by debbugs.gnu.org; 4 Feb 2022 02:00:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 03 21:00:30 2022
Received: from localhost ([127.0.0.1]:58423 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nFntm-0002VX-C6
	for submit <at> debbugs.gnu.org; Thu, 03 Feb 2022 21:00:30 -0500
Received: from mail-wr1-f51.google.com ([209.85.221.51]:40451)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1nFnth-0002VD-8A
 for 53644 <at> debbugs.gnu.org; Thu, 03 Feb 2022 21:00:29 -0500
Received: by mail-wr1-f51.google.com with SMTP id s18so8511563wrv.7
 for <53644 <at> debbugs.gnu.org>; Thu, 03 Feb 2022 18:00:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:message-id:date:mime-version:user-agent:subject
 :content-language:to:references:from:in-reply-to
 :content-transfer-encoding;
 bh=36oQ8XkfHLYJjOIYezmpXVt+0nuK5p7NMA8ATf6U0SI=;
 b=V0sSY2/k1jZ0cZq53nSP4EK1YXigw2jCPf0NveLguJjykwNcB+iICQDjrcuulM7i+C
 iVxhjMrMUxFMRV0a0ievr9K78oMq21EJyiDB+DB75LLZ8ZF9tbJfW6aqz3/Q+pTl96+Q
 V/dKSTvJlnjj4Fwc0k8uhHIJmRFh8n2KP9s0+jmoRdGBhXaqGdo4Qm6zQC1Yat1DkFKD
 6GF+vysjV9otPXUNI4GvOOGwXBLJvIBQwCXfUUKxhjkUZhsk365+X/vjfBWY7Mz0rSL5
 8+FWCsii+j1ODBMzcLuMchjPmVgByPxWtrMvV/2mfzMSr0tIAKssqyDSpxy5W+5GLk+z
 LJOA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:message-id:date:mime-version:user-agent
 :subject:content-language:to:references:from:in-reply-to
 :content-transfer-encoding;
 bh=36oQ8XkfHLYJjOIYezmpXVt+0nuK5p7NMA8ATf6U0SI=;
 b=2ZspsY3/jHTX/Flyue7TXYuhCi0o0xWwfUHFUtsDnyG28BQoNvITg5iZ2aE5wYj/Fk
 M6ap/VvfyZmUlvca4ZAWHHhSkt6jqLO9x8oki08fLNLOw3vECgx/1KhJSEDvt0tzm+7n
 LxMHqTdfwph2z+ALx4QFWQpF3N/LMUqA0n63BaU3q6wnxbhgKat+SZOZ6kquXkG7xN23
 PU+AuViabSMSyVMqh/KLT4pp+ASfpJcdiDYwqJOk0/hrNkBwDLkDobUeJRmA0pfu/KKR
 pMAUWIusstpXuG+Kk82rlJEuYDARt4pEkyIsRHyLAeodRdqgek2V6mAvOPirbLgLmSx4
 CmKQ==
X-Gm-Message-State: AOAM532ZT5G01mRr09BuqZgJ4U215Yh+RnVL1188ggEvXDj2hlo5aggx
 jtdsC7lRNiHiU9Oxr4Vl/ao=
X-Google-Smtp-Source: ABdhPJzPb6ZajLyJUw5SQY4U4xcI1unDpjxvnxLBR3HSuDMBfokHKeWtFihLetGxqOldeKs9W6qMjA==
X-Received: by 2002:a05:6000:2c3:: with SMTP id o3mr543999wry.38.1643940019109; 
 Thu, 03 Feb 2022 18:00:19 -0800 (PST)
Received: from [10.111.251.39] ([194.36.25.24])
 by smtp.googlemail.com with ESMTPSA id e15sm471239wrg.6.2022.02.03.18.00.18
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 03 Feb 2022 18:00:18 -0800 (PST)
Message-ID: <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@HIDDEN>
Date: Fri, 4 Feb 2022 04:00:17 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.5.0
Subject: Re: bug#53644: 29.0.50; xref-search-program breaks if programm not
 installed on a remote host
Content-Language: en-US
To: Philip Kaludercic <philipk@HIDDEN>, 53644 <at> debbugs.gnu.org
References: <87v8y0rdz3.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
In-Reply-To: <87v8y0rdz3.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 53644
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

Hi Philip,

On 31.01.2022 01:38, Philip Kaludercic wrote:
> When invoking a command that respects xref-search-program via TRAMP,
> e.g. on a remote system that doesn't have (in my case ripgrep)
> installed, an error is signalled indicating that the search query
> couldn't be executed.

One way to work around this will probably involve an addition to 
find-file-hook and some code which checks (file-remote-p 
buffer-file-name) and sets xref-search-program to a particular value 
buffer-locally depending on the result.

Or an around-advice for xref-matches-in-files.

> I managed to temporarily circumvent the issue with this patch
> 
> 
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index c812f28c1b..92c3d5c9d5 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -794,6 +794,11 @@ project-find-regexp
>     (let* ((caller-dir default-directory)
>            (pr (project-current t))
>            (default-directory (project-root pr))
> +         (xref-search-program
> +          (if (and (eq xref-search-program 'ripgrep)
> +                   (not (executable-find "rg" t)))
> +              'grep
> +              xref-search-program))
>            (files
>             (if (not current-prefix-arg)
>                 (project-files pr)
> 
> 
> but just assuming that grep is available might just push the actual
> problem aside.  Should xref-search-program be able to indicate a
> failback, and perhaps even eventually fall back onto a elisp grep that
> might be slow but at least would do the job?

This seems like it will have to call 'executable-find' every time the 
command is used on a remote host, and I imagine that's not free. 
Especially with high network lag. For fast searches (and distant/slow 
hosts) it might almost double the execution time.

A proper solution would probably look more similar to 
grep-host-defaults-alist and grep-compute-defaults.

I'm not sure whether xref should grow a separate facility like that, 
though, or whether xref-search-program can become more assimilated into 
grep.el instead.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 30 Jan 2022 23:38:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 30 18:38:50 2022
Received: from localhost ([127.0.0.1]:38003 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nEJmU-0000wK-Cz
	for submit <at> debbugs.gnu.org; Sun, 30 Jan 2022 18:38:50 -0500
Received: from lists.gnu.org ([209.51.188.17]:43486)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1nEJmR-0000wB-Di
 for submit <at> debbugs.gnu.org; Sun, 30 Jan 2022 18:38:49 -0500
Received: from eggs.gnu.org ([209.51.188.92]:38818)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philipk@HIDDEN>)
 id 1nEJmR-00087x-2f
 for bug-gnu-emacs@HIDDEN; Sun, 30 Jan 2022 18:38:47 -0500
Received: from mout01.posteo.de ([185.67.36.65]:35729)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <philipk@HIDDEN>)
 id 1nEJmO-0004GY-Gr
 for bug-gnu-emacs@HIDDEN; Sun, 30 Jan 2022 18:38:46 -0500
Received: from submission (posteo.de [89.146.220.130]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 4040B240027
 for <bug-gnu-emacs@HIDDEN>; Mon, 31 Jan 2022 00:38:41 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1643585921; bh=lo0OHmQKb+Dnyf44iEEaf+6v9+KDIn8dCdPquXP1l7k=;
 h=From:To:Subject:Autocrypt:Date:From;
 b=UM8cZPfGz9U9Y55T4pU1jtgGILxCrQH5oKytjqNbLMNnDGqgBwK882D1NihdD28Z8
 JJKyXt9rk9wMrwT/OA3TMy+cainavOzj+DhsmzToA3KvEY9vPbNQdXOwpgUq+jzn77
 11gcJ5FYjtstRj8JNf/K4HkWO6EHwXeG5LvucfoDdbDS5bsXYdhqT9ewXnshdPvKzc
 ewCFhfmW6Hb2U2hOdX5kCht0TQ3UPZrCMTB0a19Hg05PE+ZLk/RLgNOvg0XHoCVQTN
 G6WSxBHDcPP92miM73IduwEPlakhlVnfUw+xEmjVcBl9I8hJYtCuq3OCXQGTDFxYMc
 JyTHRMCk7GLgA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Jn71X47Psz9rxP
 for <bug-gnu-emacs@HIDDEN>; Mon, 31 Jan 2022 00:38:40 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.50; xref-search-program breaks if programm not installed on a
 remote host
Autocrypt: addr=philipk@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ
 CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh
 io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF
 AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo
 Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS
 g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB
Date: Sun, 30 Jan 2022 23:38:40 +0000
Message-ID: <87v8y0rdz3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@HIDDEN;
 helo=mout01.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain


When invoking a command that respects xref-search-program via TRAMP,
e.g. on a remote system that doesn't have (in my case ripgrep)
installed, an error is signalled indicating that the search query
couldn't be executed.

I managed to temporarily circumvent the issue with this patch


--=-=-=
Content-Type: text/plain
Content-Disposition: inline

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index c812f28c1b..92c3d5c9d5 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -794,6 +794,11 @@ project-find-regexp
   (let* ((caller-dir default-directory)
          (pr (project-current t))
          (default-directory (project-root pr))
+         (xref-search-program
+          (if (and (eq xref-search-program 'ripgrep)
+                   (not (executable-find "rg" t)))
+              'grep
+              xref-search-program))
          (files
           (if (not current-prefix-arg)
               (project-files pr)

--=-=-=
Content-Type: text/plain


but just assuming that grep is available might just push the actual
problem aside.  Should xref-search-program be able to indicate a
failback, and perhaps even eventually fall back onto a elisp grep that
might be slow but at least would do the job?

In GNU Emacs 29.0.50 (build 4, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars)
 of 2022-01-21 built on icterid
Repository revision: 98355833ba0d7dc20742122334be1bfaefac7873
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --with-x-toolkit=athena --with-native-compilation
 'CFLAGS=-Os -march=native -mtune=native -pipe' LDFLAGS=-flto'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $EMACSLOADPATH: 
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  auto-revert-mode: t
  shell-dirtrack-mode: t
  bug-reference-prog-mode: t
  rcirc-track-minor-mode: t
  outline-minor-mode: t
  corfu-mode: t
  flymake-mode: t
  flyspell-mode: t
  recentf-mode: t
  repeat-mode: t
  display-time-mode: t
  diff-hl-flydiff-mode: t
  diff-hl-mode: t
  winner-mode: t
  windmove-mode: t
  vertico-multiform-mode: t
  vertico-mode: t
  electric-pair-mode: t
  save-place-mode: t
  savehist-mode: t
  xterm-mouse-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-save-visited-mode: t

Load-path shadows:
/home/philip/.config/emacs/site-lisp/eglot/eglot hides /home/philip/.config/emacs/elpa/eglot-1.8/eglot
/home/philip/.config/emacs/site-lisp/eglot/eglot-tests hides /home/philip/.config/emacs/elpa/eglot-1.8/eglot-tests
/home/philip/.config/emacs/site-lisp/vc-backup/vc-backup hides /home/philip/.config/emacs/elpa/vc-backup-1.1.0/vc-backup
/home/philip/.config/emacs/elpa/transient-0.3.7/transient hides /home/philip/Source/emacs/lisp/transient
~/.config/emacs/site-lisp/autoload hides /home/philip/Source/emacs/lisp/emacs-lisp/autoload

Features:
(shadow emacsbug etags fileloop generator eglot array jsonrpc ert
flymake-shellcheck sh-script smie executable perl-mode vc-mtn vc-hg
vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs grep flymake-cc
yasnippet-snippets yasnippet cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs debug shell-command+
dired-aux gnus-dired org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-footnote org-src ob-comint org-pcomplete org-list
org-faces org-entities org-version ob-emacs-lisp ob-core ob-eval
org-table oc-basic bibtex ol org-keys oc org-compat advice org-macs
org-loaddefs cal-menu calendar cal-loaddefs debbugs-gnu debbugs
soap-client rng-xsd rng-dt rng-util xsd-regexp tar-mode arc-mode
archive-mode url-http url-gw url-cache url-auth cus-edit pp cus-start
finder-inf cl-print edebug backtrace whitespace vc-annotate qp
magit-extras face-remap magit-submodule magit-obsolete magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log which-func imenu magit-diff smerge-mode git-commit
log-edit add-log magit-core magit-autorevert autorevert filenotify
magit-margin magit-transient magit-process with-editor shell pcomplete
server magit-mode transient edmacro kmacro format-spec magit-git
magit-section magit-utils crm dash mailalias smtpmail avy mule-util
char-fold misearch multi-isearch pulse color xref vc-git bug-reference
find-func help-fns autocrypt-message copyright vc-backup log-view
pcvs-util time-stamp sort smiley gnus-cite mm-archive mail-extr textsec
uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check
gnus-async gnus-bcklg gnus-ml autocrypt-gnus autocrypt nndraft nnmh
utf-7 nnfolder gnus-agent gnus-srvr gnus-score score-mode nnvirtual
gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig nntp
gnus-cache gnus-sum shr pixel-fill kinsoku svg dom gnus-group gnus-undo
gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7
netrc nnoo gnus-spec gnus-int gnus-range message yank-media rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader
gnus-win modus-vivendi-theme gnutls network-stream puny nsm rmc epa-file
epa epg rfc6068 epg-config rcirc parse-time iso8601 vertico-directory
vertico-flat noutline outline corfu checkdoc flymake-proc flymake
derived project thingatpt flyspell ispell comp comp-cstr warnings
cl-extra auth-source-pass recentf tree-widget repeat dired-x dired
dired-loaddefs time sendmail gnus nnheader gnus-util time-date
mail-utils range wid-edit help-at-pt diff-hl-flydiff diff diff-hl vc-dir
ewoc vc vc-dispatcher diff-mode hippie-exp winner windmove rx
vertico-multiform vertico easy-mmode pcase elec-pair saveplace savehist
xt-mouse modus-operandi-theme modus-themes rot13 disp-table icomplete
cus-load setup help-mode compile text-property-search comint ansi-color
ring autoload radix-tree lisp-mnt mail-parse rfc2231 rfc2047 rfc2045
mm-util ietf-drums mail-prsvr slime-autoloads info package browse-url
url url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json map url-vars
seq gv subr-x byte-opt bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget keymap hashtable-print-readable backquote threads
dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 1126377 131479)
 (symbols 48 44180 90)
 (strings 32 188808 12506)
 (string-bytes 1 5609582)
 (vectors 16 107028)
 (vector-slots 8 2610956 134057)
 (floats 8 793 733)
 (intervals 56 49401 625)
 (buffers 992 94))

-- 
	Philip Kaludercic

--=-=-=--




Acknowledgement sent to Philip Kaludercic <philipk@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#53644; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 14 Feb 2022 14:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.