Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 20 Sep 2021 17:04:47 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 20 13:04:47 2021 Received: from localhost ([127.0.0.1]:43949 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mSMil-0005D1-6D for submit <at> debbugs.gnu.org; Mon, 20 Sep 2021 13:04:47 -0400 Received: from mail-wr1-f41.google.com ([209.85.221.41]:44854) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <raaahh@HIDDEN>) id 1mSMij-0005Ck-AH for 49836 <at> debbugs.gnu.org; Mon, 20 Sep 2021 13:04:45 -0400 Received: by mail-wr1-f41.google.com with SMTP id d6so31523334wrc.11 for <49836 <at> debbugs.gnu.org>; Mon, 20 Sep 2021 10:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=QY1GcnlvsyXty9spg/qRoqqcJ08WZjlDTfaazzI9yNM=; b=a6ecgzZtLThEf8JZf0ROAgHHFmBYxnUBuY5PRAAjdQdbKn9r97BdSE2MpLPslTqr+G E3lBKNslMf/i+TxyTQJxZhJQh5dUmv2GnOPomGQUPnWNC5sIOEElpXZe7IfmlyPTruPC AayNOGuIeNADhzn9f/RQQOuTkovo2AT42wTTIffGJuDKG2Oxf1YUshpF4DxSxaPl8oAR P/+off1bt49gJ3QVIhRfhOeMQSxVSt22IE2fYUbijVFk+6zN9qAEm1Y7Fv5lMPtY8Yxu mw4BHBRJCdW/6Bef9ok2N5k3CYt279qcJpXOVBvsJG25gl0X0qdq9pkeHTP7vyFcvSqp NqHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=QY1GcnlvsyXty9spg/qRoqqcJ08WZjlDTfaazzI9yNM=; b=mt0en/44RYr6d4gbzfT1/PNnFYJ2MbYQ4HveF2NZjEVB/KVkgY47SI2Yd8E+3x/kTU S2lbDz/TGsAyJinhxQIJfJGvS9UnrdULbPPWrEyNkacmQQj6VmVQAXJktjZNSMxs2AM6 Rh0/vKXYYbR3Y8smqGdU6iY53WV89x7Y6LWjyxFQUgvkFcDcpF6Az/ZnbwsPlCvIVCVx 8yMft5HVvwTgzeNJ6Xk/ZbzcHBpF1MkyhZlCHDAFLZnWeJapK2GMSEhopPlDSw241jNr yktKSc+WsF4zIGU4lvWbSoOerN4PpyNxmtRRGbbqwUn36FS8RL2n2geoy7aToQmHImhI cI5Q== X-Gm-Message-State: AOAM531ddI3d7XPHuZVmfDFCDf1Mnj7vebVWu6LIKS5t25vsxWtWDyAV hhkLyJQea+pxy4K91jJtV0g= X-Google-Smtp-Source: ABdhPJxm2kspz579PYhOwb6UmpTL/6X2KgB3z3cS6VN4eK/s79KQerMNOy1J2RWTzVl5IUQ0dqM1Hg== X-Received: by 2002:a1c:f713:: with SMTP id v19mr68758wmh.188.1632157479299; Mon, 20 Sep 2021 10:04:39 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id i67sm77375wmi.41.2021.09.20.10.04.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Sep 2021 10:04:38 -0700 (PDT) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep To: Jim Porter <jporterbugs@HIDDEN>, =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= <mattiase@HIDDEN> References: <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> <e2d1f857-24c1-2158-f42a-772585e070be@HIDDEN> <702a8028-3c6e-1d32-3a35-0b208fa356a4@HIDDEN> <CDA3DB95-8C96-435E-89D8-9E8D61779FD7@HIDDEN> <e09a124a-3be1-4a1a-2bbb-db0461e1ad0b@HIDDEN> <4dfd4633-e1dc-c573-c481-8fbba25270e4@HIDDEN> From: Dmitry Gutov <dgutov@HIDDEN> Message-ID: <96b5e4e9-d94d-e8e0-c79b-4d381707654a@HIDDEN> Date: Mon, 20 Sep 2021 20:04:35 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <4dfd4633-e1dc-c573-c481-8fbba25270e4@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 49836 Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 49836 <at> debbugs.gnu.org, Juri Linkov <juri@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: -0.6 (/) On 20.09.2021 08:09, Jim Porter wrote: > On 9/19/2021 5:14 PM, Dmitry Gutov wrote: >> On 19.09.2021 13:11, Mattias Engdegård wrote: >>> even if the goals are slightly different >> >> Are the goals different? > > I think in the long run, the goals are very much the same. But in the > short run, my goal with urgrep was just to make something that would > work like `rgrep', but support multiple tools. There are already a > multitude of Emacs packages that provide `rgrep'-like functionality for > a particular tool, but I wanted something that worked (almost) the same > no matter what happens to be installed on the system. > >> I'm not sure it's flexible enough to be used in both >> xref-matches-in-files and semantic/symref (yet?), but when I tried to >> imagine a package that would, it looked fairly similar. > > If there are any (useful) commands that can't be generated with > `urgrep-command', but which most grep-like tools support, I definitely > want to add that capability. The current set of options is really just > what I use semi-regularly, so there's bound to be stuff I missed, > especially regarding semantic/symref. semantic/symref/grep is not too complicated in that regard: the command looks like, for example find -H ~/vc/emacs-master -type f \( -name \*..\*emacs -o -name \*.ede -o -name \*.el \) -exec grep -nw -nH --null -e mhtml-mode \{\} + xref's use is slightly different, but ultimately simpler: it assumes files are piped from stdin. So it's either xargs -0 rg -i -nH --no-messages -g '!*/' -e xref-search-program or xargs -0 grep -i -snHE -e <R> And the xargs prefix can be just added on outside of your package. > That said, I don't want to slow things down too much in this bug. Maybe > for Emacs 29 though, it would make sense to put (parts of?) urgrep into > Emacs, since a unified solution would probably be helpful. I'll try to > find some time to post a message to emacs-devel to discuss this and get > some feedback. Sure. Thank you.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 20 Sep 2021 05:09:14 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 20 01:09:14 2021 Received: from localhost ([127.0.0.1]:40516 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mSBYI-00079c-9T for submit <at> debbugs.gnu.org; Mon, 20 Sep 2021 01:09:14 -0400 Received: from mail-pl1-f176.google.com ([209.85.214.176]:46075) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <jporterbugs@HIDDEN>) id 1mSBYC-00079H-I5 for 49836 <at> debbugs.gnu.org; Mon, 20 Sep 2021 01:09:12 -0400 Received: by mail-pl1-f176.google.com with SMTP id n2so7637180plk.12 for <49836 <at> debbugs.gnu.org>; Sun, 19 Sep 2021 22:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=1OGJezQT4/+pHlzVI/gFnMn4cjq83YPXW3fJoyIgpcg=; b=Vct1AY5lcIJp5rDd2hho7ILEmC6+5IyKOuSPV7RnPhaJUS4pIystDToj+Bn+Qg7WhE 6wpRPUpZg3mvak967AFePkCRQyx2X2GY6nsLE9MH5xbAMtmAdIeMfrHQnMumBDmBWd98 bu87QOL+bmZ/xxX1MovcRBh1+kr6wFXPQ7koc2gjvAx4QTasyHkbKBYvPI6oH0uoBIdv odITI+tsUfKmk0Ei91uJMlhxk7wvOi6o40BJHu0aUcFtUADPdZzBh7oXtQdn5rmtrQbQ tv4huo0KZeqPiGBquE6tdujuBrx9zXUKxFQwbkD1NI48TdCV6ZuQix+v4jQjQZ+gP5DK AutQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1OGJezQT4/+pHlzVI/gFnMn4cjq83YPXW3fJoyIgpcg=; b=mbbKIIqQKJaKBU8g5BBTVq6kKfjiLWlygNbpv4ryOksDcMxyrIy6j4pQvswEwOOKrO dQQay1NlZ9Lhg3z9EmvFpB7AcGL/bskpjmvjMUa8LCtz1OktxniVX+Gp0nFG0+CiINa8 YN4lFMHiuXqXxHm3QYMB1/zwzcOCd2igSu35i4nOqM37x6HxOIyvZgnOmMJBPWUKAdVu TqJtk2fWw+nLEOg/yMTV4OK77oZXM+e2jM+far54LMRvSxah/JPEu8/4vV9St3nInitJ EPsW0ASdK3rUIqRM9IMTpj8EZ9oFAkQSdH0Or1VF1UHohoarqCLVhyyyJqVMhRCHeFPa Oo6w== X-Gm-Message-State: AOAM533a6GQKWT5W+ZDCK0ttJop99rdk4T0jBU5UAOxCntXIcZVQTY+i nX5vh4l57KD1Alro+OA8x8U= X-Google-Smtp-Source: ABdhPJw9pAVOiUUyWQcNE8D14/79rWPZ54iDM6tc4EuE7OSLDbX8uGAUXh+jiuX1htnvRQ2t1ClH4A== X-Received: by 2002:a17:902:8bc4:b029:12b:8470:e29e with SMTP id r4-20020a1709028bc4b029012b8470e29emr21242015plo.2.1632114542698; Sun, 19 Sep 2021 22:09:02 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id k3sm16618883pjg.43.2021.09.19.22.09.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Sep 2021 22:09:02 -0700 (PDT) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep To: Dmitry Gutov <dgutov@HIDDEN>, =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= <mattiase@HIDDEN> References: <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> <e2d1f857-24c1-2158-f42a-772585e070be@HIDDEN> <702a8028-3c6e-1d32-3a35-0b208fa356a4@HIDDEN> <CDA3DB95-8C96-435E-89D8-9E8D61779FD7@HIDDEN> <e09a124a-3be1-4a1a-2bbb-db0461e1ad0b@HIDDEN> From: Jim Porter <jporterbugs@HIDDEN> Message-ID: <4dfd4633-e1dc-c573-c481-8fbba25270e4@HIDDEN> Date: Sun, 19 Sep 2021 22:09:01 -0700 MIME-Version: 1.0 In-Reply-To: <e09a124a-3be1-4a1a-2bbb-db0461e1ad0b@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 49836 Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 49836 <at> debbugs.gnu.org, Juri Linkov <juri@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.0 (-) On 9/19/2021 5:14 PM, Dmitry Gutov wrote: > On 19.09.2021 13:11, Mattias Engdegård wrote: >> even if the goals are slightly different > > Are the goals different? I think in the long run, the goals are very much the same. But in the short run, my goal with urgrep was just to make something that would work like `rgrep', but support multiple tools. There are already a multitude of Emacs packages that provide `rgrep'-like functionality for a particular tool, but I wanted something that worked (almost) the same no matter what happens to be installed on the system. > I'm not sure it's flexible enough to be used in both > xref-matches-in-files and semantic/symref (yet?), but when I tried to > imagine a package that would, it looked fairly similar. If there are any (useful) commands that can't be generated with `urgrep-command', but which most grep-like tools support, I definitely want to add that capability. The current set of options is really just what I use semi-regularly, so there's bound to be stuff I missed, especially regarding semantic/symref. That said, I don't want to slow things down too much in this bug. Maybe for Emacs 29 though, it would make sense to put (parts of?) urgrep into Emacs, since a unified solution would probably be helpful. I'll try to find some time to post a message to emacs-devel to discuss this and get some feedback.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 20 Sep 2021 00:14:46 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 19 20:14:46 2021 Received: from localhost ([127.0.0.1]:40308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mS6xJ-00068b-R2 for submit <at> debbugs.gnu.org; Sun, 19 Sep 2021 20:14:46 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:34580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <raaahh@HIDDEN>) id 1mS6xH-00068L-R4 for 49836 <at> debbugs.gnu.org; Sun, 19 Sep 2021 20:14:44 -0400 Received: by mail-wr1-f42.google.com with SMTP id t8so18620888wri.1 for <49836 <at> debbugs.gnu.org>; Sun, 19 Sep 2021 17:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=nX6lwuvPcgufd/3i+gJXP5xoxD9SC5rBdDy8VJ9m77s=; b=bnlqAqVilT4EFg/V61GmEtFuE318eMCDWA98b4T8/rhPaO2DS9a0utRtF/uIEz6tbD 2LD5Y1LOUYJdjODfBw8W61kepUKyxYNYoGaC5ZSj5imytF75zVI1BBLSBIzVAmJn/qFq Z9nrXexflTdQtmWXTOgxLXm+lv+Pw8LDdu/kzPyyfKaYA5DQTQhfXTDETx+ZbqsHysv+ R1Skw45LeODycLLve14vrwy64r1UOj8mtgqOjSvI5te7G29Gym5ywE8EpnPRh837YYSy AqIk14Jxzg8u5qDz5yr7iB8bqMY17hRIoCGeMMFoMh5pXXBXdQ9sy4aD0reU+ITT6vEd t8Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nX6lwuvPcgufd/3i+gJXP5xoxD9SC5rBdDy8VJ9m77s=; b=VlyP2sc5jPzIHkmEY9M9HYWFHGX5JBRUgc1tBar69NvVnYJ+7ZmXnU2TDIni8CwfuO N3/6n6ngQaiSTFhbO8wg7P9kIuncxtgM0ieDcEBL5aevr+7TNU3jCi6SsGk0Y/QarFxN eJ5UV8MY9LOc4kGQemGIAp3fNGuspDa86OC/vZC/aQ6Hc9lzXXoFVYD6GMKVa0wHN974 ebGq7ZisACusFEVUJheNWz6mxGH79U7RAK+AWf9puNGDJjKxpvFErSgVcf2UhO0A+8C9 fFNuFG8n+ze03jMU87x+tt8FNIm9j1cDs4Wm/287kPd+e2xESIySiJ7gyyb+IwJ3uSp7 /ppw== X-Gm-Message-State: AOAM532NmFPxRCdEVxpo8iJmvmuNkbDs9vyTqVtvL7vIrNwVPnxBlzsj 2XVqADPOoT35Y9oGfb13zJ+Wcq/kkWA= X-Google-Smtp-Source: ABdhPJzNiWCfAawDYxaCOu0M1I9GrqIIhU9n+doL3+dVHXibV7tHtldnL07oU1hj2NQD0w3GcAN5Rw== X-Received: by 2002:adf:ec0d:: with SMTP id x13mr25307791wrn.38.1632096877830; Sun, 19 Sep 2021 17:14:37 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id o17sm14061404wrj.96.2021.09.19.17.14.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Sep 2021 17:14:37 -0700 (PDT) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep To: =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= <mattiase@HIDDEN>, Jim Porter <jporterbugs@HIDDEN> References: <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> <e2d1f857-24c1-2158-f42a-772585e070be@HIDDEN> <702a8028-3c6e-1d32-3a35-0b208fa356a4@HIDDEN> <CDA3DB95-8C96-435E-89D8-9E8D61779FD7@HIDDEN> From: Dmitry Gutov <dgutov@HIDDEN> Message-ID: <e09a124a-3be1-4a1a-2bbb-db0461e1ad0b@HIDDEN> Date: Mon, 20 Sep 2021 03:14:34 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <CDA3DB95-8C96-435E-89D8-9E8D61779FD7@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 49836 Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 49836 <at> debbugs.gnu.org, Juri Linkov <juri@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: -0.6 (/) On 19.09.2021 13:11, Mattias Engdegård wrote: > even if the goals are slightly different Are the goals different? It seems like a good direction: search program specified as a symbol, and the package knows how to generate search queries based on given requirements (with a certain space). I'm not sure it's flexible enough to be used in both xref-matches-in-files and semantic/symref (yet?), but when I tried to imagine a package that would, it looked fairly similar.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 19 Sep 2021 10:12:04 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 19 06:12:04 2021 Received: from localhost ([127.0.0.1]:37508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mRtno-00009n-Il for submit <at> debbugs.gnu.org; Sun, 19 Sep 2021 06:12:04 -0400 Received: from mail212c50.megamailservers.eu ([91.136.10.222]:34506 helo=mail194c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mattiase@HIDDEN>) id 1mRtnl-00009E-0k for 49836 <at> debbugs.gnu.org; Sun, 19 Sep 2021 06:12:03 -0400 X-Authenticated-User: mattiase@HIDDEN DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1632046313; bh=SnOITGbv4vpc/RXMs79GLNwI11UHjIm6gw3+06l6Lec=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=gmRsSKQeTdd35MnMY5TUVLqSZROzYhhObVUA5aChsILdDUtf6Sg+8TT4d3BvItN5O k2guvSc2U7APIWWmo8Cwu1lRxWxB9ifb6X3kJB/A+V7CofUVrbCk3Db4/SHDxgXG2b jPT5Z87gbkRuP7h4l34Iq3PI4N/9tLynOBRC1s7w= Feedback-ID: mattiase@HIDDEN Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 18JABpZK030659; Sun, 19 Sep 2021 10:11:52 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN> In-Reply-To: <702a8028-3c6e-1d32-3a35-0b208fa356a4@HIDDEN> Date: Sun, 19 Sep 2021 12:11:50 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <CDA3DB95-8C96-435E-89D8-9E8D61779FD7@HIDDEN> References: <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> <e2d1f857-24c1-2158-f42a-772585e070be@HIDDEN> <702a8028-3c6e-1d32-3a35-0b208fa356a4@HIDDEN> To: Jim Porter <jporterbugs@HIDDEN> X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F24.61470CE9.0032, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.4 cv=H7G4f8Ui c=1 sm=1 tr=0 ts=61470ce9 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=pGLkceISAAAA:8 a=d06W9mnQAAAA:20 a=Bls6BTBKeBW0jv0Em70A:9 a=CjuIK1q_8ugA:10 a=SOEuhfntw5QA:10 a=VlZU0XKO32wA:10 a=tpfv8eD9n78A:10 X-Origin-Country: SE X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 49836 Cc: 49836 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi@HIDDEN>, Juri Linkov <juri@HIDDEN>, 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: -0.0 (/) 19 sep. 2021 kl. 02.21 skrev Jim Porter <jporterbugs@HIDDEN>: > [1] https://github.com/jimporter/urgrep Thank you -- many fine ideas here and I'll be sure to steal at least = something, even if the goals are slightly different.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 19 Sep 2021 00:21:17 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 18 20:21:17 2021 Received: from localhost ([127.0.0.1]:37177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mRka5-0001y1-5B for submit <at> debbugs.gnu.org; Sat, 18 Sep 2021 20:21:17 -0400 Received: from mail-pg1-f170.google.com ([209.85.215.170]:37885) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <jporterbugs@HIDDEN>) id 1mRka3-0001xp-PR for 49836 <at> debbugs.gnu.org; Sat, 18 Sep 2021 20:21:16 -0400 Received: by mail-pg1-f170.google.com with SMTP id 17so13591915pgp.4 for <49836 <at> debbugs.gnu.org>; Sat, 18 Sep 2021 17:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=jQrW8HatLc6P4aPOnv6dKfSjBqsKjyIwUwpi3ckT3HE=; b=TjedPwlx9NmxyXbxpUJtjwVlo70ySYtbVtOmRu4d4a08l8cJ9BPrDpIz2TdBvLODzH yidHAfgyrO0SXuN21e6CwsMhw/bY4jF3K4j7YkqtOmWhY0aO92SPAP65IeQlyVv8tPMf 3w/W6JOKPqd3gPbZJZqGwA652QrgFSsVMUdij34+ttJvfToVydyhP+xaIKvKfpD7zcxQ PxNHxJVfrvqqHv7tashBCrhPZ8IvqkCJc8nEHQ5m0zDzucA2mAjKsjOh0t0rigbXK6u0 PhB92YINeW+hsbKqagZ/wldO53e12QLNItcTM6mJaD8TbwYUtQVtAE1TNtBFpIxcFD85 AnlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=jQrW8HatLc6P4aPOnv6dKfSjBqsKjyIwUwpi3ckT3HE=; b=uArSupbkQlXmgUeeno/TwJkRq1zhagvXM+xYJIrvkbmwcxrAYquKMXM+3ppUkvt3Su 3k2MqeGx1m5J26Gr99mb+Zn8J+sXCx/Pun/yb2UqTT4CNrw6AnnGWPXiBQOKPGCiXzVi Y0SvLbFGir+7Ox5pKqQlk8QAlXDaPOHnLBjm3hXD9sRY7zwixTN74Kz8AywjwABK+7xE F/jZ2C+e1prU9M45MreXeJCVH7cUilRlK8qxkUC1JIGXwX9fzLZwtHEknjKMT9/yItlZ /ZqbdCQCM6a6T3WK6A/pSwm9Te0F/hMID7ujk/71yhizX+oJ5eD8GqZcAyW/CF45WxT7 G/Eg== X-Gm-Message-State: AOAM531ydOxCQuy0JV3StBp4Jg3G6L9Fdgx8q/E0xMDJGiyzffEkqm0j tm7YgRgEzFk/XvoxUDUgU/fdkfX5yW8= X-Google-Smtp-Source: ABdhPJwhEfmpfth5Z639jcK2HZP8Ixpp5yfSDmkrCjlQkvzPZwkusEIiHTDupjWqwzck1GS5teMC2w== X-Received: by 2002:a62:4dc5:0:b0:438:8133:fcef with SMTP id a188-20020a624dc5000000b004388133fcefmr18072997pfb.44.1632010869939; Sat, 18 Sep 2021 17:21:09 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id t13sm14202973pjj.1.2021.09.18.17.21.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 18 Sep 2021 17:21:09 -0700 (PDT) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep To: Dmitry Gutov <dgutov@HIDDEN>, =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= <mattiase@HIDDEN>, Juri Linkov <juri@HIDDEN> References: <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> <e2d1f857-24c1-2158-f42a-772585e070be@HIDDEN> From: Jim Porter <jporterbugs@HIDDEN> Message-ID: <702a8028-3c6e-1d32-3a35-0b208fa356a4@HIDDEN> Date: Sat, 18 Sep 2021 17:21:09 -0700 MIME-Version: 1.0 In-Reply-To: <e2d1f857-24c1-2158-f42a-772585e070be@HIDDEN> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 49836 Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 49836 <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.0 (-) On 9/18/2021 4:53 PM, Dmitry Gutov wrote: > Perhaps we should split off the auto-detection feature and consider the > patch without it first. If people don't mind adding yet another > grep-or-ripgrep custom variable, this can be a reasonable change. > > After landing that we could discuss the auto-detection approach, on > local and remote machines, and whether we could manage to do it only > once per host. I've done something along these lines for `urgrep'[1], a package to provide something like `M-x rgrep' that works across the seemingly ever-growing list of grep-like tools out there. I'm still working on improving the documentation before I think about putting it on ELPA, but maybe there are some bits in there that would be useful here. I'd be happy to coordinate on this if there's interest. [1] https://github.com/jimporter/urgrep
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 18 Sep 2021 23:53:26 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 18 19:53:26 2021 Received: from localhost ([127.0.0.1]:37161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mRk97-0001Jz-QB for submit <at> debbugs.gnu.org; Sat, 18 Sep 2021 19:53:26 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:41482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <raaahh@HIDDEN>) id 1mRk92-0001Jh-5e for 49836 <at> debbugs.gnu.org; Sat, 18 Sep 2021 19:53:23 -0400 Received: by mail-wr1-f47.google.com with SMTP id w29so21620680wra.8 for <49836 <at> debbugs.gnu.org>; Sat, 18 Sep 2021 16:53:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=W7lydbnKokUjvrha4nEJdHAVyGaHjEy4O26gDQAO7jU=; b=anQMJv7RAOWd8GYqS+3OkCNplSu7SL1COAdepC9EC5jvjjSfVJwALuV4wIYJoC4noj Ph4QcmcUKaj86x2hZxBN15bkd7/wTC/NTzyAAZ3/Y6Pk3NpgTHUp6dJUku47Zyy59Rub aR/VoY+a9Uz7Czdqln2LPHon3Pr4sJo81AsCpl750thnWsQBbdqAr1PCO+TPT+QGUPNj vjp6gRVXnZ5+8rrgTIQG1efj1IFKdBc6ZmO+LL3Nyznci6t/c+IXY1ir2mgOTdArOYXY cY2gPdbQ4JexjuYa9lngIw9YrMN7D1kJ0yReDANbsk3TS2X+dRMCVUMHjQfudmampGWq YgoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=W7lydbnKokUjvrha4nEJdHAVyGaHjEy4O26gDQAO7jU=; b=ZenLLMk4rn6J/GvPSlM5A+0eE7BKhg1f3PJ39aJFnZeFKyYtYbV/BNWr4VKQme7+SW t0VkpgqouVRutS8YbDaKgjisjuM+73LfFCIAPhYjqN4u4Rc3sx0XP4qM2uX229ogjgXW taBbQgYtPKgXV6MjnCIojFjm/nCQhqUbrNFERz2LepiI5oPGmFs1Yqr+yBoIqn6evAac p+hQE5YB9VKL76sr4xSLwMV1MytMXeOCp48nLf/QK81jJBtKtjV919UhqnByxGEbpAXZ 0sbcH2aj64nLaQC9obSooJ6TQKj0i+fW99IT1IrXXzXD6OYJ1y2hFedXzXeGZ0TVLAto Qg+w== X-Gm-Message-State: AOAM532ttD3rnY3v1ayM7i2FJc6dPtAGmW6YCqHcLg1RgRq6HkcPqIHJ k4BTqH6BdkdCg1/SWWO30O8= X-Google-Smtp-Source: ABdhPJzlQjG+VJV0NNT2csnSZVkl0MF9C4+RHu3LSIIvObNyBzQX/p9kCagusDNehOzGmB/6szf4nw== X-Received: by 2002:adf:fcca:: with SMTP id f10mr20216933wrs.304.1632009194301; Sat, 18 Sep 2021 16:53:14 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id p1sm10527119wmi.30.2021.09.18.16.53.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 18 Sep 2021 16:53:13 -0700 (PDT) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep To: =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= <mattiase@HIDDEN>, Juri Linkov <juri@HIDDEN> References: <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> From: Dmitry Gutov <dgutov@HIDDEN> Message-ID: <e2d1f857-24c1-2158-f42a-772585e070be@HIDDEN> Date: Sun, 19 Sep 2021 02:53:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 49836 Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 49836 <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.6 (/) On 18.09.2021 16:53, Mattias Engdegård wrote: > Attached is a straw-man patch that is not production-quality but illustrates some of the concepts I'd like to see: > > * ripgrep supported for M-? > * ripgrep auto-detected and used by default if available > * treat ripgrep as a search method of its own and not just a different grep program > * corollary: selection of search method should be made symbolically and not by supplying shell command strings Perhaps we should split off the auto-detection feature and consider the patch without it first. If people don't mind adding yet another grep-or-ripgrep custom variable, this can be a reasonable change. After landing that we could discuss the auto-detection approach, on local and remote machines, and whether we could manage to do it only once per host.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 18 Sep 2021 21:48:37 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 18 17:48:37 2021 Received: from localhost ([127.0.0.1]:37126 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mRiCL-0004iq-Fg for submit <at> debbugs.gnu.org; Sat, 18 Sep 2021 17:48:37 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]:36729) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <raaahh@HIDDEN>) id 1mRiCH-0004ib-D6 for 49836 <at> debbugs.gnu.org; Sat, 18 Sep 2021 17:48:35 -0400 Received: by mail-wm1-f47.google.com with SMTP id l18-20020a05600c4f1200b002f8cf606262so12657511wmq.1 for <49836 <at> debbugs.gnu.org>; Sat, 18 Sep 2021 14:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=78JWsHj7+NEk6LmydhE/JA5IEIS0131gIv/m3HcLQxg=; b=lUa8UzA1Fkgv+NaSYOw4cxits68OQDlApc+BPAJ74cbOlwFjG3NDBuk/I/M/RWtje3 7rh6ttA8l9J5mMCOgGH4f6/1S+rrpvVoP/OwLsnp/esfIGpZiFyuVCw4lMHRDHEVIHEx PxSJsKazw/K1HybcJx8DTC8WBNw3FNpLt+GvsnqRCoyI12gzKd/DlXro6MJgBjK4mrQl qKc0Nz0kUaKOAZRcp8INC9RM4MeOiuHwv+HXgMAFmC6CwoAkj41H/9CKd80n90+YcllH PIlOJI+OmTwtmUAVU1vOlCNdaKS6O/I4yyP6qroWlujeX+Efn4SIfLwmZHVP8sTC/cfi eHTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=78JWsHj7+NEk6LmydhE/JA5IEIS0131gIv/m3HcLQxg=; b=Gl7vR1EtgMuG7kywLRoiRqtMd761yTJm3b73lq/jlm/CBRZILHVouksyx2nvlKY0Xh 6j/0llQ2st3XQbMAqsprFqnVk1zMKEAF61Dtz2vRL48l4KNrqxvdc8e4MrRykr56cLGR SimCSBUWYXttDrU7JuhR5aIvfay6/y798nYEqR+SCTY/fMDn2c9LymgewhPVqdVJUJwm kyY0cMfcyZE6SpN2tF+guFQ61cs6zm2YDvHThv9swrHqS52pX2SoEmn2J5AMtdXu+EcS wQ6qy836ElaUBMl3mm5ovBd2iYifU02JcMZNEefaGNEmVtSZ8FGBdeCcryj/laxAjnnj 3nsQ== X-Gm-Message-State: AOAM533pIz8laen4jc+lUz68SuNGiQY+KeBmHnHmvVJKZKNmmrOY9957 okywGSsRKKVfw8QM8U38+Otpr4gJHmc= X-Google-Smtp-Source: ABdhPJyKK64blh3xnDNTh8tat+l9AlCgXo52vBXLnlCIMBhiprvb1UacagcbBYERaSy74loDgl3XGQ== X-Received: by 2002:a7b:c7c6:: with SMTP id z6mr1031929wmk.34.1632001707445; Sat, 18 Sep 2021 14:48:27 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id e2sm10917716wra.40.2021.09.18.14.48.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 18 Sep 2021 14:48:26 -0700 (PDT) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep To: =?UTF-8?Q?Mattias_Engdeg=c3=a5rd?= <mattiase@HIDDEN>, Eli Zaretskii <eliz@HIDDEN> References: <87sfzrbke1.fsf_-_@HIDDEN> <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> <83o88q55u2.fsf@HIDDEN> <30E69411-791E-485B-AFFF-61E7965C6238@HIDDEN> From: Dmitry Gutov <dgutov@HIDDEN> Message-ID: <b36e5285-fa32-4482-a1a8-a2c4872c9c7b@HIDDEN> Date: Sun, 19 Sep 2021 00:48:24 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <30E69411-791E-485B-AFFF-61E7965C6238@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 49836 Cc: larsi@HIDDEN, 49836 <at> debbugs.gnu.org, juri@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: -0.6 (/) On 18.09.2021 17:18, Mattias Engdegård wrote: > 18 sep. 2021 kl. 16.14 skrev Eli Zaretskii<eliz@HIDDEN>: > >>> If the actual command (ripgrep or something else) takes zero seconds, what if anything prevents a crisp snappy response from Emacs? >> The sub-process communications infrastructure, of course. > Yes, very likely, but also post-processing the output from the search process (matching, sorting, etc) and preparing it for display. It would be interesting to see a break-down and to see what if anything can be down to make to go faster. > Before you dig in with OS-level debugger, here are things to try to narrow down the problems: - Do the search for a common term (many matches). - Do the search for a rare term (with 1-2 matches). See how the inside/outside timings compare. I'm guessing the latter case should be snappy, with a relatively small ratio. Whatever overhead Emacs has, will probably be on the sub-process infrastructure. To investigate the former case (many matches), I suggest starting with 'benchmark-progn'. Wrapping the 'process-file' call will measure the shell invocation and getting the output into the buffer. diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index 53745b429a..7db5e79c91 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el @@ -163,8 +163,9 @@ semantic-symref-perform-search (let ((cmd (semantic-symref-grep-use-template (directory-file-name (file-local-name rootdir)) filepattern grepflags greppat))) - (process-file semantic-symref-grep-shell nil b nil - shell-command-switch cmd))) + (benchmark-progn + (process-file semantic-symref-grep-shell nil b nil + shell-command-switch cmd)))) (setq ans (semantic-symref-parse-tool-output tool b)) ;; Return the answer ans)) Measuring the subsequent semantic-symref-parse-tool-output call can also show something, but it's usually fast. Wrapping the xref--convert-hits call alone inside xref-references-in-directory should be more interesting: its work is less trivial. I don't know how much further it can be optimized, but help is welcome, of course. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 69cabd0b5a..ab0476b2bb 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1548,9 +1548,11 @@ xref-references-in-directory (inst (semantic-symref-instantiate :searchfor symbol :searchtype 'symbol :searchscope 'subdirs - :resulttype 'line-and-text))) - (xref--convert-hits (semantic-symref-perform-search inst) - (format "\\_<%s\\_>" (regexp-quote symbol))))) + :resulttype 'line-and-text)) + (search-hits (semantic-symref-perform-search inst))) + (benchmark-progn + (xref--convert-hits search-hits + (format "\\_<%s\\_>" (regexp-quote symbol)))))) (define-obsolete-function-alias 'xref-collect-references
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 18 Sep 2021 18:45:56 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 18 14:45:56 2021 Received: from localhost ([127.0.0.1]:36861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mRfLX-00024X-HI for submit <at> debbugs.gnu.org; Sat, 18 Sep 2021 14:45:56 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:41641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1mRfLQ-00023t-5p for 49836 <at> debbugs.gnu.org; Sat, 18 Sep 2021 14:45:54 -0400 Received: (Authenticated sender: juri@HIDDEN) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id A8FAEC0004; Sat, 18 Sep 2021 18:45:40 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: Lars Ingebrigtsen <larsi@HIDDEN> Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep Organization: LINKOV.NET References: <83h7elbzo3.fsf@HIDDEN> <7b0409e3-fc88-b34e-9365-25356bb85859@HIDDEN> <83bl4tbxyu.fsf@HIDDEN> <12215e07-af4e-2db7-1869-16ac92feb806@HIDDEN> <8335q5bt9b.fsf@HIDDEN> <ee8b7d7f-abd1-42fc-a273-819ccef3c4e7@HIDDEN> <874kaj5o77.fsf_-_@HIDDEN> <87fsu3uq54.fsf@HIDDEN> Date: Sat, 18 Sep 2021 21:37:53 +0300 In-Reply-To: <87fsu3uq54.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Fri, 17 Sep 2021 18:24:07 +0200") Message-ID: <87y27toi36.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 49836 Cc: 49836 <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 (-) >> What remains to do here is to support Ripgrep officially. > > What would that entail? Just documenting it? Mattias is adding support for ripgrep to xref and symref/grep.el in https://debbugs.gnu.org/49836#34 and I sent the first version of ripgrep support for progmodes/grep.el in https://debbugs.gnu.org/49836#8
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 18 Sep 2021 14:25:35 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 18 10:25:35 2021 Received: from localhost ([127.0.0.1]:36390 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mRbHX-0005cl-FQ for submit <at> debbugs.gnu.org; Sat, 18 Sep 2021 10:25:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35552) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1mRbHU-0005cX-Fq for 49836 <at> debbugs.gnu.org; Sat, 18 Sep 2021 10:25:30 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54010) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1mRbHO-0003wN-CV; Sat, 18 Sep 2021 10:25:22 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3195 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1mRbHJ-0002ta-Kn; Sat, 18 Sep 2021 10:25:18 -0400 Date: Sat, 18 Sep 2021 17:25:06 +0300 Message-Id: <83ilyy55bx.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN> In-Reply-To: <30E69411-791E-485B-AFFF-61E7965C6238@HIDDEN> (message from Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sat, 18 Sep 2021 16:18:54 +0200) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep References: <87sfzrbke1.fsf_-_@HIDDEN> <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> <83o88q55u2.fsf@HIDDEN> <30E69411-791E-485B-AFFF-61E7965C6238@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49836 Cc: larsi@HIDDEN, 49836 <at> debbugs.gnu.org, dgutov@HIDDEN, juri@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.0 (-) > From: Mattias Engdegård <mattiase@HIDDEN> > Date: Sat, 18 Sep 2021 16:18:54 +0200 > Cc: juri@HIDDEN, larsi@HIDDEN, 49836 <at> debbugs.gnu.org, dgutov@HIDDEN > > > The sub-process communications infrastructure, of course. > > Yes, very likely, but also post-processing the output from the search process (matching, sorting, etc) and preparing it for display. It would be interesting to see a break-down and to see what if anything can be down to make to go faster. You could build Emacs with profiling and run that, I guess. And on GNU/Linux, there's Perf.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 18 Sep 2021 14:19:08 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 18 10:19:08 2021 Received: from localhost ([127.0.0.1]:36378 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mRbBM-0005Rv-AU for submit <at> debbugs.gnu.org; Sat, 18 Sep 2021 10:19:08 -0400 Received: from mail1456c50.megamailservers.eu ([91.136.14.56]:35898 helo=mail266c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mattiase@HIDDEN>) id 1mRbBI-0005RM-Oa for 49836 <at> debbugs.gnu.org; Sat, 18 Sep 2021 10:19:06 -0400 X-Authenticated-User: mattiase@HIDDEN DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1631974737; bh=xaFAzAwmaK0IyUqS5v8yj65uPZLdYPlU5OVI7vmoT7w=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=LVJmWZrLpM3xlS2UMf/wYlEmwMslvObiilPKtIUhuJF3bKdbnYE2OUQk5ExBkq84L PX2nvitDTcnvN411YWIjzmzpnGoZW83zJjuWn5a1fUQAsNpcftD85fog/vtPOIvQAF nj1l75Bj15CfGworQ6lahMA7OIVx7viIpOr661bI= Feedback-ID: mattiase@HIDDEN Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail266c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 18IEIsid020392; Sat, 18 Sep 2021 14:18:56 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN> In-Reply-To: <83o88q55u2.fsf@HIDDEN> Date: Sat, 18 Sep 2021 16:18:54 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <30E69411-791E-485B-AFFF-61E7965C6238@HIDDEN> References: <87sfzrbke1.fsf_-_@HIDDEN> <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> <83o88q55u2.fsf@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F1B.6145F551.001C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.4 cv=Wexv12tX c=1 sm=1 tr=0 ts=6145f551 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=mDV3o1hIAAAA:8 a=Cv8Yl7LRiS9p-YjJNhYA:9 a=CjuIK1q_8ugA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-Origin-Country: SE X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 18 sep. 2021 kl. 16.14 skrev Eli Zaretskii <eliz@HIDDEN>: >> If the actual command (ripgrep or something else) takes zero seconds, what if anything prevents a crisp snappy response from Emacs? > > The sub-process communications infrastructure, of course. Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 49836 Cc: larsi@HIDDEN, 49836 <at> debbugs.gnu.org, dgutov@HIDDEN, juri@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: -0.0 (/) 18 sep. 2021 kl. 16.14 skrev Eli Zaretskii <eliz@HIDDEN>: >> If the actual command (ripgrep or something else) takes zero seconds, = what if anything prevents a crisp snappy response from Emacs? >=20 > The sub-process communications infrastructure, of course. Yes, very likely, but also post-processing the output from the search = process (matching, sorting, etc) and preparing it for display. It would = be interesting to see a break-down and to see what if anything can be = down to make to go faster.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 18 Sep 2021 14:14:38 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 18 10:14:38 2021 Received: from localhost ([127.0.0.1]:36364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mRb70-00039y-GD for submit <at> debbugs.gnu.org; Sat, 18 Sep 2021 10:14:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33860) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1mRb6x-00039k-4I for 49836 <at> debbugs.gnu.org; Sat, 18 Sep 2021 10:14:36 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:53154) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1mRb6q-0002i4-VJ; Sat, 18 Sep 2021 10:14:28 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2515 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1mRb6q-0001oU-Ha; Sat, 18 Sep 2021 10:14:28 -0400 Date: Sat, 18 Sep 2021 17:14:13 +0300 Message-Id: <83o88q55u2.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattiase@HIDDEN> In-Reply-To: <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> (message from Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sat, 18 Sep 2021 15:53:51 +0200) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep References: <87sfzrbke1.fsf_-_@HIDDEN> <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49836 Cc: larsi@HIDDEN, 49836 <at> debbugs.gnu.org, dgutov@HIDDEN, juri@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 (---) > From: Mattias Engdegård <mattiase@HIDDEN> > Date: Sat, 18 Sep 2021 15:53:51 +0200 > Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 49836 <at> debbugs.gnu.org, > Dmitry Gutov <dgutov@HIDDEN> > > If the actual command (ripgrep or something else) takes zero seconds, what if anything prevents a crisp snappy response from Emacs? The sub-process communications infrastructure, of course.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 18 Sep 2021 13:54:05 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 18 09:54:05 2021 Received: from localhost ([127.0.0.1]:33900 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mRan6-0001xG-Nz for submit <at> debbugs.gnu.org; Sat, 18 Sep 2021 09:54:04 -0400 Received: from mail212c50.megamailservers.eu ([91.136.10.222]:59350 helo=mail194c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mattiase@HIDDEN>) id 1mRan3-0001wh-CG for 49836 <at> debbugs.gnu.org; Sat, 18 Sep 2021 09:54:03 -0400 X-Authenticated-User: mattiase@HIDDEN DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1631973234; bh=aDqovr7SMdvgJMcst59fXmE/TzQ+ynEzj+O0pHLsBBM=; h=From:Subject:Date:Cc:To:From; b=OP4lXKlDK2ZDwNCH+FNvG4vWABUBZCPT+c5HfgAQ9bSoyiJWmU78XzXGQroltKpcD e2gqyT5IpbpukcWm24LQUpCrZ3MywvQntlpzuwlJQphmFaTndBQ9+vXhyrNK/4NNg+ mrUb8FHQRunxB6qbgBMvPXMqcLFx7ZtpXpXw9Sis= Feedback-ID: mattiase@HIDDEN Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 18IDrphJ014939; Sat, 18 Sep 2021 13:53:53 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattiase@HIDDEN> Content-Type: multipart/mixed; boundary="Apple-Mail=_F9F033EA-E663-4753-8BED-DB88E54C473B" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep Message-Id: <34778BC0-8D97-4266-8B1F-9D1839E858B5@HIDDEN> Date: Sat, 18 Sep 2021 15:53:51 +0200 To: Juri Linkov <juri@HIDDEN> X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F1C.6145EF72.0017, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.4 cv=H7G4f8Ui c=1 sm=1 tr=0 ts=6145ef72 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=F_HoH42_FPgxv3Mm73wA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=CjuIK1q_8ugA:10 a=dUQJr0O9WMbI_d5h5swA:9 a=B2y7HmGcmWMA:10 X-Origin-Country: SE X-Spam-Score: 4.7 (++++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Attached is a straw-man patch that is not production-quality but illustrates some of the concepts I'd like to see: * ripgrep supported for M-? * ripgrep auto-detected and used by default if available * treat ripgrep as a search method of its own and not just a different grep program * corollary: selection of searc [...] Content analysis details: (4.7 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [91.136.10.222 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 3.7 FAKE_REPLY_B No description available. X-Debbugs-Envelope-To: 49836 Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 49836 <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.7 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Attached is a straw-man patch that is not production-quality but illustrates some of the concepts I'd like to see: * ripgrep supported for M-? * ripgrep auto-detected and used by default if available * treat ripgrep as a search method of its own and not just a different grep program * corollary: selection of searc [...] Content analysis details: (3.7 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [91.136.10.222 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 3.7 FAKE_REPLY_B No description available. --Apple-Mail=_F9F033EA-E663-4753-8BED-DB88E54C473B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Attached is a straw-man patch that is not production-quality but = illustrates some of the concepts I'd like to see: * ripgrep supported for M-? * ripgrep auto-detected and used by default if available * treat ripgrep as a search method of its own and not just a different = grep program * corollary: selection of search method should be made symbolically and = not by supplying shell command strings Concerns not addressed by the patch: * unify back-ends and customisation options in xref.el and = symref/grep.el * tramp * correct way to auto-detect ripgrep -- I have no idea, really, and = would gladly settle for something dead simple, perhaps looking at the = output of rg --version, instead of the voodoo code in the patch * other search methods -- for example, it would be interesting to allow = use of Spotlight or similar indexed searching tools in some cases. * speeding up the parts that are not ripgrep. If the actual command = (ripgrep or something else) takes zero seconds, what if anything = prevents a crisp snappy response from Emacs? That said, it appears to work. Right now I'm not near my Linux machine = and can just compare against the fairly slow BSD grep that comes with = macOS, so obviously the speed-up is tremendous. --Apple-Mail=_F9F033EA-E663-4753-8BED-DB88E54C473B Content-Disposition: attachment; filename=0001-xref-ripgrep-support.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-xref-ripgrep-support.patch" Content-Transfer-Encoding: quoted-printable =46rom=200d3fa647fd6a0c3a27bc5f9905e24103a3d6b617=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= <mattiase@HIDDEN>=0ADate:=20Thu,=2016=20Sep=202021=2017:14:33=20+0200=0A= Subject:=20[PATCH]=20xref=20ripgrep=20support=0A=0AAuto-detect=20= presence=20of=20ripgrep=20and=20use=20it=20if=20available.=0AIt=20speeds=20= up=20`xref-find-references`=20(M-q),=20between=20a=20little=20and=20very=20= much.=0A---=0A=20lisp/cedet/semantic/symref/grep.el=20|=20121=20= +++++++++++++++++++++--------=0A=201=20file=20changed,=2088=20= insertions(+),=2033=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/cedet/semantic/symref/grep.el=20= b/lisp/cedet/semantic/symref/grep.el=0Aindex=201e282c3052..106d46dc76=20= 100644=0A---=20a/lisp/cedet/semantic/symref/grep.el=0A+++=20= b/lisp/cedet/semantic/symref/grep.el=0A@@=20-79,16=20+79,7=20@@=20= semantic-symref-derive-find-filepatterns=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20;;=20Only=20take=20in=20simple=20patterns,=20= so=20try=20to=20convert=20this=20one.=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(string-match=20"\\\\\\.\\([^\\'>]+\\)\\\\'"=20= (car=20X)))=0A=20=20=20=20=20=20=20=20=20=20=20(push=20(concat=20"*."=20= (match-string=201=20(car=20X)))=20pat))))=0A-=20=20=20=20;;=20Convert=20= the=20list=20into=20some=20find-flags.=0A-=20=20=20=20(if=20(null=20pat)=0A= -=20=20=20=20=20=20=20=20(error=20"Customize=20= `semantic-symref-filepattern-alist'=20for=20%S"=0A-=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20major-mode)=0A-=20=20=20=20=20=20(let=20((args=20= `("-name"=20,(car=20pat))))=0A-=20=20=20=20=20=20=20=20(if=20(null=20= (cdr=20pat))=0A-=20=20=20=20=20=20=20=20=20=20=20=20args=0A-=20=20=20=20=20= =20=20=20=20=20`("("=20,@args=0A-=20=20=20=20=20=20=20=20=20=20=20=20= ,@(mapcan=20(lambda=20(s)=20`("-o"=20"-name"=20,s))=20(cdr=20pat))=0A-=20= =20=20=20=20=20=20=20=20=20=20=20")"))))))=0A+=20=20=20=20pat))=0A=20=0A=20= (defvar=20semantic-symref-grep-flags)=0A=20=0A@@=20-133,12=20+124,91=20= @@=20semantic-symref-grep-shell=0A=20=20=20:group=20'semantic=0A=20=20=20= :type=20'string)=0A=20=0A+(defcustom=20semantic-symref-grep-tool=20= 'auto-detect=0A+=20=20"The=20tool=20to=20use=20for=20searching=20in=20= files."=0A+=20=20:type=20'(choice=20(const=20:tag=20"Auto-detect"=20= auto-detect)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (const=20:tag=20"Ripgrep"=20ripgrep)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(const=20:tag=20"find=20+=20grep"=20find-grep))=0A+=20=20= :group=20'semantic)=0A+=0A+(defcustom=20= semantic-symref-grep-ripgrep-command=20"rg"=0A+=20=20"Name=20of=20the=20= ripgrep=20command=20to=20use."=0A+=20=20:type=20'file=0A+=20=20:group=20= 'semantic)=0A+=0A+(defun=20semantic-symref-grep--auto-detect-tool=20()=0A= +=20=20(let=20((have-rg=0A+=20=20=20=20=20=20=20=20=20(with-temp-buffer=0A= +=20=20=20=20=20=20=20=20=20=20=20(let=20((hello-file=20= (grep-hello-file)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(let=20= ((process-file-side-effects=20nil))=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(unwind-protect=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(eql=20(ignore-errors=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(process-file=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= semantic-symref-grep-ripgrep-command=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20nil=20t=20nil=20= "^Copyright"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(file-local-name=20hello-file)))=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=200)=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(when=20(file-remote-p=20= hello-file)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (delete-file=20hello-file))))))))=0A+=20=20=20=20(if=20have-rg=0A+=20=20=20= =20=20=20=20=20'ripgrep=0A+=20=20=20=20=20=20'find-grep)))=0A+=0A=20= (defun=20semantic-symref-grep--quote-extended=20(string)=0A=20=20=20= "Quote=20STRING=20as=20an=20extended-syntax=20regexp."=0A=20=20=20= (replace-regexp-in-string=20(rx=20(in=20".^$*+?|{}[]()|\\"))=0A=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (lambda=20(s)=20(concat=20"\\"=20s))=0A=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20string=20nil=20t))=0A=20= =0A+(defun=20semantic-symref-grep--command=20(rootdir=20filepatterns=20= file-name-only=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20pattern-type=20= pattern)=0A+=20=20"Compute=20search=20command=20to=20run.=0A+ROOTDIR=20= is=20the=20root=20of=20the=20tree=20to=20search.=20=20FILEPATTERNS=20is=20= a=0A+list=20of=20glob=20patterns=20that=20match=20the=20files=20to=20= search.=0A+If=20FILE-NAME-ONLY=20is=20non-nil,=20the=20search=20only=20= wants=20the=20names=20of=20files.=0A+PATTERN-TYPE=20indicates=20the=20= type=20of=20PATTERN:=0A+=20`regexp'=20=20=20=20=20--=20PATTERN=20is=20an=20= extended=20(egrep)=20regexp.=0A+=20`symbol'=20=20=20=20=20--=20PATTERN=20= is=20a=20literal=20identifier.=0A+=0A+Return=20the=20command=20and=20= arguments=20as=20a=20list=20of=20strings."=0A+=20=20(when=20(eq=20= semantic-symref-grep-tool=20'auto-detect)=0A+=20=20=20=20(setq=20= semantic-symref-grep-tool=0A+=20=20=20=20=20=20=20=20=20=20= (semantic-symref-grep--auto-detect-tool)))=0A+=20=20(cond=0A+=20=20=20= ((eq=20semantic-symref-grep-tool=20'ripgrep)=0A+=20=20=20=20(let=20= ((filepat-args=0A+=20=20=20=20=20=20=20=20=20=20=20(mapcan=20(lambda=20= (s)=20(list=20"-g"=20s))=20filepatterns))=0A+=20=20=20=20=20=20=20=20=20=20= (flags=20(cond=20(file-name-only=20"-l")=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20((eq=20pattern-type=20'symbol)=20= "-nw")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(t=20"-n")))=0A+=20=20=20=20=20=20=20=20=20=20(pat-arg=20(if=20(eq=20= pattern-type=20'symbol)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(semantic-symref-grep--quote-extended=20pattern)=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= pattern))=0A+=20=20=20=20=20=20=20=20=20=20(dir=20(expand-file-name=20= rootdir)))=0A+=20=20=20=20=20=20`(,semantic-symref-grep-ripgrep-command=0A= +=20=20=20=20=20=20=20=20,@filepat-args=20,flags=20"-e"=20,pat-arg=20= ,dir)))=0A+=20=20=20(t=0A+=20=20=20=20(let*=20((filepat-args=0A+=20=20=20= =20=20=20=20=20=20=20=20=20;;=20Convert=20the=20list=20into=20some=20= find-flags.=0A+=20=20=20=20=20=20=20=20=20=20=20=20(let=20((args=20= `("-name"=20,(car=20filepatterns))))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(if=20(cdr=20filepatterns)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20`("("=20,@args=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20,@(mapcan=20(lambda=20(s)=20(list=20"-o"=20"-name"=20= s))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(cdr=20filepatterns))=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20")")=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20args)))=0A+=20=20=20=20=20=20=20=20=20=20=20= (filepattern=20(mapconcat=20#'shell-quote-argument=20filepat-args=20"=20= "))=0A+=20=20=20=20=20=20=20=20=20=20=20(grepflags=20(cond=20= (file-name-only=20"-l=20")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20((eq=20pattern-type=20'regexp)=20= "-nE=20")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(t=20"-nwE=20")))=0A+=20=20=20=20=20=20=20=20=20=20= =20(pat-arg=20(if=20(eq=20pattern-type=20'symbol)=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (semantic-symref-grep--quote-extended=20pattern)=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20pattern))=0A+=20=20=20=20=20= =20=20=20=20=20=20(cmd=20(semantic-symref-grep-use-template=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(directory-file-name=20= (file-local-name=20rootdir))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20filepattern=20grepflags=20pat-arg)))=0A+=20=20=20=20=20=20= `(,semantic-symref-grep-shell=20,shell-command-switch=20,cmd)))))=0A+=0A=20= (cl-defmethod=20semantic-symref-perform-search=20((tool=20= semantic-symref-tool-grep))=0A=20=20=20"Perform=20a=20search=20with=20= Grep."=0A=20=20=20;;=20Grep=20doesn't=20support=20some=20types=20of=20= searches.=0A@@=20-150,33=20+220,18=20@@=20semantic-symref-perform-search=0A= =20=20=20(let*=20(;;=20Find=20the=20file=20patterns=20to=20use.=0A=20=09=20= (rootdir=20(semantic-symref-calculate-rootdir))=0A=20=09=20(filepatterns=20= (semantic-symref-derive-find-filepatterns))=0A-=20=20=20=20=20=20=20=20=20= (filepattern=20(mapconcat=20#'shell-quote-argument=20filepatterns=20"=20= "))=0A-=09=20;;=20Grep=20based=20flags.=0A-=09=20(grepflags=20(cond=20= ((eq=20(oref=20tool=20resulttype)=20'file)=0A-=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"-l=20")=0A-=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ((eq=20(oref=20tool=20searchtype)=20'regexp)=0A-=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"-nE=20")=0A-=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (t=20"-nw=20")))=0A-=20=20=20=20=20=20=20=20=20(searchfor=20(oref=20tool=20= searchfor))=0A-=20=20=20=20=20=20=20=20=20(greppat=20(if=20(eq=20(oref=20= tool=20searchtype)=20'regexp)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20searchfor=0A-=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(semantic-symref-grep--quote-extended=20= searchfor)))=0A-=09=20;;=20Misc=0A-=09=20(b=20(get-buffer-create=20= "*Semantic=20SymRef*"))=0A-=09=20(ans=20nil)=0A-=09=20)=0A+=20=20=20=20=20= =20=20=20=20(greppat=20(oref=20tool=20searchfor))=0A+=20=20=20=20=20=20=20= =20=20(file-names-only=20(eq=20(oref=20tool=20resulttype)=20'file))=0A+=20= =20=20=20=20=20=20=20=20(search-type=20(oref=20tool=20searchtype))=0A+=20= =20=20=20=20=20=20=20=20(command=20(semantic-symref-grep--command=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20rootdir=20= filepatterns=20file-names-only=20search-type=20greppat))=0A+=09=20(b=20= (get-buffer-create=20"*Semantic=20SymRef*")))=0A=20=0A=20=20=20=20=20= (with-current-buffer=20b=0A=20=20=20=20=20=20=20(erase-buffer)=0A=20=20=20= =20=20=20=20(setq=20default-directory=20rootdir)=0A-=20=20=20=20=20=20= (let=20((cmd=20(semantic-symref-grep-use-template=0A-=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(directory-file-name=20(file-local-name=20= rootdir))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= filepattern=20grepflags=20greppat)))=0A-=20=20=20=20=20=20=20=20= (process-file=20semantic-symref-grep-shell=20nil=20b=20nil=0A-=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= shell-command-switch=20cmd)))=0A-=20=20=20=20(setq=20ans=20= (semantic-symref-parse-tool-output=20tool=20b))=0A-=20=20=20=20;;=20= Return=20the=20answer=0A-=20=20=20=20ans))=0A+=20=20=20=20=20=20(apply=20= #'process-file=20(car=20command)=20nil=20b=20nil=20(cdr=20command)))=0A+=20= =20=20=20(semantic-symref-parse-tool-output=20tool=20b)))=0A=20=0A=20= (cl-defmethod=20semantic-symref-parse-tool-output-one-line=20((tool=20= semantic-symref-tool-grep))=0A=20=20=20"Parse=20one=20line=20of=20grep=20= output,=20and=20return=20it=20as=20a=20match=20list.=0A--=20=0A2.21.1=20= (Apple=20Git-122.3)=0A=0A= --Apple-Mail=_F9F033EA-E663-4753-8BED-DB88E54C473B--
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 17 Sep 2021 16:24:25 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 17 12:24:25 2021 Received: from localhost ([127.0.0.1]:32778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mRGf2-0008UM-Vw for submit <at> debbugs.gnu.org; Fri, 17 Sep 2021 12:24:25 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <larsi@HIDDEN>) id 1mRGf0-0008U6-0d for 49836 <at> debbugs.gnu.org; Fri, 17 Sep 2021 12:24:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=XEMrCdeYYwbJWDW8RCB219LOgPo86IxxCQOR1oIm0qc=; b=jcWnDaLYTRAVPMGUBA9oOs0afk VTBzzzrqqcjpZboXY0F+caD/UZBgArkG7+mrYHyxSCggAbvct6sqFoI0ORh3gxd3ycuNdl5We/J0z cgoVvmrzUs9tAZAf1qh9wNm0O5fFnSwIU3pz2wQpfv9I30muUYE3fPdRDM3GcwyYrdfI=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <larsi@HIDDEN>) id 1mRGer-0001tD-2b; Fri, 17 Sep 2021 18:24:15 +0200 From: Lars Ingebrigtsen <larsi@HIDDEN> To: Juri Linkov <juri@HIDDEN> Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep References: <83h7elbzo3.fsf@HIDDEN> <7b0409e3-fc88-b34e-9365-25356bb85859@HIDDEN> <83bl4tbxyu.fsf@HIDDEN> <12215e07-af4e-2db7-1869-16ac92feb806@HIDDEN> <8335q5bt9b.fsf@HIDDEN> <ee8b7d7f-abd1-42fc-a273-819ccef3c4e7@HIDDEN> <874kaj5o77.fsf_-_@HIDDEN> Date: Fri, 17 Sep 2021 18:24:07 +0200 In-Reply-To: <874kaj5o77.fsf_-_@HIDDEN> (Juri Linkov's message of "Fri, 17 Sep 2021 19:07:16 +0300") Message-ID: <87fsu3uq54.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Juri Linkov <juri@HIDDEN> writes: > What remains to do here is to support Ripgrep officially. What would that entail? Just documenting it? Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49836 Cc: 49836 <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 (---) Juri Linkov <juri@HIDDEN> writes: > What remains to do here is to support Ripgrep officially. What would that entail? Just documenting it? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 17 Sep 2021 16:09:43 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 17 12:09:43 2021 Received: from localhost ([127.0.0.1]:60989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mRGQo-0005y9-2w for submit <at> debbugs.gnu.org; Fri, 17 Sep 2021 12:09:42 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:57281) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1mRGQl-0005xv-Na for 49836 <at> debbugs.gnu.org; Fri, 17 Sep 2021 12:09:40 -0400 Received: (Authenticated sender: juri@HIDDEN) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 15A7320005 for <49836 <at> debbugs.gnu.org>; Fri, 17 Sep 2021 16:09:32 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: 49836 <at> debbugs.gnu.org Subject: bug#49836: Support ripgrep in semantic-symref-tool-grep Organization: LINKOV.NET References: <83h7elbzo3.fsf@HIDDEN> <7b0409e3-fc88-b34e-9365-25356bb85859@HIDDEN> <83bl4tbxyu.fsf@HIDDEN> <12215e07-af4e-2db7-1869-16ac92feb806@HIDDEN> <8335q5bt9b.fsf@HIDDEN> <ee8b7d7f-abd1-42fc-a273-819ccef3c4e7@HIDDEN> Date: Fri, 17 Sep 2021 19:07:16 +0300 In-Reply-To: <ee8b7d7f-abd1-42fc-a273-819ccef3c4e7@HIDDEN> (Dmitry Gutov's message of "Wed, 15 Sep 2021 21:39:36 +0300") Message-ID: <874kaj5o77.fsf_-_@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 49836 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 (-) Redirecting here from https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg01132.html > Speaking of Ripgrep, the compatible behavior of -w is only with recent > versions (reported and fixed in > https://github.com/BurntSushi/ripgrep/issues/389), starting with > 0.10.0. Debian 10 and Fedora 31 include that versions or newer > (https://repology.org/project/ripgrep/versions). > > Not that it's really important: we don't support Ripgrep officially. Thanks to Mattias, part of the reported problem is solved. What remains to do here is to support Ripgrep officially.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 7 Aug 2021 14:12:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 07 10:12:51 2021 Received: from localhost ([127.0.0.1]:52987 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mCN4E-0006WO-RU for submit <at> debbugs.gnu.org; Sat, 07 Aug 2021 10:12:51 -0400 Received: from mail-wr1-f54.google.com ([209.85.221.54]:43939) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <raaahh@HIDDEN>) id 1mCN49-0006W6-GD for 49836 <at> debbugs.gnu.org; Sat, 07 Aug 2021 10:12:49 -0400 Received: by mail-wr1-f54.google.com with SMTP id h14so14947598wrx.10 for <49836 <at> debbugs.gnu.org>; Sat, 07 Aug 2021 07:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=D4qaG7jlrKXbdaiy9F1TNNTGozC/623OyS+rx37mDK4=; b=UwUaCqFLQUIpS7/z2l4UxoEW6vh15Ej5hzS9bjiru1z6GPy5VzwObvm58XvUdBDzw2 VMPq0CGb3gVxoWVbp0wuw/GozQNQxgFSFL6jUwX9XDOAwrydpbfyDlV3DIDYKVwOdcYu NABuxvApKFwkMNb+3f6n368KNr4cSxoEfQctJ8dpjEipldTVGsq9yXHrUwVZcR3+XqEI A91CB7FHYGBv7NeuZkv3DGCEJzHBur142bdsHEKx7zmkYTCJjHcSq/qcl9lzP7qxP9UP Jsdu63EOkYSf7PJ09VKgE2HQBdZOp31JTifoSqc5jmssQUaIaC084kapH5JAf8CaTbzp y9cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=D4qaG7jlrKXbdaiy9F1TNNTGozC/623OyS+rx37mDK4=; b=S0QsDGXlkcEaE8t9J8MZFnAf/n4oVTIG6XuY4LiDoUdjEakmXnKRzQdZa8c3ggHBOX lwKQRzaXxmGGswD/12eSG75l7TSTNP4pvScmWsOTP7mi4H+zdoxo7ogRn9G5s6g7WUNc A+gb7J7wCPElpNuX4OG9B7UMpRupe5WMiqtS+IYJSOR9jUf2fHW2L+7FdTUyBJ4fd3vs PclZg+WhKk11kwe0lUuRShGiqtpO5iBfdiwKnpvu4nbyQxOd7pUlP0pENOP0C9WvB+nq uGB8Eb4YVUmd2Rjmgfv2rFHYv8NuA3x4w5DrwgEGTyVT/m3Ju/rfMQhPaj+he5YKcCsc cNAA== X-Gm-Message-State: AOAM530w7tdTKB8Q+QG8GubOwpchawQcTUxCdDuSodQkdooqBf37RIaO wlzCCGA5c+gU8oZRXnDbDLR7AOODjfw= X-Google-Smtp-Source: ABdhPJxdzJmPhw0BrvspCdaezAlwj3zZ3Nztzz7zoJxg0/EEvf1HsZDnK/nSREzCTUYbjJjgOpPOXw== X-Received: by 2002:a5d:4ac5:: with SMTP id y5mr16379006wrs.125.1628345559678; Sat, 07 Aug 2021 07:12:39 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id n7sm11676109wmd.3.2021.08.07.07.12.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 07 Aug 2021 07:12:38 -0700 (PDT) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep To: Juri Linkov <juri@HIDDEN> References: <87sfzrbke1.fsf_-_@HIDDEN> <875ywn556i.fsf@HIDDEN> <f211329a-6eb5-a85e-a735-59f098ede4fb@HIDDEN> <87sfzo3nvm.fsf@HIDDEN> <ee3bb56a-7e2a-535a-a83e-c577ae35496a@HIDDEN> <87tuk38kq9.fsf@HIDDEN> From: Dmitry Gutov <dgutov@HIDDEN> Message-ID: <e355e0c7-984d-3fab-9c0a-bd1275c7ed05@HIDDEN> Date: Sat, 7 Aug 2021 17:12:37 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <87tuk38kq9.fsf@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 49836 Cc: 49836 <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.6 (/) On 06.08.2021 03:35, Juri Linkov wrote: > semantic-symref-grep-use-template constructs such command line: > > "rg ... -e \\\\bsoap-type-is-array\\?\\\\b" > > that finds matches. The correct one will probably look like "rg ... -e \\\\bsoap-type-is-array\\\\?\\\\b" (same number of backslashes before '?' as before 'b'), and it won't find any. The one you mentioned will find false positives. E.g., try searching for 'file-name-as-directory?'. Or 'carr?'. >> See above. But also consider what happens if a user sees that grep-program >> is now customizable and ripgrep is an officially supported value. They >> change it to "rg", and then suddenly their 'M-x rgrep' input has to use the >> extended regexp format? > > This difference could be explained in the documentation. If it comes to that, yes, but it's usually better to fix usability problems that just document them. >> Worse than that, any third-party package that uses grep-find-template will >> suddenly have a high chance of failing if they pass any nontrivial regexps >> to it, especially if those have groupings or alternations. > > This already happened after trying to customize grep-find-template > to use rg broke xref-find-references, so the problem already exists > and needs to be solved. The problem exists, and has been for a long time: grep.el doesn't properly support the "alternative" search programs, which are very popular now. Its abstraction is leaky and doesn't work with anything but grep. But I think that means we need a better abstraction. Let's try to make sure we don't create bigger problems when fixing it. And "packages stop working when I customize grep-program" sounds worse than "I can't customize grep-program to 'rg', so my searches are a bit slower than they could have been". >> It's a hard problem: grep.el is not prepared for abstracting like that. If >> we at least standardized it internally on Extended format, that would at >> least remove one source of uncertainty and bugs. The user still can input >> basic regexps interactively, we can translate them easily. > > Is there a package that can translate between them reliably? For the limited purpose of symref/grep, we could use xref--regexp-to-extended. It's already used in xref-matches-in-directory and xref-matches-in-files. Better name/documentation and tests are pending. Note that it actually translates from a (subset of) Emacs regexp to Extended and back (it's reversible). The proper basic regexp syntax treats '+' and '?' as normal characters unless escaped, but they're special in Emacs regexps. The above function is how one can use Emacs syntax (though only limited a subset, for now) in project-find-regexp. I also saw some commits to ELPA yesterday, that show that Consult includes a more advanced version of this feature: https://git.savannah.gnu.org/cgit/emacs/elpa.git/commit/?h=externals/consult&id=7bd3e44929d44cf0e17f38e943e9be2bd6014237 https://git.savannah.gnu.org/cgit/emacs/elpa.git/commit/?h=externals/consult&id=95dadd98a6a0f08955f67f1e9a7cc312435a86b8 Not sure how mature it is (seems still in development), but perhaps we could move it to the core sooner or later. And use it instead, if it does provide any improvement for our use case here. >> Further: seeing xref-search-program-alist, people asked for support for >> other similar programs, such as ag and pt. Any solution we end up with, we >> should try to ensure they are valid values of grep-program as well. > > Why not, semantic-symref already supports alternative tools > such as cscope, global, idutils. So xref could support more too. It's easy enough for Xref, yes. It only has to support one single, well-defined scenario. >>> + (if (equal grep-program "rg") >>> + (format "(^|\\W)%s(\\W|$)" >>> + (oref tool searchfor)) >>> + (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" >>> + (oref tool searchfor)))))) >> >> This can work. Except the comparison should be with "grep", I think: all >> other alternatives only work with the Extended format. > > I'm worried about the case when the user customizes > 'grep-program' to e.g. an absolute path "/bin/grep" > or "/usr/local/bin/grep", etc. (string-match "\\bgrep\\b" grep-program) could take care of this. To sum up, I'm all for adding some clutches to symref/grep.el, to support your advanced scenario, right now. As for having grep-program customizable, perhaps we should add some new feature/abstraction/package? To avoid breakage, and for it to be opt-in for any new callers from Lisp. Or indeed have templates use Extended syntax, and grep-expand-template translate REGEXP to it. That can cause breakage for existing users, though, those who already customize grep-find-template, etc, to their particular programs.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 6 Aug 2021 00:50:16 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 05 20:50:16 2021 Received: from localhost ([127.0.0.1]:48702 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mBo40-0004ba-CR for submit <at> debbugs.gnu.org; Thu, 05 Aug 2021 20:50:16 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:51303) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1mBo3x-0004bF-AJ for 49836 <at> debbugs.gnu.org; Thu, 05 Aug 2021 20:50:15 -0400 Received: (Authenticated sender: juri@HIDDEN) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 16F6B1BF207; Fri, 6 Aug 2021 00:50:05 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: Dmitry Gutov <dgutov@HIDDEN> Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep Organization: LINKOV.NET References: <87sfzrbke1.fsf_-_@HIDDEN> <875ywn556i.fsf@HIDDEN> <f211329a-6eb5-a85e-a735-59f098ede4fb@HIDDEN> <87sfzo3nvm.fsf@HIDDEN> <ee3bb56a-7e2a-535a-a83e-c577ae35496a@HIDDEN> Date: Fri, 06 Aug 2021 03:35:02 +0300 In-Reply-To: <ee3bb56a-7e2a-535a-a83e-c577ae35496a@HIDDEN> (Dmitry Gutov's message of "Thu, 5 Aug 2021 06:03:08 +0300") Message-ID: <87tuk38kq9.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 49836 Cc: 49836 <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 (-) >>> I think the original idea (surrounding with \W) is sound: after all, not >>> every symbol boundary in Emacs sense is a word boundary in Grep or RG. If >>> a method, say, ends with ?, then it won't be. >> I tried to search for 'soap-type-is-array?' in the Emacs tree, >> and ripgrep can find it with "\\b%s\\b", but Grep can't. > > Did you search through symref, or in console? If the former, it seems some > regexp-quoting is missing somewhere (the question mark was no > escaped). Because see what the console says: > > $ rg "\bsoap-type-is-array?\b" > lisp/net/soap-client.el > 950:(defun soap-type-is-array? (type) > 990: (if (soap-type-is-array? type) > > ChangeLog.2 > 19080: * lisp/net/soap-client.el (soap-type-is-array?): new defun > > $ rg "\bsoap-type-is-array\?\b" > > ^^ no matches > > And > > $ rg "\bsoap-type-is-array\?" > > has matches, of course. semantic-symref-grep-use-template constructs such command line: "rg ... -e \\\\bsoap-type-is-array\\?\\\\b" that finds matches. >> It would be more preferable not to change the existing default logic >> to avoid possible troubles. Since Grep with Basic syntax works fine, >> then better not to switch to Extended syntax. > > See above. But also consider what happens if a user sees that grep-program > is now customizable and ripgrep is an officially supported value. They > change it to "rg", and then suddenly their 'M-x rgrep' input has to use the > extended regexp format? This difference could be explained in the documentation. > Worse than that, any third-party package that uses grep-find-template will > suddenly have a high chance of failing if they pass any nontrivial regexps > to it, especially if those have groupings or alternations. This already happened after trying to customize grep-find-template to use rg broke xref-find-references, so the problem already exists and needs to be solved. > It's a hard problem: grep.el is not prepared for abstracting like that. If > we at least standardized it internally on Extended format, that would at > least remove one source of uncertainty and bugs. The user still can input > basic regexps interactively, we can translate them easily. Is there a package that can translate between them reliably? > Further: seeing xref-search-program-alist, people asked for support for > other similar programs, such as ag and pt. Any solution we end up with, we > should try to ensure they are valid values of grep-program as well. Why not, semantic-symref already supports alternative tools such as cscope, global, idutils. So xref could support more too. >> + (if (equal grep-program "rg") >> + (format "(^|\\W)%s(\\W|$)" >> + (oref tool searchfor)) >> + (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" >> + (oref tool searchfor)))))) > > This can work. Except the comparison should be with "grep", I think: all > other alternatives only work with the Extended format. I'm worried about the case when the user customizes 'grep-program' to e.g. an absolute path "/bin/grep" or "/usr/local/bin/grep", etc.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 5 Aug 2021 03:03:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 04 23:03:19 2021 Received: from localhost ([127.0.0.1]:45532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mBTfC-0002WH-SI for submit <at> debbugs.gnu.org; Wed, 04 Aug 2021 23:03:19 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:38481) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <raaahh@HIDDEN>) id 1mBTfB-0002W2-IR for 49836 <at> debbugs.gnu.org; Wed, 04 Aug 2021 23:03:17 -0400 Received: by mail-wr1-f42.google.com with SMTP id l18so4510813wrv.5 for <49836 <at> debbugs.gnu.org>; Wed, 04 Aug 2021 20:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=HO8Kqm7btRWv67cz8Qzo3EeVq56p1GXqbo5XOZVNEoY=; b=DJSR5sC4vtabFPoOzsFSkm492+xqRnWAMhpW30jyV/uIlFMVUDoiuQZQxF82THj8Pa 5i4T+EDhc8GUs1avf6yaxy2rk5a7XX3TsyHmQCngxvi7qEk3QDvHOEoMsTEAFRBpgAQG nXIRXaFBKLQSrOO8SLwqJ3/bP7d04+ARBybW427PCfE5erJqqtCtoMlsZZv6CeWiFpTh 3wf5BwDFBR0FTxO6sej3a06cHZ8qU/yVAdgeMcJfQUL65sGCeIwK4q2EF5h+I9CARAY5 WbuWVc/jvnLovGb0t9bxT3Fs5U2WL4S2rIirgvb6SuFCiBwFuJvdNIWRmVbPpE3WOat/ VF+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HO8Kqm7btRWv67cz8Qzo3EeVq56p1GXqbo5XOZVNEoY=; b=pCESmfhH1YSS7yUNn17s7yq0aECXVzZyLZMb4xHKTfLHWy3hJtOpGb3uV2ih3czKu1 y/KKmu2Y2cBMDmcGU7dJq1ahqPIiNB1yOgXPvGs2DZlNvsJkapEfvH+6CB92DObO0yfa ggRHHm5boj+A6rkSloVx6Cs6OlB4IHaT3hBFLnNCSiKPozx5UwMKPWnEo1Qeajra7zHv fk0hjs7JdEQz0Qu6JUFYpxQp2k6J/wFXnG7Sh+Y+jw/ihI/pyGvO+Y9I9AwlYkM5eVlR GwE0fhJRIDd/KlX+LCLfWlTqbd5hCsmK0gZIaLRtpUixFb/jn4TjAtSYoDuuW/0eluPx 1EAw== X-Gm-Message-State: AOAM531OR652rr8sRQ6bs8ApLQfrLhNBUKgG8NBvcNR6G9/JPMgCPxK4 JP8OqG1HFtstiPJjsO3Uyvqdx78jxKk= X-Google-Smtp-Source: ABdhPJzj0SOy5zFUgD6DCp8JoKM6HKuZ6ztsAwlyR7/Qp0nS+QeZNpT9//NrN/kH4wCwmv684h77rA== X-Received: by 2002:a5d:6448:: with SMTP id d8mr2359033wrw.295.1628132591541; Wed, 04 Aug 2021 20:03:11 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id u11sm4402219wrp.26.2021.08.04.20.03.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Aug 2021 20:03:10 -0700 (PDT) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep To: Juri Linkov <juri@HIDDEN> References: <87sfzrbke1.fsf_-_@HIDDEN> <875ywn556i.fsf@HIDDEN> <f211329a-6eb5-a85e-a735-59f098ede4fb@HIDDEN> <87sfzo3nvm.fsf@HIDDEN> From: Dmitry Gutov <dgutov@HIDDEN> Message-ID: <ee3bb56a-7e2a-535a-a83e-c577ae35496a@HIDDEN> Date: Thu, 5 Aug 2021 06:03:08 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <87sfzo3nvm.fsf@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 49836 Cc: 49836 <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.6 (/) On 05.08.2021 00:23, Juri Linkov wrote: >> I think the original idea (surrounding with \W) is sound: after all, not >> every symbol boundary in Emacs sense is a word boundary in Grep or RG. If >> a method, say, ends with ?, then it won't be. > I tried to search for 'soap-type-is-array?' in the Emacs tree, > and ripgrep can find it with "\\b%s\\b", but Grep can't. Did you search through symref, or in console? If the former, it seems some regexp-quoting is missing somewhere (the question mark was no escaped). Because see what the console says: $ rg "\bsoap-type-is-array?\b" lisp/net/soap-client.el 950:(defun soap-type-is-array? (type) 990: (if (soap-type-is-array? type) ChangeLog.2 19080: * lisp/net/soap-client.el (soap-type-is-array?): new defun $ rg "\bsoap-type-is-array\?\b" ^^ no matches And $ rg "\bsoap-type-is-array\?" has matches, of course. > It would be more preferable not to change the existing default logic > to avoid possible troubles. Since Grep with Basic syntax works fine, > then better not to switch to Extended syntax. See above. But also consider what happens if a user sees that grep-program is now customizable and ripgrep is an officially supported value. They change it to "rg", and then suddenly their 'M-x rgrep' input has to use the extended regexp format? Worse than that, any third-party package that uses grep-find-template will suddenly have a high chance of failing if they pass any nontrivial regexps to it, especially if those have groupings or alternations. It's a hard problem: grep.el is not prepared for abstracting like that. If we at least standardized it internally on Extended format, that would at least remove one source of uncertainty and bugs. The user still can input basic regexps interactively, we can translate them easily. Further: seeing xref-search-program-alist, people asked for support for other similar programs, such as ag and pt. Any solution we end up with, we should try to ensure they are valid values of grep-program as well. > The new user option is already used in many places in grep.el > in the previous patch, so it should be ok to use it in semantic-symref > as well: > > diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el > index 180d779a78..b7d08409aa 100644 > --- a/lisp/cedet/semantic/symref/grep.el > +++ b/lisp/cedet/semantic/symref/grep.el > @@ -150,15 +150,22 @@ semantic-symref-perform-search > "-l ") > ((eq (oref tool searchtype) 'regexp) > "-nE ") > - (t "-n "))) > + (t (if (equal grep-program "rg") > + ;; TODO: remove this after ripgrep is fixed (bug#49836) > + (unless (string-search "rg <C> -nH" grep-find-template) > + "-n ") > + "-n ")))) I'm actually fine with this part. > (greppat (cond ((eq (oref tool searchtype) 'regexp) > (oref tool searchfor)) > (t > ;; Can't use the word boundaries: Grep > ;; doesn't always agree with the language > ;; syntax on those. > - (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" > - (oref tool searchfor))))) > + (if (equal grep-program "rg") > + (format "(^|\\W)%s(\\W|$)" > + (oref tool searchfor)) > + (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" > + (oref tool searchfor)))))) This can work. Except the comparison should be with "grep", I think: all other alternatives only work with the Extended format.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 4 Aug 2021 21:25:59 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 04 17:25:59 2021 Received: from localhost ([127.0.0.1]:45302 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mBOOk-0002aZ-QQ for submit <at> debbugs.gnu.org; Wed, 04 Aug 2021 17:25:59 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:44891) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1mBOOi-0002aL-Qj for 49836 <at> debbugs.gnu.org; Wed, 04 Aug 2021 17:25:57 -0400 Received: (Authenticated sender: juri@HIDDEN) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id C694D60003; Wed, 4 Aug 2021 21:25:49 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: Dmitry Gutov <dgutov@HIDDEN> Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep Organization: LINKOV.NET References: <87sfzrbke1.fsf_-_@HIDDEN> <875ywn556i.fsf@HIDDEN> <f211329a-6eb5-a85e-a735-59f098ede4fb@HIDDEN> Date: Thu, 05 Aug 2021 00:23:41 +0300 In-Reply-To: <f211329a-6eb5-a85e-a735-59f098ede4fb@HIDDEN> (Dmitry Gutov's message of "Wed, 4 Aug 2021 06:14:55 +0300") Message-ID: <87sfzo3nvm.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 49836 Cc: 49836 <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 (-) --=-=-= Content-Type: text/plain >> @@ -150,15 +150,14 @@ semantic-symref-perform-search >> "-l ") >> ((eq (oref tool searchtype) 'regexp) >> "-nE ") >> - (t "-n "))) >> + (t (if (equal grep-program "rg") "" "-n ")))) > > It might be cleaner to see whether grep-find-template already includes that > flag, and if so, omit it. Though the search might be non-trivial if it's in > the form like "-abcn", still, that's searchable by regexp. Indeed, but such a hack is a temporary measure and can be removed later after ripgrep will be fixed. >> ;; Can't use the word boundaries: Grep >> ;; doesn't always agree with the language >> ;; syntax on those. >> - (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" >> - (oref tool searchfor))))) >> + (format "\\b%s\\b" (oref tool searchfor))))) > > I think the original idea (surrounding with \W) is sound: after all, not > every symbol boundary in Emacs sense is a word boundary in Grep or RG. If > a method, say, ends with ?, then it won't be. I tried to search for 'soap-type-is-array?' in the Emacs tree, and ripgrep can find it with "\\b%s\\b", but Grep can't. > The problem with the above regexp is that it uses the basic syntax, instead > of Extended. But we can flip it. > > As long as we're able to ask Grep to search with Extended syntax, we can > use (format "(^|\\W)%s(\\W|$)" (oref tool searchfor)). And that can be > achieved with the same method as is used in xref-matches-in-directory: > > Something like (replace-regexp-in-string "grep <C>" "grep <C> -E" > grep-find-template t t), to be sure it's not ripgrep in there. > > The new user option can be used too, but I'd probably prefer a more > independent solution here. It would be more preferable not to change the existing default logic to avoid possible troubles. Since Grep with Basic syntax works fine, then better not to switch to Extended syntax. The new user option is already used in many places in grep.el in the previous patch, so it should be ok to use it in semantic-symref as well: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=semantic-symref-perform-search-rg.patch diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index 180d779a78..b7d08409aa 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el @@ -150,15 +150,22 @@ semantic-symref-perform-search "-l ") ((eq (oref tool searchtype) 'regexp) "-nE ") - (t "-n "))) + (t (if (equal grep-program "rg") + ;; TODO: remove this after ripgrep is fixed (bug#49836) + (unless (string-search "rg <C> -nH" grep-find-template) + "-n ") + "-n ")))) (greppat (cond ((eq (oref tool searchtype) 'regexp) (oref tool searchfor)) (t ;; Can't use the word boundaries: Grep ;; doesn't always agree with the language ;; syntax on those. - (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" - (oref tool searchfor))))) + (if (equal grep-program "rg") + (format "(^|\\W)%s(\\W|$)" + (oref tool searchfor)) + (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" + (oref tool searchfor)))))) ;; Misc (b (get-buffer-create "*Semantic SymRef*")) (ans nil) --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 4 Aug 2021 03:15:06 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 03 23:15:06 2021 Received: from localhost ([127.0.0.1]:42054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mB7N3-0006mR-Tt for submit <at> debbugs.gnu.org; Tue, 03 Aug 2021 23:15:06 -0400 Received: from mail-wr1-f52.google.com ([209.85.221.52]:46695) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <raaahh@HIDDEN>) id 1mB7N1-0006le-Og for 49836 <at> debbugs.gnu.org; Tue, 03 Aug 2021 23:15:04 -0400 Received: by mail-wr1-f52.google.com with SMTP id c16so527212wrp.13 for <49836 <at> debbugs.gnu.org>; Tue, 03 Aug 2021 20:15:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=0AOo2fx7VNsE68676BMPriL8GnXwWSaoSKzYDiXSs2o=; b=vSGnxv5OyqgYTW4ycvTTN6j62il+ubjw/q53FNqGB0y58CBxfkLenU12/0M1F2GPgi eDFiTsZhFM/HSEL0wzd3bRAxZjbZKoYItVXJRbyE/Vjf8eWKWOA1CwuavWCBTy7lq6u4 8ttb2snBQecvDCsNoy+RnEUfV4dfKlZhzNY3QmpCgVDWKPgdjfaHb9uGGlS8z1c7z4c2 6owRn9GehAIwk1+7E8lXtIUPvF9/ySUopMGvdnsUtJkchqpmrj/PkRUl36EcNsRYlLMD 5hgVl8S5dD0rAM+74QHee8zK3/yemgudbc0DHQ3zSnRRqJfsthuawcsXlnQZi4+ploY1 r0jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=0AOo2fx7VNsE68676BMPriL8GnXwWSaoSKzYDiXSs2o=; b=Em41lGYHedl5s9n8bDKrpB9pDkOuVfehw0GGojOFBJqQbp16sdhaqXWzKTuSS+XUcP BIqGdh/1rrFDsJxNIet1x4LmwHE15HWt9g6auOCtCrfvtFpaU37WWSabxCbIYFPYOCu8 5h3zvZBOXxTVF/Tm0bQnIonSr6hxrbu/d2I+agCJWi+xXibQdWZJ3oj12L5oueiYO+pI 8YUfB1VucWfh8ywk3Ee+vleY3RuLXqXYklhPzl75oUu1v1tmceugpmgLtc3PZTwmIjNv gaTc3BgfA57ssTm4UUw/z8duiRcTosHHyU8TJbElES/HDHWnPAoHmb0/HDV+Wlnq6WA/ 2pkw== X-Gm-Message-State: AOAM532gDZFobVRyGWP0T3A5HaGVc2QfWP5i89lJQzTXWGpGrGJ5y+u1 QejXgHH6HZjT6e8Y4VlhYUe+Z31871Y= X-Google-Smtp-Source: ABdhPJyLtxG2vI6XYPR7frnSomcitGBqxPqNQtVnyiMR6sWaBgUVHtvi1e8Ctfbgmn+r7Jz8qxdKIg== X-Received: by 2002:adf:eacb:: with SMTP id o11mr27578411wrn.62.1628046897875; Tue, 03 Aug 2021 20:14:57 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id f2sm740634wrq.69.2021.08.03.20.14.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Aug 2021 20:14:57 -0700 (PDT) Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep To: Juri Linkov <juri@HIDDEN>, 49836 <at> debbugs.gnu.org References: <87sfzrbke1.fsf_-_@HIDDEN> <875ywn556i.fsf@HIDDEN> From: Dmitry Gutov <dgutov@HIDDEN> Message-ID: <f211329a-6eb5-a85e-a735-59f098ede4fb@HIDDEN> Date: Wed, 4 Aug 2021 06:14:55 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <875ywn556i.fsf@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 49836 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.6 (/) I think we can improve this part: On 03.08.2021 11:10, Juri Linkov wrote: > diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el > index 180d779a78..034f797076 100644 > --- a/lisp/cedet/semantic/symref/grep.el > +++ b/lisp/cedet/semantic/symref/grep.el > @@ -150,15 +150,14 @@ semantic-symref-perform-search > "-l ") > ((eq (oref tool searchtype) 'regexp) > "-nE ") > - (t "-n "))) > + (t (if (equal grep-program "rg") "" "-n ")))) It might be cleaner to see whether grep-find-template already includes that flag, and if so, omit it. Though the search might be non-trivial if it's in the form like "-abcn", still, that's searchable by regexp. > (greppat (cond ((eq (oref tool searchtype) 'regexp) > (oref tool searchfor)) > (t > ;; Can't use the word boundaries: Grep > ;; doesn't always agree with the language > ;; syntax on those. > - (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" > - (oref tool searchfor))))) > + (format "\\b%s\\b" (oref tool searchfor))))) > ;; Misc > (b (get-buffer-create "*Semantic SymRef*")) > (ans nil) I think the original idea (surrounding with \W) is sound: after all, not every symbol boundary in Emacs sense is a word boundary in Grep or RG. If a method, say, ends with ?, then it won't be. The problem with the above regexp is that it uses the basic syntax, instead of Extended. But we can flip it. As long as we're able to ask Grep to search with Extended syntax, we can use (format "(^|\\W)%s(\\W|$)" (oref tool searchfor)). And that can be achieved with the same method as is used in xref-matches-in-directory: Something like (replace-regexp-in-string "grep <C>" "grep <C> -E" grep-find-template t t), to be sure it's not ripgrep in there. The new user option can be used too, but I'd probably prefer a more independent solution here.
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Juri Linkov <juri@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 49836) by debbugs.gnu.org; 3 Aug 2021 08:15:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 03 04:15:51 2021 Received: from localhost ([127.0.0.1]:39809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mApaY-0007zY-Ns for submit <at> debbugs.gnu.org; Tue, 03 Aug 2021 04:15:51 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:50347) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1mApaW-0007yw-JX; Tue, 03 Aug 2021 04:15:49 -0400 Received: (Authenticated sender: juri@HIDDEN) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 36C16FF807; Tue, 3 Aug 2021 08:15:40 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: 49836 <at> debbugs.gnu.org Subject: Re: bug#49836: Support ripgrep in semantic-symref-tool-grep Organization: LINKOV.NET References: <87sfzrbke1.fsf_-_@HIDDEN> Date: Tue, 03 Aug 2021 11:10:05 +0300 In-Reply-To: <87sfzrbke1.fsf_-_@HIDDEN> (Juri Linkov's message of "Tue, 03 Aug 2021 00:05:02 +0300") Message-ID: <875ywn556i.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 49836 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 (-) --=-=-= Content-Type: text/plain tags 49836 + patch quit > This means to turn the existing variable 'grep-program' into the user option > as the following patch does. > > Also later grep.el could use the value "rg" of 'grep-program' > to create the corresponding grep-find-template in grep-compute-defaults. > > But I don't know if it's ok to mention rigrep in grep.el? So here is the complete support for rigrep in grep.el: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=grep-program-ripgrep.patch diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 7453dbed99..c4adee609c 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1544,7 +1544,7 @@ xref-search-program "The program to use for regexp search inside files. This must reference a corresponding entry in `xref-search-program-alist'." - :type `(choice + :type '(choice (const :tag "Use Grep" grep) (const :tag "Use ripgrep" ripgrep) (symbol :tag "User defined")) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 8f0a5acf70..cc3375a284 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -484,9 +484,14 @@ grep-mode-font-lock-keywords This gets tacked on the end of the generated expressions.") ;;;###autoload -(defvar grep-program (purecopy "grep") +(defcustom grep-program (purecopy "grep") "The default grep program for `grep-command' and `grep-find-command'. -This variable's value takes effect when `grep-compute-defaults' is called.") +This variable's value takes effect when `grep-compute-defaults' is called." + :type '(choice + (const :tag "Use Grep" "grep") + (const :tag "Use ripgrep" "rg") + (string :tag "User defined")) + :version "28.1") ;;;###autoload (defvar find-program (purecopy "find") @@ -709,13 +714,14 @@ grep-compute-defaults (let ((grep-options (concat (if grep-use-null-device "-n" "-nH") (if grep-use-null-filename-separator " --null") + (if (equal grep-program "rg") " --no-heading") (when (grep-probe grep-program `(nil nil nil "-e" "foo" ,(null-device)) nil 1) " -e")))) (unless grep-command (setq grep-command - (format "%s %s %s " grep-program + (format "%s%s %s " grep-program (or (and grep-highlight-matches (grep-probe @@ -723,7 +729,7 @@ grep-compute-defaults `(nil nil nil "--color" "x" ,(null-device)) nil 1) (if (eq grep-highlight-matches 'always) - "--color=always" "--color=auto")) + " --color=always" " --color=auto")) "") grep-options))) (unless grep-template @@ -983,6 +989,8 @@ grep-expand-template (push "--color=always" opts)) ((eq grep-highlight-matches 'auto) (push "--color=auto" opts))) + (when (equal grep-program "rg") + (push "--no-heading" opts)) opts)) (excl . ,excl) (dir . ,dir) @@ -1131,7 +1139,7 @@ lgrep files nil (and grep-find-ignored-files - (concat " --exclude=" + (concat (if (equal grep-program "rg") " -g=!" " --exclude=") (mapconcat (lambda (ignore) (cond ((stringp ignore) @@ -1141,7 +1149,7 @@ lgrep (shell-quote-argument (cdr ignore)))))) grep-find-ignored-files - " --exclude="))) + (if (equal grep-program "rg") " -g=!" " --exclude=")))) (and (eq grep-use-directories-skip t) '("--directories=skip")))) (when command @@ -1339,7 +1347,8 @@ zrgrep nil default-directory t)) (confirm (equal current-prefix-arg '(4)))) (list regexp files dir confirm grep-find-template))))))) - (let ((grep-find-template template) + (let ((grep-program "zgrep") + (grep-find-template template) ;; Set `grep-highlight-matches' to `always' ;; since `zgrep' puts filters in the grep output. (grep-highlight-matches 'always)) diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index 180d779a78..034f797076 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el @@ -150,15 +150,14 @@ semantic-symref-perform-search "-l ") ((eq (oref tool searchtype) 'regexp) "-nE ") - (t "-n "))) + (t (if (equal grep-program "rg") "" "-n ")))) (greppat (cond ((eq (oref tool searchtype) 'regexp) (oref tool searchfor)) (t ;; Can't use the word boundaries: Grep ;; doesn't always agree with the language ;; syntax on those. - (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" - (oref tool searchfor))))) + (format "\\b%s\\b" (oref tool searchfor))))) ;; Misc (b (get-buffer-create "*Semantic SymRef*")) (ans nil) --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 2 Aug 2021 21:39:22 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 02 17:39:22 2021 Received: from localhost ([127.0.0.1]:39416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mAfec-0007KX-9A for submit <at> debbugs.gnu.org; Mon, 02 Aug 2021 17:39:22 -0400 Received: from lists.gnu.org ([209.51.188.17]:36516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1mAfea-0007KP-Kn for submit <at> debbugs.gnu.org; Mon, 02 Aug 2021 17:39:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1mAfea-0005PL-Cn for bug-gnu-emacs@HIDDEN; Mon, 02 Aug 2021 17:39:20 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:52931) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1mAfeX-0007yf-IF for bug-gnu-emacs@HIDDEN; Mon, 02 Aug 2021 17:39:19 -0400 Received: (Authenticated sender: juri@HIDDEN) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 60B87E0002 for <bug-gnu-emacs@HIDDEN>; Mon, 2 Aug 2021 21:39:11 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: Support ripgrep in semantic-symref-tool-grep Organization: LINKOV.NET Date: Tue, 03 Aug 2021 00:05:02 +0300 Message-ID: <87sfzrbke1.fsf_-_@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=217.70.183.196; envelope-from=juri@HIDDEN; helo=relay4-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.7 (-) 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.7 (--) --=-=-= Content-Type: text/plain Creating a separate bug report from bug#49731 because this is a real problem. Now grep.el completely supports ripgrep when 'grep-find-template' is customized to a command line that uses 'rg' such as e.g. "find <D> <X> -type f <F> -print0 | sort -z | xargs -0 -e rg <C> -nH --no-heading -j8 --sort path -M 200 --max-columns-preview -e <R>" But such grep setting breaks the command 'xref-find-references': >>>> 1. while xref-find-references works fine in `emacs -Q`, >>>> I don't know why with my customization typing e.g. >>>> 'M-? isearch-lazy-highlight RET' reports >>>> "No references found for: isearch-lazy-highlight". >>> >>> Try and see which of the "tools" semantic-symref-perform-search ends >>> up using. >> >> Thanks for the pointers to semantic-symref-perform-search. >> It prepends "-n " to my customized pattern "rg -nH", >> so the arg "-n" is duplicated on the command line: >> `rg -n -nH` >> and signals the error: >> error: The argument '--line-number' was provided more than once, but >> cannot be used multiple times >> This error is caused by the bug in the command line parser used by >> ripgrep: >> https://github.com/clap-rs/clap/issues/2171 >> that was fixed only 6 months ago, so it will take much time >> before this fix will reach ripgrep, and this bug will be closed: >> https://github.com/BurntSushi/ripgrep/issues/1701 > > The above might be worked around with creating a symref-grep specific user > option for grep-find-template which would default to the "global" value of > that variable. Maybe like the existing option 'semantic-symref-grep-shell', e.g.: (defcustom semantic-symref-grep-program 'grep "The program to use for regexp search inside files." :type `(choice (const :tag "Use Grep" grep) (const :tag "Use ripgrep" ripgrep) (symbol :tag "User defined")) :version "28.1") But the problem is that for users it's hard to see the connection between the broken 'xref-find-references' and the need to customize an option with unrelated name 'semantic-symref-grep'. >> But even without duplicated "-n" semantic-symref-perform-search >> doesn't work with ripgrep because it doesn't find such pattern: >> \\\\\\(\\^\\\\\\|\\\\W\\\\\\)isearch-lazy-highlight\\\\\\(\\\\W\\\\\\|\\$\\\\\\) >> Maybe semantic-symref-perform-search could be improved to >> support ripgrep? >> Because without these two problems it works fine with ripgrep. > > ...but the above tells us (I think) that semantic-symref-perform-search is > trying to use the basic regexp syntax, and ripgrep doesn't support that > (only Extended, or PCRE). > > For your personal consumption, perhaps the best approach is to create > a separate "tool", like Grep (by copying symref/grep.el and tweaking some > of its definitions), and then register it in semantic-symref-tool-alist. > > I don't know if ripgrep is that much faster for this particular purpose. So > maybe it's too much work for little benefit. A more general solution would be to add to grep.el the same options that you added to xref: xref-search-program grep/ripgrep xref-search-program-alist '((grep . "xargs -0 grep <C> -snHE -e <R>") (ripgrep . "xargs -0 rg <C> -nH --no-messages -g '!*/' -e <R> | sort -t: -k1,1 -k2n,2")) This means to turn the existing variable 'grep-program' into the user option as the following patch does. Also later grep.el could use the value "rg" of 'grep-program' to create the corresponding grep-find-template in grep-compute-defaults. But I don't know if it's ok to mention rigrep in grep.el? Anyway, here is the patch that fixes 'xref-find-references': --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=grep-program.patch diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 8f0a5acf70..aba4d59371 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -484,9 +484,13 @@ grep-mode-font-lock-keywords This gets tacked on the end of the generated expressions.") ;;;###autoload -(defvar grep-program (purecopy "grep") +(defcustom grep-program (purecopy "grep") "The default grep program for `grep-command' and `grep-find-command'. -This variable's value takes effect when `grep-compute-defaults' is called.") +This variable's value takes effect when `grep-compute-defaults' is called." + :type `(choice + (const :tag "Use Grep" "grep") + (string :tag "User defined")) + :version "28.1") ;;;###autoload (defvar find-program (purecopy "find") diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index 180d779a78..e13c21bc07 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el @@ -150,15 +150,17 @@ semantic-symref-perform-search "-l ") ((eq (oref tool searchtype) 'regexp) "-nE ") - (t "-n "))) + (t (if (equal grep-program "rg") "" "-n ")))) (greppat (cond ((eq (oref tool searchtype) 'regexp) (oref tool searchfor)) (t ;; Can't use the word boundaries: Grep ;; doesn't always agree with the language ;; syntax on those. - (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" - (oref tool searchfor))))) + (if (equal grep-program "rg") + (oref tool searchfor) + (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" + (oref tool searchfor)))))) ;; Misc (b (get-buffer-create "*Semantic SymRef*")) (ans nil) --=-=-=--
Juri Linkov <juri@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#49836
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.