From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#31796: 27.1; dired-do-find-regexp-and-replace fails to find multiline regexps Date: Thu, 3 Dec 2020 04:23:32 +0200 Message-ID: References: <10120030-8b8d-b702-add4-8f099f934ed5@chalmers.se> <831rgivl7l.fsf@gnu.org> <83lfequ30g.fsf@gnu.org> <83a6v6tss9.fsf@gnu.org> <08c0bbce-051e-7a49-106a-d6d0629b2224@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38957"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: abela@chalmers.se, 31796@debbugs.gnu.org To: rms@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 03 03:24:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkeHz-0009zr-SH for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Dec 2020 03:24:11 +0100 Original-Received: from localhost ([::1]:36448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kkeHy-0003cx-Cg for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Dec 2020 21:24:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kkeHr-0003cZ-63 for bug-gnu-emacs@gnu.org; Wed, 02 Dec 2020 21:24:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54584) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kkeHq-0002wF-9h for bug-gnu-emacs@gnu.org; Wed, 02 Dec 2020 21:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kkeHq-0005GD-4z for bug-gnu-emacs@gnu.org; Wed, 02 Dec 2020 21:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Dec 2020 02:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31796 X-GNU-PR-Package: emacs Original-Received: via spool by 31796-submit@debbugs.gnu.org id=B31796.160696222420197 (code B ref 31796); Thu, 03 Dec 2020 02:24:02 +0000 Original-Received: (at 31796) by debbugs.gnu.org; 3 Dec 2020 02:23:44 +0000 Original-Received: from localhost ([127.0.0.1]:37897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkeHX-0005Fh-MB for submit@debbugs.gnu.org; Wed, 02 Dec 2020 21:23:43 -0500 Original-Received: from mail-ej1-f51.google.com ([209.85.218.51]:44129) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkeHW-0005FS-6r for 31796@debbugs.gnu.org; Wed, 02 Dec 2020 21:23:42 -0500 Original-Received: by mail-ej1-f51.google.com with SMTP id m19so1086635ejj.11 for <31796@debbugs.gnu.org>; Wed, 02 Dec 2020 18:23:42 -0800 (PST) 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=g8SMEZwvMHTTVbnM/FUPx15h4yqoR10K14KSjQsxd8M=; b=RLWkau3xZxWVuPpFHv6pqs440ZowSSrF7v/P/ROmiuPAP6k7vZ5/lqnmMsDm8gj/wI ADax0BVO9BuKRr47LnqL1Qs/pRLQIXZ867z+5EZIqdcVLG7TdpMx/N7OZ0f4y+7baNhq sBJlKYXxzVoHi1sHtqgWb7bHmTOtZk7PTyOzKe5K+Y9tW0gUShxwnow4glg3b6cFzyPc uvzbV56YVoY4QEjwRFfJ19a+SIU4aitepCESeXaTpo25fiXL9dSuDN6HC6mfLvkPvN3H zIV+ixueVxr6CN4qCqIqd3ByVbgoUTQGAiXJXgx9zxya62Mi5HswpDxxf4EKk89BNl5q DWag== 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=g8SMEZwvMHTTVbnM/FUPx15h4yqoR10K14KSjQsxd8M=; b=U+7M23HW3oqyn4lzKogQ2LGB2gK1AaHh2+NWyuFjeeD/gLmLASDbrysVgkXV75pskL JbaPy3CW4C+hsUvlUOUQUaj+KBaF4Zg66/1ilA31RUyMLPbMX05iU/E06CvMyfpxt+rB 2VpvPMXFqd3ETWkDEhruX7pXEnCAJzzRSLWm4g/eo1CYJ2ZAaIKvh9GsuawEQboOf996 qlYrbgi7k0UHiB+NudR7Sk6pi1l8YxRXDgbKK5lcKfbudVH1YSToGhGL9S0T7nrcqq4V CFm6OjGVtohV5UzLsvO1u/iznOEaCDDmenBBK1Wh9d0kZ5sw7dB7jDM46Ebd/+NePcD2 KPew== X-Gm-Message-State: AOAM530eXGAl5hX+IRXnJLtVuRMG5GZch90YnvrghY2Xoj1JtyLz7Inj tAoVyGeILHzymDP4jGzOTiGiz3/0X7MxWQ== X-Google-Smtp-Source: ABdhPJw5A6tHU7qCyxno4rOMeR1A6etKpyXpvXZ6gSbpz49xKRMAwIbaSxvAetielTI1IJkyHarAXw== X-Received: by 2002:a17:906:dd3:: with SMTP id p19mr623971eji.221.1606962216001; Wed, 02 Dec 2020 18:23:36 -0800 (PST) Original-Received: from [192.168.0.4] ([66.205.71.3]) by smtp.googlemail.com with ESMTPSA id k21sm111609edq.26.2020.12.02.18.23.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2020 18:23:35 -0800 (PST) In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:194843 Archived-At: On 01.12.2020 07:20, Richard Stallman wrote: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > > To sum up, there are options, but I don't see a working solution that is > > based on GNU Grep. > > Can people think of a new feature that would be easy to add to GNU grep > that would make it easy for Dired to handle all cases correctly? > > I don't know what the problem is, but if it has to do with parsing the > grep output, here's an idea: an option to tell GNU grep to use quoting > on file names and the match strings, Perhaps in the same way GNU ls > does. Grep already has that, more or less, with --null. pcregrep doesn't (which was my other example). What Grep could add, however, is a "multiline" matching mode similar to what pcregrep and ripgrep have. Meaning, it would allow matches to cross newlines (with certain rules on whether "." matches a newline) but without requiring the -z mode. So it would still report correct line numbers for the matches. > Another idea is an option to output numerical byte positions in the > file instead of the lines that are matched. Emacs can feed those byte > positions into byte-to-position to convert them into buffer positions. Like Eli said, that's -b. But considering Emacs would have to visit each file, to post-process the results with byte-to-position, this might turn out to be not much faster or easier to implement than simply visiting every file that (according to Grep) has matches and repeating the search in Emacs.