From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#53644: 29.0.50; xref-search-program breaks if programm not installed on a remote host Date: Tue, 15 Feb 2022 03:27:48 +0200 Message-ID: References: <87v8y0rdz3.fsf@posteo.net> <87iltvnj3g.fsf@gmx.de> <3b4cfff4-4d95-9f8e-d5ec-db6cc492a9b8@yandex.ru> <87leypml9i.fsf@gmx.de> <01015f05-e40c-c18a-8b03-5012a3cb44ba@yandex.ru> <875ypp624b.fsf@posteo.net> <87iltptnem.fsf@gmx.de> <87k0e5uvtp.fsf@posteo.net> <87a6f1tdlt.fsf@gmx.de> <87bkzhrrd2.fsf@posteo.net> <875ypotqwj.fsf@gmx.de> <878ruk4cwo.fsf@posteo.net> <828ff352-8a6c-b768-a4cc-427f6fd955f7@yandex.ru> <87leydy2iz.fsf@posteo.net> <877d9xxsjd.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11258"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Cc: Michael Albinus , 53644@debbugs.gnu.org To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 15 02:31:16 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJmgV-0002nN-Od for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Feb 2022 02:31:15 +0100 Original-Received: from localhost ([::1]:47996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJmgU-0001i0-ES for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Feb 2022 20:31:14 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJmeM-0001CW-CY for bug-gnu-emacs@gnu.org; Mon, 14 Feb 2022 20:29:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49208) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJmeM-0003Pp-2R for bug-gnu-emacs@gnu.org; Mon, 14 Feb 2022 20:29:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nJmeM-0006te-0M for bug-gnu-emacs@gnu.org; Mon, 14 Feb 2022 20:29:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Feb 2022 01:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53644 X-GNU-PR-Package: emacs Original-Received: via spool by 53644-submit@debbugs.gnu.org id=B53644.164488848326439 (code B ref 53644); Tue, 15 Feb 2022 01:29:01 +0000 Original-Received: (at 53644) by debbugs.gnu.org; 15 Feb 2022 01:28:03 +0000 Original-Received: from localhost ([127.0.0.1]:43105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJmdO-0006sM-L6 for submit@debbugs.gnu.org; Mon, 14 Feb 2022 20:28:02 -0500 Original-Received: from mail-wr1-f45.google.com ([209.85.221.45]:36773) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJmdJ-0006ri-Ie for 53644@debbugs.gnu.org; Mon, 14 Feb 2022 20:28:00 -0500 Original-Received: by mail-wr1-f45.google.com with SMTP id o24so26904468wro.3 for <53644@debbugs.gnu.org>; Mon, 14 Feb 2022 17:27:57 -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=AuBCR8w9S+kaHyDHhLMAxeH/zMogOVCgX3OrmazSzmY=; b=pLn8WtAKQkaaU04CeZlkBvpPwiqx/42BGkA/jXOYiGzjxOpeo6YWzYBvjXSsYH9NVC EGroMQnTMQbmfA6AchbdDCYCWdJZIW7Pxsp4qb5S4oH29DViOVjjgjBzQ8FjG/h9y8e3 A70ov4GyfXhrO2jhfpNpZrWyWbhdZTIoJCPMh68cEbGk59z/TkBY1s6oY5d7YU6tFGkZ ReOCfX6rnbDccX2qug9S1ZzJKB5ZnSQCCL3Hg4q/MCy+uMXfrIc0vepQIVWneHkARzBr KzpvSZ3BMY93QjqmXNnJ+nUNJMulxw7LmbZnl2XdEqp3cMWkw9PC/szPKub4uBG4kPJD qYsQ== 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=AuBCR8w9S+kaHyDHhLMAxeH/zMogOVCgX3OrmazSzmY=; b=J1F0Op4jiaN69HV7+w37ySGqLdKzmaJVEZhwalEqTnqPRzzbjubJG1ywEnT+Lx0Lb2 1rBuI/ysGxGmTayGARxdDVXhej5N1buf7X56QuG2j81BNwsOlscNIyOOcgSxKEo4gRbb TMW6o7/zQlOEV2kLJ5osl1hHqV2jTu0X8xk38qwwgvmPvH+WoIfQgGy2UYHY6Taj5ax7 kbkIjNWQhj68poTdeLZDdqY7e8/4lDzQCkHKMK4tMpMYblFHP9qRUuusHBGk8C2puqB0 e7oS5xi1HpjuyZzS+oQ9e7isN0qMVMFxQO+zphGvmqs94isYbW3eyEXnwXy3sqE3I2+H Z+nQ== X-Gm-Message-State: AOAM531bWuxKDXoPg9Evi/eGmPwhLCnZgGTEpeP/v0VCQSvdVh35nsFW vGg+OneigYCg49Nby3lTCZo= X-Google-Smtp-Source: ABdhPJw93OE/tkMw/AZHmKzIWYdLRs/BN9OyuXGUi4Dxoy+7psMFaFwsuurolyQ7RhtJjQyLWjalKw== X-Received: by 2002:adf:e5cb:: with SMTP id a11mr1200800wrn.255.1644888471218; Mon, 14 Feb 2022 17:27:51 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id ay38sm15909348wmb.3.2022.02.14.17.27.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Feb 2022 17:27:50 -0800 (PST) Content-Language: en-US In-Reply-To: <877d9xxsjd.fsf@posteo.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:226956 Archived-At: On 14.02.2022 19:32, Philip Kaludercic wrote: > Dmitry Gutov writes: > >> 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). > > I guess this is what confuses me, what about the contents is relevant to > the query? `xref-matches-in-files' is already passed a list of files > that can be concatenated into the input for xargs. The current version > already works and is reasonably fast, so I don't recognise the > improvement. Sorry, I guess I wasn't clear enough. When I said "extract the detection logic", I meant implement something similar to 'grep-compute-defaults' where there is a bunch of "probing" code which detects which commands work on the given system (and which arguments, etc). But a shorter function, of course, since it would only need to choose between two alternatives -- and return it. And it seems to be it would be simpler (conceptually) if the said function didn't itself depend on xref-matches-in-files (the implementation or the return type). Though it's certainly possible to use it as well. ...so that function (let's call it xref--choose-search-program, perhaps) would write to a file in the temporary directory on the remote system, and then search in it using the configured search program, and then fall back to the default one if the first one fails. WDYT? >> 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". > > My apologies, I feel stupid for not understanding, but what would aaa, > bbb and ccc be? Those are characters. "aaa\nbbb\nccc" would be the temporary file's contents, verbatim. To clarify, I think your code quality is just fine, but the way the main function gets two responsibilities intertwined (both program detection and the actual search) seems a bit too much for me, clarity-wise.