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

Previous Next

Package: emacs;

Reported by: Philip Kaludercic <philipk <at> posteo.net>

Date: Sun, 30 Jan 2022 23:39:01 UTC

Severity: normal

Found in version 29.0.50

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Philip Kaludercic <philipk <at> posteo.net>, 53644 <at> debbugs.gnu.org
Subject: bug#53644: 29.0.50; xref-search-program breaks if programm not installed on a remote host
Date: Mon, 7 Feb 2022 04:57:31 +0200
On 05.02.2022 16:38, Michael Albinus wrote:
> Dmitry Gutov <dgutov <at> yandex.ru> 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.




This bug report was last modified 3 years and 122 days ago.

Previous Next


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