From unknown Sun Sep 07 16:50:55 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#59888 <59888@debbugs.gnu.org> To: bug#59888 <59888@debbugs.gnu.org> Subject: Status: [PATCH] Add 'grep-heading-mode' Reply-To: bug#59888 <59888@debbugs.gnu.org> Date: Sun, 07 Sep 2025 23:50:55 +0000 retitle 59888 [PATCH] Add 'grep-heading-mode' reassign 59888 emacs submitter 59888 Augusto Stoffel severity 59888 wishlist tag 59888 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 07 12:57:53 2022 Received: (at submit) by debbugs.gnu.org; 7 Dec 2022 17:57:53 +0000 Received: from localhost ([127.0.0.1]:51375 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2yg4-0005YG-PU for submit@debbugs.gnu.org; Wed, 07 Dec 2022 12:57:53 -0500 Received: from lists.gnu.org ([209.51.188.17]:58776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2yfz-0005YA-Sr for submit@debbugs.gnu.org; Wed, 07 Dec 2022 12:57:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2yfz-0004KY-Me for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 12:57:47 -0500 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p2yfu-0000Gi-ML for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 12:57:47 -0500 Received: by mail-ej1-x62d.google.com with SMTP id t17so15884539eju.1 for ; Wed, 07 Dec 2022 09:57:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=vHnNiD0wcr6SZMRx6FGhwkUdqZseopj12VQVnJd6v1Q=; b=S/Irjz++dIF9XQjj2uaC/0yyVrzoOPpe5MKozsFlZfFmRnR/UqDLIcuhrYN7nDOaqH Pgk6ByddM8KPxLyrKjZ7Ep3urT0U3PrpQhs4TW+s1wPqdunhw7AknFfPUespQatR/3rT Zndo6T93E31+Tt3s8xkGWgigBQgBDoARl/THal73InKCJxRMnjYu7EgQ7AbKq1cg/5PL pNFmPWXIi8AKtXQNqzMbEPtWD48rFZ8sN/umh00bKqNFWEQk8ANGfwM8VKD1Vx62baZq zLjen7IIoYfORO043MsptOgOPgeMLmuvJC49679YaBChacTIUxCBSI/9jtfdFbWbszCM B76Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vHnNiD0wcr6SZMRx6FGhwkUdqZseopj12VQVnJd6v1Q=; b=r3Jl7jSvXlqlw0hSlfQg7/ZfBRDEIlbcZHVrU5RGrnLjZi8MPr//73mOWDZu6TijHV uNxWPrBi9mxSBXqGfh8/ohRPJjHwlN8TGlc8BOfjZ4rXa8uupTj//dAPw/RCsevT0u3D JkPOmtGsd72PEj+ZGgqV8kQ/2wBvPbOt1JmLww3tP4YdJCYqeX4XRSHeFccBEvItuyjy 0+DPTvt1ctav/zY7hLQaO2AbKMvhbe5rNUlAnW+GL91fg2/5apo4RbMFNm5UrpYEneBI pG2oL5KQDAOjQWmyohij7hl2++otUUOKrvAWBgzFOEuy71hgtGYNYXxGfK22xdLyQm3q f0Bw== X-Gm-Message-State: ANoB5pmVOZgnKbQyMj5TKIM2kvQL1oQ3Z9/sBaQ8aY83sy5vz8DIOY9W C8e3t/cLqZ4fqeJb0zqoAeVtJd2u8Nw= X-Google-Smtp-Source: AA0mqf74yaXBkH47kOgJeOew5Jo8aubQ8hwugVxae6LBloOYKSt5kQ44GSxmfr7JUd2pfbekrlF8/g== X-Received: by 2002:a17:906:ee1:b0:78a:efde:b84a with SMTP id x1-20020a1709060ee100b0078aefdeb84amr77282403eji.744.1670435859992; Wed, 07 Dec 2022 09:57:39 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::a4bf]) by smtp.gmail.com with ESMTPSA id ck3-20020a0564021c0300b0046778ce5fdfsm2505081edb.10.2022.12.07.09.57.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 09:57:38 -0800 (PST) From: Augusto Stoffel To: bug-gnu-emacs@gnu.org Subject: [PATCH] Add 'grep-heading-mode' Date: Wed, 07 Dec 2022 18:57:37 +0100 Message-ID: <87v8mndrla.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=arstoffel@gmail.com; helo=mail-ej1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Tags: patch This simulates the --heading option of certain grep-like tools. The output is like this: --8<---------------cut here---------------start------------->8--- -*- mode: grep; default-directory: "~/Projects/emacs/" -*- Grep started at Wed Dec 7 18:43:40 find [...] -exec grep --color=auto -i -nH --null -e test \{\} + ./nextstep/Makefile.in 104: find ${ns_appdir} -exec test \! -e {} \; -ls ./nextstep/INSTALL 12:Tested on GNU/Linux, may work on other systems. ./nextstep/Makefile 104: find ${ns_appdir} -exec test \! -e {} \; -ls ./nextstep/README 62: 10.6.8 (Snow Leopard) to the latest official release. 86:* This allows other Emacs developers to test their changes on the NS --8<---------------cut here---------------end--------------->8--- --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Add-grep-heading-mode.patch >From 2247f006845000032fedc3dda9a073b14043a270 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Wed, 7 Dec 2022 18:44:07 +0100 Subject: [PATCH] Add 'grep-heading-mode' New minor mode to subdivide grep output into sections, as in the '--heading' option of certain grep-like programs. * lisp/progmodes/grep.el (grep-heading-regexp): New user option. (grep-heading): New face. (grep--heading-format, grep--current-heading, grep--heading-filter): Filter function for grep processes and supporting variables. (grep-heading-mode): New minor mode. --- etc/NEWS | 8 +++++ lisp/progmodes/grep.el | 71 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 3eeef0ab4c..54c3b2447a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -41,6 +41,14 @@ connection. * Changes in Specialized Modes and Packages in Emacs 30.1 +** Compile + +*** New minor mode 'grep-heading-mode'. +In this mode, the grep output is split into sections, one for each +file, instead of having file names prefixed to each line. It is +equivalent to the --heading option of some tools such as 'git grep' +and 'rg. + ** VC --- diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 2446e86abb..132f905734 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -30,6 +30,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'rx)) (require 'compile) (defgroup grep nil @@ -1407,6 +1408,76 @@ grep-file-at-point ;;;###autoload (defalias 'rzgrep #'zrgrep) +;;; Headings mode +(defcustom grep-heading-regexp + (rx bol + (or + (seq "Grep" (* (any "/a-zA-Z")) " " + (or "started" "finished" "exited" "interrupt" "killed" "terminated") + (* (not (any "\0\n")))) + (seq + (group-n 2 + (group-n 1 (+? any)) + (any "\0-:=")) + (+ digit) + (any "-:=")))) + "Regexp used to create headings from grep output lines. +It should be anchored at beginning of line. The first capture +group, if present, should match the heading associated to the +line. The buffer range of the second capture, if present, is +made invisible (presumably because displaying it would be +redundant)." + :type 'regexp + :version "30.1") + +(defface grep-heading '((t :inherit font-lock-function-name-face)) + "Face of headings when using `grep-heading-mode'.") + +(defvar grep--heading-format + #("\n%s\n" 1 3 (font-lock-face grep-heading outline-level 1)) + "Format string of grep headings. +This is passed to `format' with one argument, the text of the +first capture group of `grep-heading-regexp'.") + +(defvar-local grep--current-heading nil + "Used by `grep--heading-filter' to keep track of the current heading.") + +(defun grep--heading-filter () + "Filter function to add headings to output of a grep process." + (save-excursion + (let ((bound (copy-marker (pos-bol)))) + (goto-char compilation-filter-start) + (forward-line 0) + (while (re-search-forward grep-heading-regexp bound t) + (let ((heading (match-string-no-properties 1)) + (start (match-beginning 2)) + (end (match-end 2))) + (when start + (put-text-property start end 'invisible t)) + (when (and heading (not (equal heading grep--current-heading))) + (save-excursion + (forward-line 0) + (insert-before-markers (format grep--heading-format heading))) + (setq grep--current-heading heading))))))) + +;;;###autoload +(define-minor-mode grep-heading-mode + "Subdivide grep output into sections, one per file." + :interactive 'grep-mode + (if (not grep-heading-mode) + (recompile) + (save-excursion + (save-restriction + (widen) + (let ((inhibit-read-only t) + (compilation-filter-start (point-min))) + (goto-char (point-max)) + (grep--heading-filter)))) + (add-hook 'compilation-filter-hook #'grep--heading-filter 80 t) + (setq-local outline-search-function #'outline-search-level + outline-level (lambda () (get-text-property + (point) 'outline-level))))) + (provide 'grep) ;;; grep.el ends here -- 2.38.1 --=-=-= Content-Type: text/plain Some comments: 1. It's necessary to insert text into the grep buffer, which is a bit concerning because 'compilation-filter-start' is not a marker, just a number. This could cause other filter functions to get confused. This is why I'm adding to 'compilation-filter-hook at a higher depth. Perhaps there are better approaches here. 2. One could get rid of the awkward first alternative of `grep-heading-regexp' if there was a way to distringuish the grep process output from the header and footer added by grep-mode. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 07 13:14:25 2022 Received: (at 59888) by debbugs.gnu.org; 7 Dec 2022 18:14:25 +0000 Received: from localhost ([127.0.0.1]:51469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2yw5-0007zW-GM for submit@debbugs.gnu.org; Wed, 07 Dec 2022 13:14:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47830) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2yw2-0007zP-HD for 59888@debbugs.gnu.org; Wed, 07 Dec 2022 13:14:23 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2yvx-0004bU-7B; Wed, 07 Dec 2022 13:14:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=o0psrXlabQAJCKPhG8v17MxbsBb4fOcfSz1bAGX+5PI=; b=EjREj8dqJdQs AvlODgQJggAwZDhUXTrUL19WLtMjxsD8cfRC+a8R1rbo2onbXEYfLQVleIFsUOUF5lfL7TAB9KsEY CSkQ+IcfjZbz1ghLILO9gtMNvPYQI7iaZCtZKsI1OfDB7qaEKNnaFXh++N6EHRxIeV1hCYMHP+7sC mKXvEUb6Yet5UmX9e8BoqyFf5iAa1ZZ10YNdGgv4LIydB9gNMX4sodkF4kML2AfRvtwV32oxU1HB0 yzkgR+ZaYYJ1CcMZwDbIimk4uMukAvGGcvnWanubdpgwDCB/QQ1nV0pdicHsjPI3RH3W452yE30fO oJJGnqUG9EAc9OGk0h80Wg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2yvw-0003qH-LG; Wed, 07 Dec 2022 13:14:16 -0500 Date: Wed, 07 Dec 2022 20:14:06 +0200 Message-Id: <837cz33wup.fsf@gnu.org> From: Eli Zaretskii To: Augusto Stoffel In-Reply-To: <87v8mndrla.fsf@gmail.com> (message from Augusto Stoffel on Wed, 07 Dec 2022 18:57:37 +0100) Subject: Re: bug#59888: [PATCH] Add 'grep-heading-mode' References: <87v8mndrla.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Augusto Stoffel > Date: Wed, 07 Dec 2022 18:57:37 +0100 > > +(defcustom grep-heading-regexp > + (rx bol > + (or > + (seq "Grep" (* (any "/a-zA-Z")) " " > + (or "started" "finished" "exited" "interrupt" "killed" "terminated") Cannot these be translated to languages other than English in localized versions of Grep? > 2. One could get rid of the awkward first alternative of > `grep-heading-regexp' if there was a way to distringuish the grep > process output from the header and footer added by grep-mode. You could put a special text property on the latter, no? From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 07 19:19:41 2022 Received: (at 59888) by debbugs.gnu.org; 8 Dec 2022 00:19:41 +0000 Received: from localhost ([127.0.0.1]:53043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p34dY-0004xg-RT for submit@debbugs.gnu.org; Wed, 07 Dec 2022 19:19:41 -0500 Received: from mail-oa1-f45.google.com ([209.85.160.45]:42671) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p34dU-0004xZ-D9 for 59888@debbugs.gnu.org; Wed, 07 Dec 2022 19:19:39 -0500 Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-142b72a728fso75897fac.9 for <59888@debbugs.gnu.org>; Wed, 07 Dec 2022 16:19:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :from:to:cc:subject:date:message-id:reply-to; bh=qzi05pBzTOGDByLmEHGMuIOshfhQQMsi9wfjTaeF4rM=; b=V+8xIfZd1uaWG2woPLl7ZJupp04vXkLDgSrK3/Y+ifRYecjt1wkmMqJ5zdQ2USS2b2 PDWXiRRhgd3DMsxPTaWGeOBL8amAQcsPhtCyp/pNA78YOpGLBI13YK/NfMkDy2ay3mgb seddwJulxViV4ThRCK5mXrPNXBvraUmu8UxlxvRWcUJaMklQZDh5JTMfz2H6vxYnBA2c vycBdxVQnlOq216escUCCrp5HSSRcqoRY8rw73WAvW+ZglB0sGeLXI8VsTzfytUUeLqG jOf89u6KmbasDajeTecdRgqmzG6x3TLtlz0FGRd7o/cB7yCyIVhE6R44Smxid27PTlMQ m8Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qzi05pBzTOGDByLmEHGMuIOshfhQQMsi9wfjTaeF4rM=; b=vfykYeL+axXEnfUDVavyM+ikTYAl0WDwnBcSyk6Xz8shoMp/wq8wIz4YadqJcfWC3T NtL29oNE4UMkYWl7/K6F9xwIVj1CtlbOilcAJOws3dXZ44emK0VSVVF0fpRRxgyRSZCR vRm9T4kJMvwkesFYQEnXDSD7LNAOiwlDzaJLPH88QMZ+dRZEc7Ng6MLNsm6W8ASee2gL jQBW7zyCHRaW6Ry1a+tU6f/4nuQoUAGUolO3edGrzmdQw+NiM6OogZnLv7IcWKDs9QQ1 WemEE1Luc8DZ8KuJncdzqpPQ8g7yHxw709HSKdm4DOGB3/oXBEXuatj/UM35GPKttC92 PnCQ== X-Gm-Message-State: ANoB5pl6YdT2MOKPHnV0XgljI2il6/C+HhWQ3/BnK5Mom1UvKfRDroEt sxebjtrwNt0puqz+OzhtCQbyC9v4fGKXARuOmvc= X-Google-Smtp-Source: AA0mqf5ZDuLydfbAvGVx2ECzMYL+MhptgZEgI7uFQBuUNEYzDJFm1ujs2YLxVnWcAMJvfnI9QxUBzd/Mp1C1HMSMlHk= X-Received: by 2002:a05:6870:9e9a:b0:144:307b:c8d1 with SMTP id pu26-20020a0568709e9a00b00144307bc8d1mr14597667oab.92.1670458770787; Wed, 07 Dec 2022 16:19:30 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 7 Dec 2022 16:19:30 -0800 From: Stefan Kangas In-Reply-To: <87v8mndrla.fsf@gmail.com> References: <87v8mndrla.fsf@gmail.com> X-Hashcash: 1:20:221208:59888@debbugs.gnu.org::V5qCijSMpwzybXsQ:Az++ MIME-Version: 1.0 Date: Wed, 7 Dec 2022 16:19:30 -0800 Message-ID: Subject: Re: bug#59888: [PATCH] Add 'grep-heading-mode' To: Augusto Stoffel , 59888@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59888 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Augusto Stoffel writes: > From 2247f006845000032fedc3dda9a073b14043a270 Mon Sep 17 00:00:00 2001 > From: Augusto Stoffel > Date: Wed, 7 Dec 2022 18:44:07 +0100 > Subject: [PATCH] Add 'grep-heading-mode' > > New minor mode to subdivide grep output into sections, as in the > '--heading' option of certain grep-like programs. > > * lisp/progmodes/grep.el (grep-heading-regexp): New user option. > (grep-heading): New face. > (grep--heading-format, grep--current-heading, grep--heading-filter): > Filter function for grep processes and supporting variables. > (grep-heading-mode): New minor mode. How about making this into a defcustom instead of a minor mode? I'm thinking that something like (setopt grep-use-headings t) is a slightly simpler interface to use than (add-hook 'grep-mode-hook 'grep-heading-mode) I also think the former plays a bit better with customize. From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 08 04:00:01 2022 Received: (at 59888) by debbugs.gnu.org; 8 Dec 2022 09:00:01 +0000 Received: from localhost ([127.0.0.1]:55395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Cl6-0005za-OQ for submit@debbugs.gnu.org; Thu, 08 Dec 2022 04:00:01 -0500 Received: from mail-ej1-f46.google.com ([209.85.218.46]:36352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Cl1-0005zU-Hq for 59888@debbugs.gnu.org; Thu, 08 Dec 2022 03:59:59 -0500 Received: by mail-ej1-f46.google.com with SMTP id qk9so2324399ejc.3 for <59888@debbugs.gnu.org>; Thu, 08 Dec 2022 00:59:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=J/NrogAPqDMv8Tc9TRgMKdrkspJT6xRRa6ZRgW+f4t8=; b=fcujIMoyC6SDcckosr8j/akHQa4yAJegi91xMthA1K7yBl9DnDcY20O1ghjdD4KPFG KnqNDJdnjR9LWbxwrCUPQJgBrosHnOwfyaCFOeRyIWU17LhQusmLU/YbMxZYkxBqUIY4 fUA3svLCv5qWlIygar0YP+jnJ78tV5/l23XAevbVP9h+6yA/by8mVBdEX6WbRsMLrSdN shSK78i6clEs8QPrDxmaHAhXwO4BhAe3x5DAF2ZXF5DxfYI/X1FNtT4sUB7zhHSiX8qj zuEWQI2DDf5VW179sjeCBJJQG/ZZdzCuxVTYUkgSNXn836wkPAek8o8lqxsv3B3loq0E EqKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=J/NrogAPqDMv8Tc9TRgMKdrkspJT6xRRa6ZRgW+f4t8=; b=nVNJ7O09APlxEWthsUzaWFXxQTreaT8QML7PouuXdIBc4ZEe8mEd8Z9z1Cy47bVkpD Q7RJEQ2Yby5kuOIG1z5DV8ScLIqGfCtCKjuQxeugrU17wjMC+p6d/xl0Ls7Sr1oihWSo eczg1r/EjKH9FjHcyOnxnle4yJC8xGr9YtoVmFLON6xtDuMy360lELIC+NY7K3+yuPUX 7v8xUzFHDlilhzhTjqV+FIiYtB4TrrnWkcDgTG4ny0iESETCVFLqb7x3wArDmsybPpvY SVpOoF0PNgs5e47294X6oeevS0mGw5iiz6aXpyK0ZyI+z1n3I+XksUYz3mgjdOZBFjQh qQtQ== X-Gm-Message-State: ANoB5pmOjuuaryQ1ur2PoEpx95jsLjEepJXvXZGB3zyMAsa071fgZYcg TyIgfKU6krZnQjETXuLLYFaqDRNCROBUuw== X-Google-Smtp-Source: AA0mqf7MGiHi9gqCPweSgDtyLs2IdJTuB5bkcqhYJS07aMvqPTJfBKIs6+WlUFqK0ESkKOUlUs3dMA== X-Received: by 2002:a17:906:7c45:b0:7c0:c45c:90e4 with SMTP id g5-20020a1709067c4500b007c0c45c90e4mr21086032ejp.473.1670489988041; Thu, 08 Dec 2022 00:59:48 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::a4bf]) by smtp.gmail.com with ESMTPSA id kx24-20020a170907775800b007c127e1511dsm973324ejc.220.2022.12.08.00.59.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 00:59:47 -0800 (PST) From: Augusto Stoffel To: Eli Zaretskii Subject: Re: bug#59888: [PATCH] Add 'grep-heading-mode' In-Reply-To: <837cz33wup.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 07 Dec 2022 20:14:06 +0200") References: <87v8mndrla.fsf@gmail.com> <837cz33wup.fsf@gnu.org> Date: Thu, 08 Dec 2022 09:59:46 +0100 Message-ID: <87mt7ye0e5.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Wed, 7 Dec 2022 at 20:14, Eli Zaretskii wrote: >> From: Augusto Stoffel >> Date: Wed, 07 Dec 2022 18:57:37 +0100 >> >> +(defcustom grep-heading-regexp >> + (rx bol >> + (or >> + (seq "Grep" (* (any "/a-zA-Z")) " " >> + (or "started" "finished" "exited" "interrupt" "killed" "terminated") > > Cannot these be translated to languages other than English in > localized versions of Grep? AFAICT these messages are generated by Emacs itself. We could also use "^Grep[/a-zA-Z]* [^\0t\]*$" here, which has a slightly higher change of being confused with actual grep output, but only when not using grep --null. >> 2. One could get rid of the awkward first alternative of >> `grep-heading-regexp' if there was a way to distringuish the grep >> process output from the header and footer added by grep-mode. > > You could put a special text property on the latter, no? That's an option and it would be useful for other extensions as well. So we would define something like --8<---------------cut here---------------start------------->8--- (defun compilation-insert-note (&rest args) (let ((start (point))) (apply #'insert args) (put-text-property start (point) 'compilation-note t))) --8<---------------cut here---------------end--------------->8--- and use throughout compile.el, right? From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 08 04:07:11 2022 Received: (at 59888) by debbugs.gnu.org; 8 Dec 2022 09:07:11 +0000 Received: from localhost ([127.0.0.1]:55431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Cs2-00065K-U0 for submit@debbugs.gnu.org; Thu, 08 Dec 2022 04:07:11 -0500 Received: from mail-ej1-f46.google.com ([209.85.218.46]:33360) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Cry-00064x-C3 for 59888@debbugs.gnu.org; Thu, 08 Dec 2022 04:07:09 -0500 Received: by mail-ej1-f46.google.com with SMTP id n20so2431413ejh.0 for <59888@debbugs.gnu.org>; Thu, 08 Dec 2022 01:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=EcQ7ynBm0/ol/v+JTbagyfLTLSZfegQp/SKfGcG78BY=; b=Jgm4sHNO3o+94I0P0tDqoWOCAaExet3911B9LaKvE2brh2NZ9l7JU6V03MzbBpchUi qVmzzy2/dtazMjCgrrhOglTNtsWckXNLAPhjd/s6H1xNzyNRbgJGS2p7kCyOduAcxXjn 7rB5CEjngwreLTMEOnbeHnkX/SaDBzrn/lY3ZSoPjijeGr95NuewdFYqWM84aBnFF3rn XfUMkaA95TCKQk91Hc5Ru5WgVIegpfJoHX0YgJ7m5A+QUMBwByBGHBvU+UVUDNFD1AZQ hDW07iEx9wzFwXriaWYqJIfwLziu2MkkKjfoA8ONb3CzWt8Fu5c0qNlxUVu6aJm1y9vN NyFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EcQ7ynBm0/ol/v+JTbagyfLTLSZfegQp/SKfGcG78BY=; b=dOqEQtyaCLQCYTgA7mpL0T8fzqfWM5hQ8XL4AC1Og9KlQ7Ef+Hujz/TRIn7trq5gqu oug9SYeGwz/RLgCBSsUbeGrJVRXDusvI9MKHwi/pwq1kStxEUeq+wYiYn83qGHl0g5Gq ru6OFwZnkMfETD2X3Fzp0Mj9ksEZ7iXolAk9wVd9NfYye9DsDxylqNW1AuHjdNtOKaeS gRlwsC/xYb0HO4cETYbOWXxXEExydlIi3PJHUNArtObfzldj3MgwVDhLpT4KEtkoM09m bqC7x1hUlpLhwhLpY5ifQFssYRtPx01TEhzj1YzprTybhpV7nzHRqDpv33nQ+YkuBpB/ Xvrw== X-Gm-Message-State: ANoB5plgp/8oiEwHbnM6/PKNeQRcO/vK9tuaAT7HhLIutj5oS7f300RA dU0w+4DquypXUIbg3ui2OU6OGKDQ8G5CuA== X-Google-Smtp-Source: AA0mqf6enP9puISx/xx3ykaknyO46zpcyiaUhmGKBUk8Dy2SuD0q2v43crwUJCEEoBfxCb9UM5DKGA== X-Received: by 2002:a17:906:a019:b0:7be:e774:5aad with SMTP id p25-20020a170906a01900b007bee7745aadmr29604430ejy.426.1670490420034; Thu, 08 Dec 2022 01:07:00 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::a4bf]) by smtp.gmail.com with ESMTPSA id p10-20020a170906838a00b007c0dacbe00bsm5830746ejx.115.2022.12.08.01.06.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 01:06:59 -0800 (PST) From: Augusto Stoffel To: Stefan Kangas Subject: Re: bug#59888: [PATCH] Add 'grep-heading-mode' In-Reply-To: (Stefan Kangas's message of "Wed, 7 Dec 2022 16:19:30 -0800") References: <87v8mndrla.fsf@gmail.com> Date: Thu, 08 Dec 2022 10:06:58 +0100 Message-ID: <87ilime025.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Wed, 7 Dec 2022 at 16:19, Stefan Kangas wrote: > Augusto Stoffel writes: > >> From 2247f006845000032fedc3dda9a073b14043a270 Mon Sep 17 00:00:00 2001 >> From: Augusto Stoffel >> Date: Wed, 7 Dec 2022 18:44:07 +0100 >> Subject: [PATCH] Add 'grep-heading-mode' >> >> New minor mode to subdivide grep output into sections, as in the >> '--heading' option of certain grep-like programs. >> >> * lisp/progmodes/grep.el (grep-heading-regexp): New user option. >> (grep-heading): New face. >> (grep--heading-format, grep--current-heading, grep--heading-filter): >> Filter function for grep processes and supporting variables. >> (grep-heading-mode): New minor mode. > > How about making this into a defcustom instead of a minor mode? > > I'm thinking that something like > > (setopt grep-use-headings t) > > is a slightly simpler interface to use than > > (add-hook 'grep-mode-hook 'grep-heading-mode) > > I also think the former plays a bit better with customize. This is at the same time less customizable in the sense that something like (add-hook 'grep-mode-hook (lambda () (when condition) (setq grep-use-headings t))) will not work (I think), while conditionally activating a minor mode certainly works. But I'm open to both approaches. From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 08 04:58:14 2022 Received: (at 59888) by debbugs.gnu.org; 8 Dec 2022 09:58:14 +0000 Received: from localhost ([127.0.0.1]:55712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3DfS-00083z-28 for submit@debbugs.gnu.org; Thu, 08 Dec 2022 04:58:14 -0500 Received: from mail1443c50.megamailservers.eu ([91.136.14.43]:50956 helo=mail264c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3DfO-00083r-3d for 59888@debbugs.gnu.org; Thu, 08 Dec 2022 04:58:12 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1670493483; bh=rkcdFcUpqgpDCvmjn7gu0F7CZA2T1S7DGne+CV7CJY8=; h=From:Subject:Date:Cc:To:From; b=sxeSImFfvE/Tuoe42MaLxg71dGJrTuz4GbI8cJXyaRMkhO0qq9hCLUVCGBNNnSRJf dX9gC9u/V3erTkdsyqg+1Os4e7mWiJEFs5Ych2IWALsrTvWveUt7QXDwtUxSoJbEq1 45uWAyNqqS5ZsUrKY2UrUoro5unO0ScHzyf2P6bY= Feedback-ID: mattiase@acm.or Received: from smtpclient.apple (c188-150-171-209.bredband.tele2.se [188.150.171.209]) (authenticated bits=0) by mail264c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 2B89w0d9071551; Thu, 8 Dec 2022 09:58:01 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: bug#59888: [PATCH] Add 'grep-heading-mode' Message-Id: <9DED6125-13ED-4BF6-83A1-E1B2C4249F24@acm.org> Date: Thu, 8 Dec 2022 10:57:59 +0100 To: Augusto Stoffel X-Mailer: Apple Mail (2.3654.120.0.1.13) X-CTCH-RefID: str=0001.0A782F27.6391B52B.0010, 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-Origin-Country: SE X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) No argument about the idea (good to me) or implementation but minor = points regarding the regexp: > + (group-n 1 (+? any)) Very much prefer `nonl` or `not-newline` to `any`, which is only there = for compatibility (shouldn't have been included in the first place). > + (any "\0-:=3D")) Is the range (ASCII 00..1A) intended here, or should that be a literal = hyphen? If the former, it should probably be made more explicit since that range = includes all sorts of numbers, symbols and control chars and it kind of = looks like it may be a mistake. From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 08 05:29:06 2022 Received: (at 59888) by debbugs.gnu.org; 8 Dec 2022 10:29:06 +0000 Received: from localhost ([127.0.0.1]:55903 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3E9K-0008Pt-7D for submit@debbugs.gnu.org; Thu, 08 Dec 2022 05:29:06 -0500 Received: from mail-ej1-f47.google.com ([209.85.218.47]:42643) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3E9I-0008PN-3S for 59888@debbugs.gnu.org; Thu, 08 Dec 2022 05:29:04 -0500 Received: by mail-ej1-f47.google.com with SMTP id n21so2772943ejb.9 for <59888@debbugs.gnu.org>; Thu, 08 Dec 2022 02:29:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CnFPYfPYVCBiXm3Jltcch1lsEefLy/bJ+nOVfNlJFNY=; b=e9LfHEiEGJc2FrE19KWR1AcTe38mpPCbUj6K6t9tvWrtDKmJIVPbXpy4MLRmDM2AAf ANCCEMzBOpTOd2sQU/F+YunBEVKnfB5XYZfAx3AgAG0hAITBFIR+hTJDnUK4Yhu99zLY SHwkMu8TDxpziMzaiZqC//kk4nXQJ95GgFyp/WXE2ou/zYTrBPHDNq9Ww1S+vffjE7gO c+3SJUacK9vUBuKp5Cf/M+cojp3YkjsWU+l26NOrwNcsUUwHcaXgKX2lbfRhyRahBW5s 3bgwC398GJ6hsMbkZKtk3fJFF4kit6rp45uBTaTvw2UplRGirTVECgAUuEDdBj0LWG/B I9VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CnFPYfPYVCBiXm3Jltcch1lsEefLy/bJ+nOVfNlJFNY=; b=a9h+B+XMUYm3LQ1IcpSyzsLQnWxdz9sRouxScr+xXNbusiHGgu/t3U9ifJ6uccnh9Z CzawDGE9WYgSWtg1f0c5Q25mDwnMFW0x2Pz2Og2R6Uo+xpoFgjTL6BfHI2OOdOUNPd0g akee918gSJTVdMQnzALj7LNA1VJ+5rIbzDFb1B9vCuNiTFd19mXKPTk9TRDzviMHgfgx wuwZluro2tne/u5HkN7vV1/udoyS5Sgv0DLE+Q/zeXZ8DL1BIf0+wYI6OKGk7lKhiVal 2RiChT42BoSX6CQsdGciq+/kXOcmqWdGWMA3jPN8BYdLExa5E83ekr8ElpVMzlzA3wIF B7+A== X-Gm-Message-State: ANoB5pmvUUck1L6aHSozYhzYC4gaE109fnNzX8yNwaXvmdQ5hRSfJWCv HQ/Sq63Q4WovCuXVMT+ci+cYojzvQV/2BA== X-Google-Smtp-Source: AA0mqf410xXGReoMfLl6eHGO5tAmSAii/TErELdCCjghnjGJYYs8JXw3AK/b7QixJKhhb91tgWvPCg== X-Received: by 2002:a17:907:7613:b0:7c1:5a7:b91c with SMTP id jx19-20020a170907761300b007c105a7b91cmr9423584ejc.749.1670495337739; Thu, 08 Dec 2022 02:28:57 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::a4bf]) by smtp.gmail.com with ESMTPSA id ce11-20020a170906b24b00b007ae38d837c5sm9608245ejb.174.2022.12.08.02.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 02:28:56 -0800 (PST) From: Augusto Stoffel To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Subject: Re: bug#59888: [PATCH] Add 'grep-heading-mode' In-Reply-To: <9DED6125-13ED-4BF6-83A1-E1B2C4249F24@acm.org> ("Mattias =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Thu, 8 Dec 2022 10:57:59 +0100") References: <9DED6125-13ED-4BF6-83A1-E1B2C4249F24@acm.org> Date: Thu, 08 Dec 2022 11:28:55 +0100 Message-ID: <87edtadw9k.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Thu, 8 Dec 2022 at 10:57, Mattias Engdeg=C3=A5rd wrote: > No argument about the idea (good to me) or implementation but minor point= s regarding the regexp: > >> + (group-n 1 (+? any)) > > Very much prefer `nonl` or `not-newline` to `any`, which is only there fo= r compatibility (shouldn't have been included in the first place). Hum, not-newline is too long, so this leaves an option between the slightly deceiving and the quite obscure. Okay, now I see `any' is not even documented. >> + (any "\0-:=3D")) > > Is the range (ASCII 00..1A) intended here, or should that be a literal hy= phen? > If the former, it should probably be made more explicit since that > range includes all sorts of numbers, symbols and control chars and it > kind of looks like it may be a mistake. The literal hyphen, which prefixes context lines in `grep -C '. Thanks for the heads up. From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 08 05:48:26 2022 Received: (at 59888) by debbugs.gnu.org; 8 Dec 2022 10:48:26 +0000 Received: from localhost ([127.0.0.1]:55984 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3ERw-0000D5-TA for submit@debbugs.gnu.org; Thu, 08 Dec 2022 05:48:26 -0500 Received: from mail203c50.megamailservers.eu ([91.136.10.213]:40702 helo=mail193c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3ERt-0000Cz-Oc for 59888@debbugs.gnu.org; Thu, 08 Dec 2022 05:48:19 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1670496495; bh=q14tXvqGFG3h8xVo5bVUxtJhUdLxXSZZw68a3mKCFKk=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=gYU0oVj9aP67iMoJAzzKfjUImvyN+9lvZsfH+RinawgeyhKYW7zXmDYrUpNeYhqOC j7C5Etu6HDJNBsT1Gvay1JQYRWJY7HmVQKoaPOKHHO3NSfGguRrEXJ8HHXb2ujQeD8 5U+GXWnG4gnXU3MFdzxkNDstN5N0zn5UTwDGo0vQ= Feedback-ID: mattiase@acm.or Received: from smtpclient.apple (c188-150-171-209.bredband.tele2.se [188.150.171.209]) (authenticated bits=0) by mail193c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 2B8AmDYT033718; Thu, 8 Dec 2022 10:48:15 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: bug#59888: [PATCH] Add 'grep-heading-mode' From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: <87edtadw9k.fsf@gmail.com> Date: Thu, 8 Dec 2022 11:48:13 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <9E8F141A-B8FF-46ED-9C9D-5F11FA9CC243@acm.org> References: <9DED6125-13ED-4BF6-83A1-E1B2C4249F24@acm.org> <87edtadw9k.fsf@gmail.com> To: Augusto Stoffel X-Mailer: Apple Mail (2.3654.120.0.1.13) X-CTCH-RefID: str=0001.0A782F25.6391C0EF.0057, 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-Origin-Country: SE X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) 8 dec. 2022 kl. 11.28 skrev Augusto Stoffel : >> Very much prefer `nonl` or `not-newline` to `any`, which is only = there for compatibility (shouldn't have been included in the first = place). >=20 > Hum, not-newline is too long, so this leaves an option between the > slightly deceiving and the quite obscure. Actually `nonl` isn't too bad once you get used to it. Pronounce it = 'nonnel', stress on the first syllable. > Okay, now I see `any' is not even documented. Yes, it was inherited from the defunct `sregex` package, in hindsight a = clear mistake. From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 08 05:58:16 2022 Received: (at 59888) by debbugs.gnu.org; 8 Dec 2022 10:58:16 +0000 Received: from localhost ([127.0.0.1]:56036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3EbX-0000KI-W7 for submit@debbugs.gnu.org; Thu, 08 Dec 2022 05:58:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43992) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3EbW-0000KA-ON for 59888@debbugs.gnu.org; Thu, 08 Dec 2022 05:58:15 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3EbR-0000X1-D6; Thu, 08 Dec 2022 05:58:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=S8nlamNELQqpaVbxb7uHtUsU5w1+v3A8ld1lgUwUfaU=; b=Tz6NxsXxZ9AB W0m9oPV4yNzMUztKGz0kdi5r/fMYQH8Nvu7AkPgfRguWRQaYrgQia/NKI8oQYNfjoHCpj91R29K4u Pz8MUIfcwJu6AZ78cmf1uCA78eOlG+gSXzHB1eCZ27HNdqhNiMnAbYOM+7FPGWwsR8QsVabYjpuCc d6DjGg2hd+4SpQesfCXcgps/00kFtrj2CDE3pt5aUFuvGgHv9dNBQ9d5N30JyQG5Vi/Gr5awiRUDe 0tZ3pDeqDsP3XwN/YSw2MkyRCl55+sP6OUazg5OeRPTIEOwcVaLZYHAhOFOUiWAMJfPCfcDvn9DLR vNhN6HDD+YEaX2DMfns3cg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3EbQ-00054t-OJ; Thu, 08 Dec 2022 05:58:09 -0500 Date: Thu, 08 Dec 2022 12:57:59 +0200 Message-Id: <83leni2mdk.fsf@gnu.org> From: Eli Zaretskii To: Augusto Stoffel In-Reply-To: <87mt7ye0e5.fsf@gmail.com> (message from Augusto Stoffel on Thu, 08 Dec 2022 09:59:46 +0100) Subject: Re: bug#59888: [PATCH] Add 'grep-heading-mode' References: <87v8mndrla.fsf@gmail.com> <837cz33wup.fsf@gnu.org> <87mt7ye0e5.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Augusto Stoffel > Cc: 59888@debbugs.gnu.org > Date: Thu, 08 Dec 2022 09:59:46 +0100 > > On Wed, 7 Dec 2022 at 20:14, Eli Zaretskii wrote: > > >> From: Augusto Stoffel > >> Date: Wed, 07 Dec 2022 18:57:37 +0100 > >> > >> +(defcustom grep-heading-regexp > >> + (rx bol > >> + (or > >> + (seq "Grep" (* (any "/a-zA-Z")) " " > >> + (or "started" "finished" "exited" "interrupt" "killed" "terminated") > > > > Cannot these be translated to languages other than English in > > localized versions of Grep? > > AFAICT these messages are generated by Emacs itself. All of them? > We could also use "^Grep[/a-zA-Z]* [^\0t\]*$" here The [/a-zA-Z] part is still ASCII-only, and I believe the "/" part means you want to support file names? then for Windows we also need the colon ':'. > >> 2. One could get rid of the awkward first alternative of > >> `grep-heading-regexp' if there was a way to distringuish the grep > >> process output from the header and footer added by grep-mode. > > > > You could put a special text property on the latter, no? > > That's an option and it would be useful for other extensions as well. > So we would define something like > > --8<---------------cut here---------------start------------->8--- > (defun compilation-insert-note (&rest args) > (let ((start (point))) > (apply #'insert args) > (put-text-property start (point) 'compilation-note t))) > --8<---------------cut here---------------end--------------->8--- > > and use throughout compile.el, right? Yes, something like this. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 09 02:43:37 2022 Received: (at 59888) by debbugs.gnu.org; 9 Dec 2022 07:43:37 +0000 Received: from localhost ([127.0.0.1]:34352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Y2j-00049L-DS for submit@debbugs.gnu.org; Fri, 09 Dec 2022 02:43:37 -0500 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:32797) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Y2h-000490-HF for 59888@debbugs.gnu.org; Fri, 09 Dec 2022 02:43:36 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 1549724000E; Fri, 9 Dec 2022 07:43:27 +0000 (UTC) From: Juri Linkov To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-heading-mode' In-Reply-To: <87ilime025.fsf@gmail.com> (Augusto Stoffel's message of "Thu, 08 Dec 2022 10:06:58 +0100") Organization: LINKOV.NET References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> Date: Fri, 09 Dec 2022 09:23:46 +0200 Message-ID: <86359pm55x.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59888 Cc: Stefan Kangas , 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> How about making this into a defcustom instead of a minor mode? >> >> I'm thinking that something like >> >> (setopt grep-use-headings t) >> >> is a slightly simpler interface to use than >> >> (add-hook 'grep-mode-hook 'grep-heading-mode) >> >> I also think the former plays a bit better with customize. > > This is at the same time less customizable in the sense that something > like > > (add-hook 'grep-mode-hook > (lambda () (when condition) (setq grep-use-headings t))) > > will not work (I think), while conditionally activating a minor mode > certainly works. But I'm open to both approaches. Why not? (setq-local grep-use-headings t) definitely should do the right thing. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 09 02:43:40 2022 Received: (at 59888) by debbugs.gnu.org; 9 Dec 2022 07:43:41 +0000 Received: from localhost ([127.0.0.1]:34355 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Y2m-00049a-Lq for submit@debbugs.gnu.org; Fri, 09 Dec 2022 02:43:40 -0500 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:45845) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Y2l-000498-GC for 59888@debbugs.gnu.org; Fri, 09 Dec 2022 02:43:39 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 81CBF1BF205; Fri, 9 Dec 2022 07:43:31 +0000 (UTC) From: Juri Linkov To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-heading-mode' In-Reply-To: <87v8mndrla.fsf@gmail.com> (Augusto Stoffel's message of "Wed, 07 Dec 2022 18:57:37 +0100") Organization: LINKOV.NET References: <87v8mndrla.fsf@gmail.com> Date: Fri, 09 Dec 2022 09:28:53 +0200 Message-ID: <86bkodkpwa.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > Subject: [PATCH] Add 'grep-heading-mode' > > New minor mode to subdivide grep output into sections, as in the > '--heading' option of certain grep-like programs. > > * lisp/progmodes/grep.el (grep-heading-regexp): New user option. > (grep-heading): New face. > (grep--heading-format, grep--current-heading, grep--heading-filter): > Filter function for grep processes and supporting variables. > (grep-heading-mode): New minor mode. Thanks, this would be a great addition. > +(defface grep-heading '((t :inherit font-lock-function-name-face)) > + "Face of headings when using `grep-heading-mode'.") I suggest to keep the existing color scheme, thus inheriting from compilation-info. This is the same color used by both grep.el and xref.el by default. > +(defvar grep--heading-format > + #("\n%s\n" 1 3 (font-lock-face grep-heading outline-level 1)) xref.el doesn't insert extra newlines between file sections. It would be nice to keep the output closer to the existing output in xref buffers. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 09 06:58:16 2022 Received: (at 59888) by debbugs.gnu.org; 9 Dec 2022 11:58:16 +0000 Received: from localhost ([127.0.0.1]:35594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3c19-0006rO-P7 for submit@debbugs.gnu.org; Fri, 09 Dec 2022 06:58:15 -0500 Received: from mail-ed1-f54.google.com ([209.85.208.54]:34749) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3c18-0006rI-B6 for 59888@debbugs.gnu.org; Fri, 09 Dec 2022 06:58:14 -0500 Received: by mail-ed1-f54.google.com with SMTP id z92so2805242ede.1 for <59888@debbugs.gnu.org>; Fri, 09 Dec 2022 03:58:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=mlplh21vavVE56soxpFyNMY6+IbXh3aKNJy77LXOhi0=; b=Awe32FzA4CcW1lOvxk7defWNCsvUf1EBArLCXfyOZ/+LB7GoDB3Rc0Wdzd+bIvOJHe lfAh4Vz0IakWieEazVV1mPRsHHWVCDrY3uW2DbJKHRN+EOfukaFcTG6eAFedu6EzSMKk Y9llCs2d89Yverg3wg2mNWvo0sHP69OzMDaED+WkaXN3+JhEkfNbWXx9WVTaEe5dyCCO uFrbbxmJP1XdpWyTVEr5KzUTDXiJkG2a0OPLES3bruYCo7Y6MgCcC37OvvXmo+hJ4shn LNNzVCBjPFfGTvl7xj60WggYjM9Rv1iXF56JEbw1rlOtJ/+r5XrMSFGec+sEnHarCWm0 6Pvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mlplh21vavVE56soxpFyNMY6+IbXh3aKNJy77LXOhi0=; b=gMODjRYp0qzRLEO6+hVf+r/HxmXd+ex5C0o6hr5WtFIptD9YCZ57WycJwN8DyiPO7V soqq/HQ4qXJ2pS5wSQpE2k1nD5c+CadHQncay7kO083SbyiJeKnVxjuJGuoOFhoMSgfr QJ+AbUe6tunjqfeX/2EQluhGhJ9fVWd3TPHwHZzbkqeQcnS+0dCbMzVYLFo8HgEwMOQI aLWErU/UTTDIO6o1hnnEkLP/0VnRnUdT/kWPwZgIdMIsE17zYophckteNvOBKTd/LWe1 UuOzwX6yAJzy/EnGNFFI1S3uxtqIiCHozeplMLaA0FKz2kCT0luNFTSOXhOusvzJKhvn i1VA== X-Gm-Message-State: ANoB5pmqnIe1EQjSEJYy/Rg5CWzMyZK64AepdKT1dwdNaIuXa3etAS6e SJICn/JVqzjtn+UXSQZkkpNrIKQaiv767w== X-Google-Smtp-Source: AA0mqf7giFZXj5mPGuzq+SyA5Ymai1b/HnmrM7mU+73XzS94GIR8zSHmY5hdjaaI0uG9rRSCexqBZQ== X-Received: by 2002:a50:fb0a:0:b0:46a:878c:3325 with SMTP id d10-20020a50fb0a000000b0046a878c3325mr4824151edq.36.1670587088075; Fri, 09 Dec 2022 03:58:08 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::a4bf]) by smtp.gmail.com with ESMTPSA id z4-20020aa7c644000000b0046b471596e6sm542227edr.57.2022.12.09.03.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 03:58:07 -0800 (PST) From: Augusto Stoffel To: Juri Linkov Subject: Re: bug#59888: [PATCH] Add 'grep-heading-mode' In-Reply-To: <86359pm55x.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 09 Dec 2022 09:23:46 +0200") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> Date: Fri, 09 Dec 2022 12:58:06 +0100 Message-ID: <87359oeqlt.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: Stefan Kangas , 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, 9 Dec 2022 at 09:23, Juri Linkov wrote: >>> How about making this into a defcustom instead of a minor mode? >>> >>> I'm thinking that something like >>> >>> (setopt grep-use-headings t) >>> >>> is a slightly simpler interface to use than >>> >>> (add-hook 'grep-mode-hook 'grep-heading-mode) >>> >>> I also think the former plays a bit better with customize. >> >> This is at the same time less customizable in the sense that something >> like >> >> (add-hook 'grep-mode-hook >> (lambda () (when condition) (setq grep-use-headings t))) >> >> will not work (I think), while conditionally activating a minor mode >> certainly works. But I'm open to both approaches. > > Why not? (setq-local grep-use-headings t) definitely should do > the right thing. The variable has to be set at the moment `grep-mode' runs, while a minor mode could be set at a later point. But I agree a variable is sufficient here, so I will make this change. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 09 06:58:59 2022 Received: (at 59888) by debbugs.gnu.org; 9 Dec 2022 11:58:59 +0000 Received: from localhost ([127.0.0.1]:35600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3c1r-0006rh-3G for submit@debbugs.gnu.org; Fri, 09 Dec 2022 06:58:59 -0500 Received: from mail-ed1-f50.google.com ([209.85.208.50]:43000) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3c1p-0006rb-As for 59888@debbugs.gnu.org; Fri, 09 Dec 2022 06:58:57 -0500 Received: by mail-ed1-f50.google.com with SMTP id a16so2770827edb.9 for <59888@debbugs.gnu.org>; Fri, 09 Dec 2022 03:58:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=l2njeQq8cw9YewUrDKlLSPOAyaewxnDnlXJGDUe516s=; b=nZHCwLcmypMmrcWZ4lEoO48pQcBNZG2CuGGL/QGkwumWrglUlCwwQ8KGfL1p/iHTde bVoAS1B+z2EoD+XEWT3MlnrOa8T4eij3PFnUJAlXjidoaycSwXePVJeuE8tzuc6HRtch VNFN5MoKUq7nGfxrAWK9FDwWe8TSKoUTnuYbAonfKSnvXZ0ZIftqwZ0Q8Spv8biul6y7 jrlD7AiW0gLYenwh/8L0C1H2m/g/1ebU1N9zZcZcLa+aqKei0zsEBe5l+9/xnjA3M7cX 6vmDN0bUGq1E3WIgcH8RM7VqcfNtaBXwg8Xzn9lXhaCJ9iN4nseCVyu/LS9u1ejH6zHy lHsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=l2njeQq8cw9YewUrDKlLSPOAyaewxnDnlXJGDUe516s=; b=Y20dffHAhq+lx/gxcIfv1BghsEwy6odPInvtHi72kg7WMd9fjs8Td7rSjH7DmKW0um ytgMcjTK4h6+T0ixXeXc6ftzUJJV+WNVK5pi+guj8lPI+mEyQGiNi9YFqY0vbuDfCMS7 kRJaTuHABEpDE7RFT45J3Vl0teXo/BfcHlv6J6l7AwCt2HJOBtoCmEwFl1d39iV2RW6C 0yrYdbwF8QMhb8mqjwyDs0e7R6+UzLuioDoC56PdLLMVfIz5lIsTtIMd8bFsNg0FbqaS OT1sDMr5EinBdLCl0+nGKBhDjxgsXYtR59VPkkvo7QlrfytUMbGNhTlkTrv1BJlRiJe5 hpKw== X-Gm-Message-State: ANoB5pl2hHmQ71yg2Ua4dDmfegW7mfKn7dOCfXlXCRWhVGmWvejVMDCN MypjrLufSMzarbEJSeLgqSHhB3yrxJ7qsQ== X-Google-Smtp-Source: AA0mqf4Y/JYHJukR6qvHu1DPFAYpkHGXAO7tCmrsJd+Ls9LWtjvqu6Tm9u5TIC/UwQEZhlfVXzKJKA== X-Received: by 2002:a05:6402:4442:b0:45c:835b:944f with SMTP id o2-20020a056402444200b0045c835b944fmr5009125edb.11.1670587131306; Fri, 09 Dec 2022 03:58:51 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::a4bf]) by smtp.gmail.com with ESMTPSA id s5-20020a170906bc4500b007c0deb2449fsm480963ejv.82.2022.12.09.03.58.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 03:58:50 -0800 (PST) From: Augusto Stoffel To: Juri Linkov Subject: Re: bug#59888: [PATCH] Add 'grep-heading-mode' In-Reply-To: <86bkodkpwa.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 09 Dec 2022 09:28:53 +0200") References: <87v8mndrla.fsf@gmail.com> <86bkodkpwa.fsf@mail.linkov.net> Date: Fri, 09 Dec 2022 12:58:49 +0100 Message-ID: <871qp8eqkm.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, 9 Dec 2022 at 09:28, Juri Linkov wrote: >> +(defface grep-heading '((t :inherit font-lock-function-name-face)) >> + "Face of headings when using `grep-heading-mode'.") > > I suggest to keep the existing color scheme, thus inheriting from > compilation-info. This is the same color used by both grep.el and > xref.el by default. Yes, I came to the same conclusion in the meanwhile. >> +(defvar grep--heading-format >> + #("\n%s\n" 1 3 (font-lock-face grep-heading outline-level 1)) > > xref.el doesn't insert extra newlines between file sections. > It would be nice to keep the output closer to the existing > output in xref buffers. Okay, I agree with your reasoning and will make the change. However, I must say find the result less appealing. Note that, because of the lack of newlines, xref-file-header was naturally chosen as a heavier face. But it's all customizable anyway. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 09 07:18:13 2022 Received: (at 59888) by debbugs.gnu.org; 9 Dec 2022 12:18:13 +0000 Received: from localhost ([127.0.0.1]:35699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3cKS-00072y-MG for submit@debbugs.gnu.org; Fri, 09 Dec 2022 07:18:13 -0500 Received: from mail-ed1-f43.google.com ([209.85.208.43]:43713) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3cKR-00072s-5Y for 59888@debbugs.gnu.org; Fri, 09 Dec 2022 07:18:11 -0500 Received: by mail-ed1-f43.google.com with SMTP id r26so2826021edc.10 for <59888@debbugs.gnu.org>; Fri, 09 Dec 2022 04:18:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=wys6ypfiGBSSkiwBnVRf/QJhWbJHBqE3Rj5pkWBIrH4=; b=k7aE3HSsvmiYa3fMg3M4p9Z6XlBZD1eAs2niRU/vcF88Ch9jFWEZrG92AbN6CHEjSw ePSwG1tacPqBTAFq85x29hyf6VEC0cxjFDZRJQdyf5djK9l+ZrQUUzVg554QXT4cBx68 J+fp2LF3cvhpaSiT0aolF5D5shBPrKUxAuUv5AamzhgGSTBcVzCD7RmAY5KctBTPA2ts vEO53yAq5ONb2uak9ioCml6NAHlAQmZKDdNBl+K8zgjhlAuz/XErpe/wyg2n353bpCsz ZvZiHVs9HF8XrkoAAMh4gltPiC3JA+s0f+a1Ba3Jec0J0WpaekTChArDPXy6DVZes3Ij oGCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wys6ypfiGBSSkiwBnVRf/QJhWbJHBqE3Rj5pkWBIrH4=; b=TG/zuQOvUurhdZpOily2nfkzVhPOCrvmA817EXHnu2boM0bLmd8clSDRh8cuOH3zG2 74+ZVQBZW3QBdLByKegcDLJSnR+wH6N2Uu7zKjyIgarUFNi+02a1Yc6hdQQUOFxgEPRp RhGixJN287ggM3TMMOfC9t6FRHPjwgNMo1L2Ml6fSW33e6uXRA9K+g195I4/ltKRVNtq 0cDjQg4m9HNDEXI7w1fojpAYH5yel+K9W4LhRA6yOZhx9TIIq6M8+ro+hetcfvovmh9X E6VwZAqn5hLmKhgWUOjKY6RdxJVSN2e3jgwVEkfvqtOJWVCCejMlZytB/l9Ua4fh+5/x k7dw== X-Gm-Message-State: ANoB5pmocnko6p54K2WCV2K/KzPEa5Gluq785RKk4PUYxomY4/CODrJL PraIhORiTzJ9y5FnovHtQ9Q= X-Google-Smtp-Source: AA0mqf7c5PYtNvAf34h6u0hVRoZ/fk3uEqTSefCcEuOybAf/1xwFAAP0zdqtCCISNJ3zgzvSN31hBg== X-Received: by 2002:a05:6402:4486:b0:46d:53d7:d21e with SMTP id er6-20020a056402448600b0046d53d7d21emr5149630edb.27.1670588285192; Fri, 09 Dec 2022 04:18:05 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::a4bf]) by smtp.gmail.com with ESMTPSA id s25-20020aa7d799000000b0045b910b0542sm573558edq.15.2022.12.09.04.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 04:18:03 -0800 (PST) From: Augusto Stoffel To: Juri Linkov Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <86359pm55x.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 09 Dec 2022 09:23:46 +0200") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> Date: Fri, 09 Dec 2022 13:18:02 +0100 Message-ID: <87o7scdb45.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: Lars Ingebrigtsen , Eli Zaretskii , Stefan Kangas , 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Here is an updated patch for the =E2=80=9Cgrep headings=E2=80=9D feature. As discussed before, I introduced a text property so that one can tell without guessing which parts of the compilation buffer are not coming from the external process. This seems to supersede the 'compilation-header-end' property introduced by Lars in commit 07f748da43, so I replaced its uses by the new 'compilation-aside' property. I could easily revert that, but it seemed reasonable to uniformize things in this case. I've also incorporated all other suggestions from other messages. (And Juri, nevermind what I said about some faces, it only applies to the Modus theme.) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Introduce-compilation-aside-text-property.patch >From c593fc94f2289d4bdcb61835eaf11b0fe393a0f5 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Thu, 8 Dec 2022 21:05:10 +0100 Subject: [PATCH 1/2] Introduce 'compilation-aside' text property It is meant to mark parts of compilation buffers which do not correspond to process output. * lisp/progmodes/compile.el (compilation-insert-aside): New function. (compilation-start, compilation-handle-exit): Use it. (compilation--ensure-parse) Rely on 'compilation-aside' property instead of 'compilation-header-end' --- lisp/progmodes/compile.el | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index e8ada9388e..2d22501017 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1675,7 +1675,7 @@ compilation--ensure-parse (set-marker (make-marker) (save-excursion (goto-char (point-min)) - (text-property-search-forward 'compilation-header-end) + (text-property-search-forward 'compilation-aside) ;; If we have no end marker, this will be ;; `point-min' still. (point))))) @@ -1823,6 +1823,14 @@ compilation--update-in-progress-mode-line ;; buffers when it changes from nil to non-nil or vice-versa. (unless compilation-in-progress (force-mode-line-update t))) +(defun compilation-insert-aside (&rest args) + "Insert ARGS at point, adding the `compilation-aside' text property. +This property is used to distinguish output of the compilation +process from additional information inserted by Emacs." + (let ((start (point))) + (apply #'insert args) + (put-text-property start (point) 'compilation-aside t))) + ;;;###autoload (defun compilation-start (command &optional mode name-function highlight-regexp continue) @@ -1944,17 +1952,16 @@ compilation-start (setq-local compilation-auto-jump-to-next t)) (when (zerop (buffer-size)) ;; Output a mode setter, for saving and later reloading this buffer. - (insert "-*- mode: " name-of-mode - "; default-directory: " - (prin1-to-string (abbreviate-file-name default-directory)) - " -*-\n")) - (insert (format "%s started at %s\n\n" - mode-name - (substring (current-time-string) 0 19)) - command "\n") - ;; Mark the end of the header so that we don't interpret - ;; anything in it as an error. - (put-text-property (1- (point)) (point) 'compilation-header-end t) + (compilation-insert-aside + "-*- mode: " name-of-mode + "; default-directory: " + (prin1-to-string (abbreviate-file-name default-directory)) + " -*-\n")) + (compilation-insert-aside + (format "%s started at %s\n\n" + mode-name + (substring (current-time-string) 0 19)) + command "\n") (setq thisdir default-directory)) (set-buffer-modified-p nil)) ;; Pop up the compilation buffer. @@ -2436,13 +2443,13 @@ compilation-handle-exit (cur-buffer (current-buffer))) ;; Record where we put the message, so we can ignore it later on. (goto-char omax) - (insert ?\n mode-name " " (car status)) + (compilation-insert-aside ?\n mode-name " " (car status)) (if (and (numberp compilation-window-height) (zerop compilation-window-height)) (message "%s" (cdr status))) (if (bolp) (forward-char -1)) - (insert " at " (substring (current-time-string) 0 19)) + (compilation-insert-aside " at " (substring (current-time-string) 0 19)) (goto-char (point-max)) ;; Prevent that message from being recognized as a compilation error. (add-text-properties omax (point) -- 2.38.1 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0002-New-user-option-grep-use-headings.patch Content-Transfer-Encoding: quoted-printable >From 549187135df21702210050e873210bd200612f96 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Wed, 7 Dec 2022 18:44:07 +0100 Subject: [PATCH 2/2] New user option 'grep-use-headings' * lisp/progmodes/grep.el (grep-heading-regexp): New user option. (grep-heading): New face. (grep--heading-format, grep--heading-state, grep--heading-filter): Filter function for grep processes and supporting variables. (grep-use-headings): New user option. (grep-mode): Use the above, if applicable. --- etc/NEWS | 8 ++++ lisp/progmodes/grep.el | 69 +++++++++++++++++++++++++++++++ test/lisp/progmodes/grep-tests.el | 14 +++++++ 3 files changed, 91 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 3eeef0ab4c..4ad6e76687 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -41,6 +41,14 @@ connection. * Changes in Specialized Modes and Packages in Emacs 30.1 =20 +** Compile + +*** New user option 'grep-use-headings'. +When non-nil, the grep output is split into sections, one for each +file, instead of having file names prefixed to each line. It is +equivalent to the --heading option of some tools such as 'git grep' +and 'rg. + ** VC =20 --- diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 2446e86abb..d6981c5951 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -30,6 +30,7 @@ ;;; Code: =20 (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'rx)) (require 'compile) =20 (defgroup grep nil @@ -457,6 +458,35 @@ grep-search-path :type '(repeat (choice (const :tag "Default" nil) (string :tag "Directory")))) =20 +(defcustom grep-use-headings nil + "If non-nil, subdivide grep output into sections, one per file." + :type 'boolean + :version "30.1") + +(defcustom grep-heading-regexp + (rx bol + (or + (group-n 2 + (group-n 1 (+ (not (any 0 ?\n)))) + 0) + (group-n 2 + (group-n 1 (+? nonl)) + (any ?: ?- ?=3D))) + (+ digit) + (any ?: ?- ?=3D)) + "Regexp used to create headings from grep output lines. +It should be anchored at beginning of line. The first capture +group, if present, should match the heading associated to the +line. The buffer range of the second capture, if present, is +made invisible (presumably because displaying it would be +redundant)." + :type 'regexp + :version "30.1") + +(defface grep-heading `((t :inherit ,grep-hit-face)) + "Face of headings when using `grep-heading-mode'." + :version "30.1") + (defvar grep-find-abbreviate-properties (let ((ellipsis (if (char-displayable-p ?=E2=80=A6) "[=E2=80=A6]" "[...]= ")) (map (make-sparse-keymap))) @@ -612,6 +642,40 @@ grep-filter (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1) (replace-match "" t t)))))) =20 +(defvar grep--heading-format + (eval-when-compile + (let ((title (propertize "%s" + 'font-lock-face 'grep-heading + 'outline-level 1))) + (propertize (concat title "\n") 'compilation-aside t))) + "Format string of grep headings. +This is passed to `format' with one argument, the text of the +first capture group of `grep-heading-regexp'.") + +(defvar-local grep--heading-state nil + "Variable to keep track of the `grep--heading-filter' state.") + +(defun grep--heading-filter () + "Filter function to add headings to output of a grep process." + (unless grep--heading-state + (setq grep--heading-state (cons (point-min-marker) nil))) + (save-excursion + (let ((limit (car grep--heading-state))) + ;; Move point to the old limit and update limit marker. + (move-marker limit (prog1 (pos-bol) (goto-char limit))) + (while (re-search-forward grep-heading-regexp limit t) + (unless (get-text-property (point) 'compilation-aside) + (let ((heading (match-string-no-properties 1)) + (start (match-beginning 2)) + (end (match-end 2))) + (when start + (put-text-property start end 'invisible t)) + (when (and heading (not (equal heading (cdr grep--heading-stat= e)))) + (save-excursion + (forward-line 0) + (insert-before-markers (format grep--heading-format headin= g))) + (setf (cdr grep--heading-state) heading)))))))) + (defun grep-probe (command args &optional func result) (let (process-file-side-effects) (equal (condition-case nil @@ -906,6 +970,11 @@ grep-mode (add-function :filter-return (local 'kill-transform-function) (lambda (string) (string-replace "\0" ":" string))) + (when grep-use-headings + (add-hook 'compilation-filter-hook #'grep--heading-filter 80 t) + (setq-local outline-search-function #'outline-search-level + outline-level (lambda () (get-text-property + (point) 'outline-level)))) (add-hook 'compilation-filter-hook #'grep-filter nil t)) =20 (defun grep--save-buffers () diff --git a/test/lisp/progmodes/grep-tests.el b/test/lisp/progmodes/grep-t= ests.el index 101052c5ad..51f4606639 100644 --- a/test/lisp/progmodes/grep-tests.el +++ b/test/lisp/progmodes/grep-tests.el @@ -66,4 +66,18 @@ grep-tests--rgrep-abbreviate-properties-windows-nt-sh-se= mantics (cl-letf (((symbol-function 'w32-shell-dos-semantics) #'ignore)) (grep-tests--check-rgrep-abbreviation)))) =20 +(ert-deftest grep-tests--grep-heading-regexp-without-null () + (dolist (sep '(?: ?- ?=3D)) + (let ((string (format "filename%c123%ctext" sep sep))) + (should (string-match grep-heading-regexp string)) + (should (equal (match-string 1 string) "filename")) + (should (equal (match-string 2 string) (format "filename%c" sep)))))) + +(ert-deftest grep-tests--grep-heading-regexp-with-null () + (dolist (sep '(?: ?- ?=3D)) + (let ((string (format "funny:0:filename%c123%ctext" 0 sep))) + (should (string-match grep-heading-regexp string)) + (should (equal (match-string 1 string) "funny:0:filename")) + (should (equal (match-string 2 string) "funny:0:filename\0"))))) + ;;; grep-tests.el ends here --=20 2.38.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 09 14:36:44 2022 Received: (at 59888) by debbugs.gnu.org; 9 Dec 2022 19:36:44 +0000 Received: from localhost ([127.0.0.1]:38030 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3jAq-0002KF-Co for submit@debbugs.gnu.org; Fri, 09 Dec 2022 14:36:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49364) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3jAo-0002K2-AS for 59888@debbugs.gnu.org; Fri, 09 Dec 2022 14:36:42 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3jAi-0000DC-8y; Fri, 09 Dec 2022 14:36:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=iLEl6QEcd4CxVxmGmlQaTtdiokb6AavUHERVQdVejbI=; b=owlk5lCXMWbj qHGoTmZ0uMi37poPD7FzIkk5p0/1nb5sW2nLFENsIg/nn2BCyOEUVMfLGbB+sZBjac1t24n9NBGa/ MMMwOt86BT4mF4WjRMozzUdAnuIwXp39bxbvfyuQE1R1f4ZCGjbx455ZZQRkTESUOWBxaet3cXCya /TPX4sTekxuCuSFSAJwbLlv7Tsc8l2crLiMOzpqZt++3SaecCu8KafoZSTOwcb4ABFPntcAvBQbOa TSS9v9whsh2hu2MdOVt7zUDN5bQP3LvpPoLEBYuCJwnNApoT0vuAErC/53co5qJWjTo5MRYo9pWSQ zE90pBPvu+zdIeB1fmcqjA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3jAh-00031U-GT; Fri, 09 Dec 2022 14:36:35 -0500 Date: Fri, 09 Dec 2022 21:36:28 +0200 Message-Id: <837cz0z7wj.fsf@gnu.org> From: Eli Zaretskii To: Augusto Stoffel In-Reply-To: <87o7scdb45.fsf_-_@gmail.com> (message from Augusto Stoffel on Fri, 09 Dec 2022 13:18:02 +0100) Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59888 Cc: larsi@gnus.org, stefankangas@gmail.com, 59888@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Augusto Stoffel > Cc: Stefan Kangas , 59888@debbugs.gnu.org, Eli > Zaretskii , Lars Ingebrigtsen > Date: Fri, 09 Dec 2022 13:18:02 +0100 > > As discussed before, I introduced a text property so that one can tell > without guessing which parts of the compilation buffer are not coming > from the external process. This seems to supersede the > 'compilation-header-end' property introduced by Lars in commit > 07f748da43, so I replaced its uses by the new 'compilation-aside' > property. I could easily revert that, but it seemed reasonable to > uniformize things in this case. Thanks, but please find a better name for this property. Something like compilation-meta-data, perhaps? > --- a/etc/NEWS > +++ b/etc/NEWS > @@ -41,6 +41,14 @@ connection. > > * Changes in Specialized Modes and Packages in Emacs 30.1 > > +** Compile > + > +*** New user option 'grep-use-headings'. > +When non-nil, the grep output is split into sections, one for each ^^^^ "Grep", capitalized. Or maybe even "the output of Grep". > +file, instead of having file names prefixed to each line. It is > +equivalent to the --heading option of some tools such as 'git grep' > +and 'rg. ^^^ 'rg' From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 09 15:03:30 2022 Received: (at 59888) by debbugs.gnu.org; 9 Dec 2022 20:03:30 +0000 Received: from localhost ([127.0.0.1]:38182 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3jaj-0002fo-N3 for submit@debbugs.gnu.org; Fri, 09 Dec 2022 15:03:29 -0500 Received: from mail-ej1-f44.google.com ([209.85.218.44]:43544) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3jah-0002fa-T8 for 59888@debbugs.gnu.org; Fri, 09 Dec 2022 15:03:28 -0500 Received: by mail-ej1-f44.google.com with SMTP id kw15so13932056ejc.10 for <59888@debbugs.gnu.org>; Fri, 09 Dec 2022 12:03:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=WrzrM2tZOQmk1c3UzMnDe7Tqdf0U3UW2F4whg90G7mk=; b=JWSttnqL7JyJv8uGbS+wXtgcmQjI8H9/z6EM1m/tC3ef1oWiH/RneFtPflZOP/FEDT +hChfwDkT5KC730eG7dbBXR8LlQQL7r9boGvyjZcgrYOTxiDOjvR3b2WrhbEq39HP5AE 2Fnth31+yxHi4gWUfK7/2qZcJZKivG0y8BSY6HW+KAECGb/753/ycPvPUip5X7vGxric olL0KyXZSvilrALGQUfGERGe6r3q39SSso7i5YZ6wg5FcK/LteGeu5kScq61uKmerAiu udnkwZ8nHdNg+hUA18GXfRl/jXCH0e9fhRIIAJw8HNI+b1TLddo8yxBEcY9zAUoBDO1A 0IsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WrzrM2tZOQmk1c3UzMnDe7Tqdf0U3UW2F4whg90G7mk=; b=TFbev1QnHqn2Hzc2emXe8pz+C06b+BvjqWRwPFhtvUVJx9Oy3t5FgInYiaIoPdT3yd fDtj2Ny2ACNacT4vUBxKQ3HG6q/QHX3DUPAIVBCTXD9H0ARc4+FSbkkac2LhqT2SbkHD P2sElP/eRDmw85sbtjM1vgZxWS84vwngeSZ7WvtoWUuhdVlLTzJEpunyS5wSrfk4pnVM KMeAEzup+RoR8noXFmBz0xgZI4mxp2jlOIih7C7Jj0wcUbKmYrGcIFIT0ibou6TfIV3E iLujCcwKkq158+LJpMLLjOuPKDYJtOFf5cYbDBoG1d0VGKzaQF+VVrAqlooce/5e7ib0 WRfw== X-Gm-Message-State: ANoB5pm2rHuEP5tK7TvYMC+NKNV9wI46PmzUq/TFPPCu0qgWGIT71Zyw eFTvy4u+ZJz3ZjZnHFKgSO4= X-Google-Smtp-Source: AA0mqf5zog7ofw+hBvuf7PQNyMNZJI+P74GUx/tO73w8urtWOqBF7xKxhWLoITDVKefWIt+DhCAPRg== X-Received: by 2002:a17:906:99d4:b0:7a6:598f:1fb3 with SMTP id s20-20020a17090699d400b007a6598f1fb3mr6114138ejn.5.1670616201882; Fri, 09 Dec 2022 12:03:21 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::a4bf]) by smtp.gmail.com with ESMTPSA id j12-20020a170906050c00b007c0d4d3a0c1sm286246eja.32.2022.12.09.12.03.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 12:03:20 -0800 (PST) From: Augusto Stoffel To: Eli Zaretskii Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <837cz0z7wj.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 09 Dec 2022 21:36:28 +0200") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> Date: Fri, 09 Dec 2022 21:03:17 +0100 Message-ID: <87k0301h16.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: larsi@gnus.org, stefankangas@gmail.com, 59888@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, 9 Dec 2022 at 21:36, Eli Zaretskii wrote: >> As discussed before, I introduced a text property so that one can tell >> without guessing which parts of the compilation buffer are not coming >> from the external process. This seems to supersede the >> 'compilation-header-end' property introduced by Lars in commit >> 07f748da43, so I replaced its uses by the new 'compilation-aside' >> property. I could easily revert that, but it seemed reasonable to >> uniformize things in this case. > > Thanks, but please find a better name for this property. Something > like compilation-meta-data, perhaps? All right, but since it's just a t-or-nil marking, I don't think metadata is a very good description. I considered 'compilation-info' but that seems related to compiler warnings and errors. I was looking for something that generally describes headers and footers, prefaces and epilogues, etc., but I'm missing a good word for that. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 09 15:29:23 2022 Received: (at 59888) by debbugs.gnu.org; 9 Dec 2022 20:29:23 +0000 Received: from localhost ([127.0.0.1]:38307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3jzm-0002vD-T7 for submit@debbugs.gnu.org; Fri, 09 Dec 2022 15:29:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3jzl-0002v7-NB for 59888@debbugs.gnu.org; Fri, 09 Dec 2022 15:29:22 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3jzg-00060M-7i; Fri, 09 Dec 2022 15:29:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=emapBB8fy6lb6qPl2L6bpR+Z/1MU34/5JDWonOx2ULg=; b=L/3mEWs//QoW OP5ycmsUb2DCZYiVPB6MMIpQC9KEiJ7v2Q3EjuBltdS14z3BCB1479BAZWohxXWKb8tWiwFMFu0LO Jd0+dVwn8drV2UmfgNOOOA68SFv/evsgjZzCLAf4kWnQIVZCVjzHdx6g/2dqreVS5PDp/kzd5cDpk Yda9lHplJz/lG+2EmOVwpSCJ8gIzQY1a9CQ0vI3VDXF4ZW8BOtKB4PD7ZUAKv3P9imlZltqmEM1c6 M+cOTs0yfElSwAHe4WJdT/pivv4NfecG7h6QXj8xAgbll0tgkDOodLoI5UddTRfBdU9970uD96ZYf ZRhodOG04g34Ii2xS8xXHg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3jzf-000265-Gl; Fri, 09 Dec 2022 15:29:15 -0500 Date: Fri, 09 Dec 2022 22:29:10 +0200 Message-Id: <831qp8z5gp.fsf@gnu.org> From: Eli Zaretskii To: Augusto Stoffel In-Reply-To: <87k0301h16.fsf@gmail.com> (message from Augusto Stoffel on Fri, 09 Dec 2022 21:03:17 +0100) Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59888 Cc: larsi@gnus.org, stefankangas@gmail.com, 59888@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Augusto Stoffel > Cc: juri@linkov.net, stefankangas@gmail.com, 59888@debbugs.gnu.org, > larsi@gnus.org > Date: Fri, 09 Dec 2022 21:03:17 +0100 > > > Thanks, but please find a better name for this property. Something > > like compilation-meta-data, perhaps? > > All right, but since it's just a t-or-nil marking, I don't think > metadata is a very good description. I considered 'compilation-info' > but that seems related to compiler warnings and errors. How about 'compilation-details'? > I was looking for something that generally describes headers and > footers, prefaces and epilogues, etc., but I'm missing a good word for > that. If "details" doesn't fit the bill, how about "decorations"? From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 09 15:40:57 2022 Received: (at 59888) by debbugs.gnu.org; 9 Dec 2022 20:40:57 +0000 Received: from localhost ([127.0.0.1]:38365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3kAz-00032X-5M for submit@debbugs.gnu.org; Fri, 09 Dec 2022 15:40:57 -0500 Received: from heytings.org ([95.142.160.155]:50850) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3kAx-00032R-Se for 59888@debbugs.gnu.org; Fri, 09 Dec 2022 15:40:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1670618455; bh=p3lsVm0ELF+qdS17kz7UwG/mXFftz9m288RQnn6EknA=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=syEe5QP5d2qyfo1m+Svi0oeWLA0fB4zJNgp+EZL8XIcebVwXarxGX6jCuVi9vgzFc Pn6mJXIYXP4j2MBX1JCkx1swlXpf9NOdUDbNtJtmGjnBuhrKdqMhioyHKY8FW+EdQS KOjBbi4pWwhT0IQxXya62iPBGSaZT1rpevoObmsloMQkstW502gwN8G0nsATwgRg0p h3KR/aGlBel9rYvTSfVWnqHEsfDDbTlp99TIc1seJC719+f0ooWvqkAvnhejo64qZA xp/WEhT5qO0IMCBm4hyg2Wl/EQkayVedbgdGBvCX3j7Z7MOwEjR85fffPAbQBK6Wp0 gmFUANGlRYGOA== Date: Fri, 09 Dec 2022 20:40:54 +0000 From: Gregory Heytings To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <87k0301h16.fsf@gmail.com> Message-ID: <574c1ceba8a53940ad90@heytings.org> References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: Eli Zaretskii , juri@linkov.net, larsi@gnus.org, 59888@debbugs.gnu.org, stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > > I was looking for something that generally describes headers and > footers, prefaces and epilogues, etc., but I'm missing a good word for > that. > Decorations? Frills? From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 10 12:47:14 2022 Received: (at 59888) by debbugs.gnu.org; 10 Dec 2022 17:47:14 +0000 Received: from localhost ([127.0.0.1]:44178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p43wQ-0001Wy-AR for submit@debbugs.gnu.org; Sat, 10 Dec 2022 12:47:14 -0500 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:35301) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p43wO-0001Wr-JL for 59888@debbugs.gnu.org; Sat, 10 Dec 2022 12:47:13 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id B80AE1BF205; Sat, 10 Dec 2022 17:47:03 +0000 (UTC) From: Juri Linkov To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <87k0301h16.fsf@gmail.com> (Augusto Stoffel's message of "Fri, 09 Dec 2022 21:03:17 +0100") Organization: LINKOV.NET References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> Date: Sat, 10 Dec 2022 19:24:27 +0200 Message-ID: <86r0x7jj25.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59888 Cc: larsi@gnus.org, Eli Zaretskii , stefankangas@gmail.com, 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > I was looking for something that generally describes headers and > footers, prefaces and epilogues, etc., but I'm missing a good word for > that. This suggests "marginals": https://english.stackexchange.com/questions/24060/what-word-defines-a-category-suited-for-both-header-and-footer From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 10 15:08:23 2022 Received: (at 59888) by debbugs.gnu.org; 10 Dec 2022 20:08:23 +0000 Received: from localhost ([127.0.0.1]:44801 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p468x-0005Tj-G2 for submit@debbugs.gnu.org; Sat, 10 Dec 2022 15:08:23 -0500 Received: from mail-ed1-f53.google.com ([209.85.208.53]:37865) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p468s-0005Td-2M for 59888@debbugs.gnu.org; Sat, 10 Dec 2022 15:08:18 -0500 Received: by mail-ed1-f53.google.com with SMTP id l11so7631120edb.4 for <59888@debbugs.gnu.org>; Sat, 10 Dec 2022 12:08:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=sFcI/CAblprDT64eFMvNI4e+YxqUKjtYIOiPgcXKVUA=; b=GeToMXvvywGk14G+1e1Mxr/w0DxMBS4as/kxXXq0qZCbzjxgNnC2Byn/mOv1+qDkAT SboUMNGuDUHe+Ij0uNVd7LDFX0LSk+7a9i0IGZetJTJ1ybRJnARvNrDcQ1GoOexkZiy7 VvdzshkxfIXmppFQsm00BHHCJ/vylygWPNXIG1CavzoZ1g+z2tggH/p3lvnTzyVCYRZY ip5nIn+wTSZt+4kT5hzkphGBvOk+HUqKDZ1KGFwYUFlUUuGWdLzY7iPiq67mct3Kpe7I XwfQDZviQlfLyuRHFkBzmhcNCSorHubVLsFc4sKe7z9iFPuUNQ+rEYcVKWa6CPFus+4c rGjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sFcI/CAblprDT64eFMvNI4e+YxqUKjtYIOiPgcXKVUA=; b=c1PmAOONBJbLByOviGN8bev+if240dZBWxJP2GSJ57oqW1wh29pjBB+eKbJCBge/tt T5HLyp6MI4aoTkodpCTIVkcWBqv7F5kUTjZSib8RdYUvupxdcUBceKLjiONDFKD3gI+i WKuyBDhaNGcM4MlwN1JrEITznod9PzkXpNnU/5n70KhUJVK7Zr9VJgba7WvcZqcr7zqf 2aiZ0Aq07Q1o8BsoNRkn0xWjhnr8O8yoU4EEKZX6LrNWvoiZXOiD/OfypGtXnmg+m2s7 o0Vzbkrw66Ws0NNIat/c5p4TYoG3oeOE+xCMOwVL9ysfC1NNgYJTNha4s8nOHsqxuqcp p6ig== X-Gm-Message-State: ANoB5plaYX/5MkidbQz5fY8NBAVCi7A0LXtE28rTVOgz/1aUJNKUBvim hacMO8WsmrvH3sG5pksXnQ0= X-Google-Smtp-Source: AA0mqf7U7SkrzNv1uYG3W4AZFpNfweMgAWsAL+BlCl0jn7wCH4AEc9tT25sbxybebMhHrzBUv4y7dQ== X-Received: by 2002:aa7:d5ce:0:b0:46b:aedf:f32b with SMTP id d14-20020aa7d5ce000000b0046baedff32bmr12909312eds.4.1670702888035; Sat, 10 Dec 2022 12:08:08 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::a4bf]) by smtp.gmail.com with ESMTPSA id z4-20020aa7c644000000b0046b471596e6sm1993446edr.57.2022.12.10.12.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Dec 2022 12:08:07 -0800 (PST) From: Augusto Stoffel To: Eli Zaretskii Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <831qp8z5gp.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 09 Dec 2022 22:29:10 +0200") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> Date: Sat, 10 Dec 2022 21:08:05 +0100 Message-ID: <87sfhn3tui.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 59888 Cc: larsi@gnus.org, stefankangas@gmail.com, 59888@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, 9 Dec 2022 at 22:29, Eli Zaretskii wrote: >> From: Augusto Stoffel >> Cc: juri@linkov.net, stefankangas@gmail.com, 59888@debbugs.gnu.org, >> larsi@gnus.org >> Date: Fri, 09 Dec 2022 21:03:17 +0100 >> >> > Thanks, but please find a better name for this property. Something >> > like compilation-meta-data, perhaps? >> >> All right, but since it's just a t-or-nil marking, I don't think >> metadata is a very good description. I considered 'compilation-info' >> but that seems related to compiler warnings and errors. > > How about 'compilation-details'? > >> I was looking for something that generally describes headers and >> footers, prefaces and epilogues, etc., but I'm missing a good word for >> that. > > If "details" doesn't fit the bill, how about "decorations"? Would you be okay with 'compilation-annotation'? "Decoration" sounds good, but I like "annotation" slightly better. Thanks for all the suggestions. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 10 15:16:15 2022 Received: (at 59888) by debbugs.gnu.org; 10 Dec 2022 20:16:15 +0000 Received: from localhost ([127.0.0.1]:44841 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p46Gd-0005Yk-2s for submit@debbugs.gnu.org; Sat, 10 Dec 2022 15:16:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p46Gb-0005Yc-8b for 59888@debbugs.gnu.org; Sat, 10 Dec 2022 15:16:14 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p46GV-0005fN-Em; Sat, 10 Dec 2022 15:16:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=l9R/eedn+q6xYJ4wYvALzU9+1ySVmgeuPSGC8e22nTE=; b=TY8vWj5gJXq2 8cvEMI5sLwQYBj+lusxbNxiB6YnsrSPIftGNfmVL5oHV43IGdalkYNNzqKoVAGHmYvct2oNkxSN8I dGtltvjYoUAF6MdW4m9Dd1XWEq/TLNBugHfpBkEG5+645Kfm1Vw9370ZcTuiHkK4dZzpQ+muvRyDZ xgJgFI7s4UCvbNPvI8WlsrZf1Ug1P6KZOJzRCUab0VIdePbL1tfrJPeG3+btkaGvNIzcw8dyyn23q WlaIRvpzwz0/OPR1Yt5CSNlHGzXE6WYijjupj6E/m4bQ4fwsOoifQ/ScLbQg5pbPWUdjuQhzqLI0Y t/3nQJdK5DFC6nLLa4BfgQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p46GU-0006zc-Si; Sat, 10 Dec 2022 15:16:07 -0500 Date: Sat, 10 Dec 2022 22:16:04 +0200 Message-Id: <83wn6zui9n.fsf@gnu.org> From: Eli Zaretskii To: Augusto Stoffel In-Reply-To: <87sfhn3tui.fsf@gmail.com> (message from Augusto Stoffel on Sat, 10 Dec 2022 21:08:05 +0100) Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59888 Cc: larsi@gnus.org, stefankangas@gmail.com, 59888@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Augusto Stoffel > Cc: juri@linkov.net, stefankangas@gmail.com, 59888@debbugs.gnu.org, > larsi@gnus.org > Date: Sat, 10 Dec 2022 21:08:05 +0100 > > On Fri, 9 Dec 2022 at 22:29, Eli Zaretskii wrote: > > >> From: Augusto Stoffel > >> Cc: juri@linkov.net, stefankangas@gmail.com, 59888@debbugs.gnu.org, > >> larsi@gnus.org > >> Date: Fri, 09 Dec 2022 21:03:17 +0100 > >> > >> > Thanks, but please find a better name for this property. Something > >> > like compilation-meta-data, perhaps? > >> > >> All right, but since it's just a t-or-nil marking, I don't think > >> metadata is a very good description. I considered 'compilation-info' > >> but that seems related to compiler warnings and errors. > > > > How about 'compilation-details'? > > > >> I was looking for something that generally describes headers and > >> footers, prefaces and epilogues, etc., but I'm missing a good word for > >> that. > > > > If "details" doesn't fit the bill, how about "decorations"? > > Would you be okay with 'compilation-annotation'? "Decoration" sounds > good, but I like "annotation" slightly better. Could be. Or how about compilation-aux-data? From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 11 06:30:55 2022 Received: (at 59888) by debbugs.gnu.org; 11 Dec 2022 11:30:55 +0000 Received: from localhost ([127.0.0.1]:46344 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4KXm-0000ti-SX for submit@debbugs.gnu.org; Sun, 11 Dec 2022 06:30:55 -0500 Received: from mail-ej1-f47.google.com ([209.85.218.47]:38509) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4KXj-0000tZ-Fh for 59888@debbugs.gnu.org; Sun, 11 Dec 2022 06:30:54 -0500 Received: by mail-ej1-f47.google.com with SMTP id m18so21466231eji.5 for <59888@debbugs.gnu.org>; Sun, 11 Dec 2022 03:30:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=lVGD3AdemrYGcTUwfcirmJCtV4ftE2WlA6cy56FHXv8=; b=J1cJYysnVWBg29KWyEu8iIxvKKc795+9kJJ6aP1ltJ2k86x83zgd8cdv1IL8HaTDZB Eb4v91BFOTXR17r38bpHCZxTkIbiDF5i0EOjVOlNIGYmIByi3f3JN00ZgY+HxKZoVPOE FQOocrAECpxhqg6bWmoWu6697r4biq3XhWDnhfU+L/foXYjeSkIIqEj2vTklSw14QmpD 3lGZIpl40s+KSwjT1dyncpg/3Zu+QNIMFlyKVaB11bKm96KvUJVFm4vb5VBrWPSeQuvR hw3OQJBmgHJ8UbgfI3RPEojzw1dtZY7RbThfDRQU9Z3VjjAwtUD1bgBUlpI36Cy22sHA llyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lVGD3AdemrYGcTUwfcirmJCtV4ftE2WlA6cy56FHXv8=; b=UK+jR1oHl2TgopV/PeMXNk/85xud/2Alf/Yu2+fqpJ5eWTltVMQyVZc25vdMzWfQLU pFgCnWdNfMhBNZQBYqmJy2GWZ7JpL3jy1pV5R6xHHWQUlQXXAvYA/IAWY3jDTDUXhau0 kLfcZb1g1u1Une3hiLCRz04Pvi4jjxBodMXUtifCQ0q3tJaYyenpsn0GlFZSLxvbKoBn QsgzjJmPJHtkVszfz2N9lFYdHya2mmjjQ6+NGbVxi4xdPYeUk43Rf5rLMiN/Hoivwkbo RKQTn5zeMCQe/Qst+IrmGiTYnl/qVknf826pE1gGoJwYktKTxN0aJYgkGpaPwLY+rJ0Y Mt9w== X-Gm-Message-State: ANoB5pku+OgfuPxquRZtTNoXlxZ0PyuAPFrGgp/FSTjUQ7+vPEEUUcqq 28l5a1MZilciw0SGs1hEs+VJ66Ad04hDFQ== X-Google-Smtp-Source: AA0mqf66orer0hGTfEMIbnRRiWFPRpwUFlUcQAQFPYPLZuftJiIMilABGkA2kB2yOGGhGLTybdRcig== X-Received: by 2002:a17:907:7603:b0:7c1:6091:e73 with SMTP id jx3-20020a170907760300b007c160910e73mr2631381ejc.1.1670758245104; Sun, 11 Dec 2022 03:30:45 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::a4bf]) by smtp.gmail.com with ESMTPSA id rh16-20020a17090720f000b007c0efbaa8a0sm2037114ejb.4.2022.12.11.03.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Dec 2022 03:30:43 -0800 (PST) From: Augusto Stoffel To: Eli Zaretskii Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <83wn6zui9n.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 10 Dec 2022 22:16:04 +0200") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> Date: Sun, 11 Dec 2022 12:30:42 +0100 Message-ID: <87ilii41p9.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: stefankangas@gmail.com, 59888@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain I've attached a new version of the patch incorporating the latest discussions. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Introduce-compilation-annotation-text-property.patch >From 8aa2bebbe1b12094963fdeb3251f3ef3c22ea5e9 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Thu, 8 Dec 2022 21:05:10 +0100 Subject: [PATCH 1/2] Introduce 'compilation-annotation' text property It is meant to mark parts of compilation buffers which do not correspond to process output. * lisp/progmodes/compile.el (compilation-insert-annotation): New function. (compilation-start, compilation-handle-exit): Use it. (compilation--ensure-parse) Rely on 'compilation-annotation' property instead of 'compilation-header-end'. --- lisp/progmodes/compile.el | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index e8ada9388e..3aa6867533 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1675,7 +1675,7 @@ compilation--ensure-parse (set-marker (make-marker) (save-excursion (goto-char (point-min)) - (text-property-search-forward 'compilation-header-end) + (text-property-search-forward 'compilation-annotation) ;; If we have no end marker, this will be ;; `point-min' still. (point))))) @@ -1823,6 +1823,14 @@ compilation--update-in-progress-mode-line ;; buffers when it changes from nil to non-nil or vice-versa. (unless compilation-in-progress (force-mode-line-update t))) +(defun compilation-insert-annotation (&rest args) + "Insert ARGS at point, adding the `compilation-annotation' text property. +This property is used to distinguish output of the compilation +process from additional information inserted by Emacs." + (let ((start (point))) + (apply #'insert args) + (put-text-property start (point) 'compilation-annotation t))) + ;;;###autoload (defun compilation-start (command &optional mode name-function highlight-regexp continue) @@ -1944,17 +1952,16 @@ compilation-start (setq-local compilation-auto-jump-to-next t)) (when (zerop (buffer-size)) ;; Output a mode setter, for saving and later reloading this buffer. - (insert "-*- mode: " name-of-mode - "; default-directory: " - (prin1-to-string (abbreviate-file-name default-directory)) - " -*-\n")) - (insert (format "%s started at %s\n\n" - mode-name - (substring (current-time-string) 0 19)) - command "\n") - ;; Mark the end of the header so that we don't interpret - ;; anything in it as an error. - (put-text-property (1- (point)) (point) 'compilation-header-end t) + (compilation-insert-annotation + "-*- mode: " name-of-mode + "; default-directory: " + (prin1-to-string (abbreviate-file-name default-directory)) + " -*-\n")) + (compilation-insert-annotation + (format "%s started at %s\n\n" + mode-name + (substring (current-time-string) 0 19)) + command "\n") (setq thisdir default-directory)) (set-buffer-modified-p nil)) ;; Pop up the compilation buffer. @@ -2436,13 +2443,13 @@ compilation-handle-exit (cur-buffer (current-buffer))) ;; Record where we put the message, so we can ignore it later on. (goto-char omax) - (insert ?\n mode-name " " (car status)) + (compilation-insert-annotation ?\n mode-name " " (car status)) (if (and (numberp compilation-window-height) (zerop compilation-window-height)) (message "%s" (cdr status))) (if (bolp) (forward-char -1)) - (insert " at " (substring (current-time-string) 0 19)) + (compilation-insert-annotation " at " (substring (current-time-string) 0 19)) (goto-char (point-max)) ;; Prevent that message from being recognized as a compilation error. (add-text-properties omax (point) -- 2.38.1 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0002-New-user-option-grep-use-headings.patch Content-Transfer-Encoding: quoted-printable >From e1209a93e09792cbb61bde9ae3ac8838c76861a5 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Wed, 7 Dec 2022 18:44:07 +0100 Subject: [PATCH 2/2] New user option 'grep-use-headings' * lisp/progmodes/grep.el (grep-heading-regexp): New user option. (grep-heading): New face. (grep--heading-format, grep--heading-state, grep--heading-filter): Filter function for grep processes and supporting variables. (grep-use-headings): New user option. (grep-mode): Use the above, if applicable. --- etc/NEWS | 8 ++++ lisp/progmodes/grep.el | 69 +++++++++++++++++++++++++++++++ test/lisp/progmodes/grep-tests.el | 14 +++++++ 3 files changed, 91 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 3eeef0ab4c..ac5ed7cbf3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -41,6 +41,14 @@ connection. * Changes in Specialized Modes and Packages in Emacs 30.1 =20 +** Compile + +*** New user option 'grep-use-headings'. +When non-nil, the output of Grep is split into sections, one for each +file, instead of having file names prefixed to each line. It is +equivalent to the --heading option of some tools such as 'git grep' +and 'rg'. + ** VC =20 --- diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 2446e86abb..c6be39fbb7 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -30,6 +30,7 @@ ;;; Code: =20 (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'rx)) (require 'compile) =20 (defgroup grep nil @@ -457,6 +458,35 @@ grep-search-path :type '(repeat (choice (const :tag "Default" nil) (string :tag "Directory")))) =20 +(defcustom grep-use-headings nil + "If non-nil, subdivide grep output into sections, one per file." + :type 'boolean + :version "30.1") + +(defcustom grep-heading-regexp + (rx bol + (or + (group-n 2 + (group-n 1 (+ (not (any 0 ?\n)))) + 0) + (group-n 2 + (group-n 1 (+? nonl)) + (any ?: ?- ?=3D))) + (+ digit) + (any ?: ?- ?=3D)) + "Regexp used to create headings from grep output lines. +It should be anchored at beginning of line. The first capture +group, if present, should match the heading associated to the +line. The buffer range of the second capture, if present, is +made invisible (presumably because displaying it would be +redundant)." + :type 'regexp + :version "30.1") + +(defface grep-heading `((t :inherit ,grep-hit-face)) + "Face of headings when using `grep-heading-mode'." + :version "30.1") + (defvar grep-find-abbreviate-properties (let ((ellipsis (if (char-displayable-p ?=E2=80=A6) "[=E2=80=A6]" "[...]= ")) (map (make-sparse-keymap))) @@ -612,6 +642,40 @@ grep-filter (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1) (replace-match "" t t)))))) =20 +(defvar grep--heading-format + (eval-when-compile + (let ((title (propertize "%s" + 'font-lock-face 'grep-heading + 'outline-level 1))) + (propertize (concat title "\n") 'compilation-annotation t))) + "Format string of grep headings. +This is passed to `format' with one argument, the text of the +first capture group of `grep-heading-regexp'.") + +(defvar-local grep--heading-state nil + "Variable to keep track of the `grep--heading-filter' state.") + +(defun grep--heading-filter () + "Filter function to add headings to output of a grep process." + (unless grep--heading-state + (setq grep--heading-state (cons (point-min-marker) nil))) + (save-excursion + (let ((limit (car grep--heading-state))) + ;; Move point to the old limit and update limit marker. + (move-marker limit (prog1 (pos-bol) (goto-char limit))) + (while (re-search-forward grep-heading-regexp limit t) + (unless (get-text-property (point) 'compilation-annotation) + (let ((heading (match-string-no-properties 1)) + (start (match-beginning 2)) + (end (match-end 2))) + (when start + (put-text-property start end 'invisible t)) + (when (and heading (not (equal heading (cdr grep--heading-stat= e)))) + (save-excursion + (forward-line 0) + (insert-before-markers (format grep--heading-format headin= g))) + (setf (cdr grep--heading-state) heading)))))))) + (defun grep-probe (command args &optional func result) (let (process-file-side-effects) (equal (condition-case nil @@ -906,6 +970,11 @@ grep-mode (add-function :filter-return (local 'kill-transform-function) (lambda (string) (string-replace "\0" ":" string))) + (when grep-use-headings + (add-hook 'compilation-filter-hook #'grep--heading-filter 80 t) + (setq-local outline-search-function #'outline-search-level + outline-level (lambda () (get-text-property + (point) 'outline-level)))) (add-hook 'compilation-filter-hook #'grep-filter nil t)) =20 (defun grep--save-buffers () diff --git a/test/lisp/progmodes/grep-tests.el b/test/lisp/progmodes/grep-t= ests.el index 101052c5ad..51f4606639 100644 --- a/test/lisp/progmodes/grep-tests.el +++ b/test/lisp/progmodes/grep-tests.el @@ -66,4 +66,18 @@ grep-tests--rgrep-abbreviate-properties-windows-nt-sh-se= mantics (cl-letf (((symbol-function 'w32-shell-dos-semantics) #'ignore)) (grep-tests--check-rgrep-abbreviation)))) =20 +(ert-deftest grep-tests--grep-heading-regexp-without-null () + (dolist (sep '(?: ?- ?=3D)) + (let ((string (format "filename%c123%ctext" sep sep))) + (should (string-match grep-heading-regexp string)) + (should (equal (match-string 1 string) "filename")) + (should (equal (match-string 2 string) (format "filename%c" sep)))))) + +(ert-deftest grep-tests--grep-heading-regexp-with-null () + (dolist (sep '(?: ?- ?=3D)) + (let ((string (format "funny:0:filename%c123%ctext" 0 sep))) + (should (string-match grep-heading-regexp string)) + (should (equal (match-string 1 string) "funny:0:filename")) + (should (equal (match-string 2 string) "funny:0:filename\0"))))) + ;;; grep-tests.el ends here --=20 2.38.1 --=-=-= Content-Type: text/plain There is still an issue I'm aware of: if one saves a grep buffer to a file and later opens the file, the headings are inserted a second time. I've tried a bit to display the headings only using text display properties (instead of inserting the actual text into the buffer), but wasn't successful so far. Other, less elegant solutions are possible (e.g. deleting all headings either when saving or when reading again the file). We could install this change now and polish it later or continue this discussion -- both are fine by me. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 12 20:04:53 2022 Received: (at control) by debbugs.gnu.org; 13 Dec 2022 01:04:53 +0000 Received: from localhost ([127.0.0.1]:56734 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4tj3-0003b8-6Y for submit@debbugs.gnu.org; Mon, 12 Dec 2022 20:04:53 -0500 Received: from mail-oa1-f45.google.com ([209.85.160.45]:43946) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4tj1-0003as-F7 for control@debbugs.gnu.org; Mon, 12 Dec 2022 20:04:51 -0500 Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-1433ef3b61fso10663357fac.10 for ; Mon, 12 Dec 2022 17:04:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=iE7jTxSWAjz6eqD7g7HX6/OOGxEC34+8cNCv+h1W6cg=; b=K8S5quz5QaNkzZTrrgWbSY5vnc1EAfFGycdyDakWDKeqttHXqYx4600/l5cexmRhID K1ScXvdoeVo5DSc27BoMCu5e4DhzwuhvmpmQpqWxne1D7yIB1joGJHTQgZLshGHpMjyP RWVfze2i7Q6DNOSBTdXXwtEWRBY4AK7hTBvbSBsgimM82OBPe2j37Gp/i1eZzq5LCuZ8 2VEL9lEw1xLyKpLOherlSai7a74+Zms6EcYOjYpmBKeHhqfILxu+2CiVt3FU8feQ/G+k 51y1Ny121/YRSnGL5NfCpL4Fxe6LvTUGjawUiMxSAiO9yjFxm5kwgILAPp1PIsUSS8Q+ xMHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=iE7jTxSWAjz6eqD7g7HX6/OOGxEC34+8cNCv+h1W6cg=; b=xAcMpJZNGN7aZP29quTjvMF6LUIH2u/1pOltXefxR0cjkA2Ds8HzXZNC/BDK3Q6+oj Z2kRh4hF3t3JLsj4PAuw/2FtgpevHFGrR2jJiSdrgV9GPxjGmtj7gakgayU2RJMNW1/r R5xUfQqt+++xTFxnEkTTDhtx7JIEVkRv5VqtUpCeI9FNH9xUfjFxEFO2jUf83DRc1gek jyL0pZsQbgOb2XuzpNhh8O1j09ZUdGmiEuoYTjeOx4i5bawFjewtONGTmmEiQGSv9J4N WQoZ2vjEDlQe7X8K2hidrqgdXLT+ConogmMUUq8/oQZpLWkQDnx563jprKBc/lnqy0Jn mWYA== X-Gm-Message-State: ANoB5pl4DvnewoiHLUGQ1cAsziJazR3/r4C4fD5v734N+CIRLzm7Jt5c Xl2TizKW1DEvNLpKnqxJtFa3HeCxNHfYrgxdMMf6DPUO X-Google-Smtp-Source: AA0mqf5zKJnK+xuul6L3eoxcIqv85udz8TXQO7Mg+/svdMjB4kUxmB0pvONoJ2LtXQkbaV0HW77f6QWpYPNPCN1Hlzc= X-Received: by 2002:a05:6871:4586:b0:148:28c1:3d46 with SMTP id nl6-20020a056871458600b0014828c13d46mr80317oab.199.1670893486196; Mon, 12 Dec 2022 17:04:46 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 12 Dec 2022 17:04:45 -0800 From: Stefan Kangas X-Hashcash: 1:20:221213:control@debbugs.gnu.org::fBtGkmWauTsp85/C:5AOr MIME-Version: 1.0 Date: Mon, 12 Dec 2022 17:04:45 -0800 Message-ID: Subject: control message for bug #59888 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) severity 59888 wishlist quit From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 15 03:32:37 2022 Received: (at 59888) by debbugs.gnu.org; 15 Dec 2022 08:32:37 +0000 Received: from localhost ([127.0.0.1]:42490 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5jfR-0008Mm-BX for submit@debbugs.gnu.org; Thu, 15 Dec 2022 03:32:37 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:38921) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5jfM-0008MR-1h for 59888@debbugs.gnu.org; Thu, 15 Dec 2022 03:32:34 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id A86671C0002; Thu, 15 Dec 2022 08:32:24 +0000 (UTC) From: Juri Linkov To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <87ilii41p9.fsf@gmail.com> (Augusto Stoffel's message of "Sun, 11 Dec 2022 12:30:42 +0100") Organization: LINKOV.NET References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> Date: Thu, 15 Dec 2022 10:05:39 +0200 Message-ID: <867cytgk0k.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59888 Cc: Eli Zaretskii , stefankangas@gmail.com, 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > There is still an issue I'm aware of: if one saves a grep buffer to a > file and later opens the file, the headings are inserted a second time. > I've tried a bit to display the headings only using text display > properties (instead of inserting the actual text into the buffer), but > wasn't successful so far. Other, less elegant solutions are possible > (e.g. deleting all headings either when saving or when reading again the > file). This reminds a similar problem that the file etc/grep.txt can't be edited in grep-mode because then it will lose all grep-filtered escape sequences on saving. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 03:35:09 2023 Received: (at 59888) by debbugs.gnu.org; 25 Feb 2023 08:35:09 +0000 Received: from localhost ([127.0.0.1]:38972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVq1M-0004tt-9M for submit@debbugs.gnu.org; Sat, 25 Feb 2023 03:35:08 -0500 Received: from mail-ed1-f44.google.com ([209.85.208.44]:36514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVq1J-0004tH-VK for 59888@debbugs.gnu.org; Sat, 25 Feb 2023 03:35:06 -0500 Received: by mail-ed1-f44.google.com with SMTP id da10so6420684edb.3 for <59888@debbugs.gnu.org>; Sat, 25 Feb 2023 00:35:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=/sELHticWUnm3yn7/k7vFYFdVLR7r3ra3zdbIVM1J20=; b=nv1R05al45agmeXfZAsmLaRoPjG6buprWk7qF8zyPL76Y/S61ySyFjhF5obdXFudvl v5Bw8nI6RxysXtrFVvbUFVNS5aGEfDgobpqFDQHW59W8hbGWVdzBj6lYGAv42m9nhfRV MnqIBgw2mxyLf8xREf7QiodJi3ilqmqcPLA4SeVVLyAP/DXOpgyWcBkndW7VnOlcJ7DJ vMire6DgSgKyy+4L+l09Dx2+L+fkhmCxGaNSbUQk3V9KQ/UL1j1PFjIalaG9NZYMqfuG gYIO+NUs8WwH3Y2Epf5V6E8kL9WNvmS4GXQ03fRfIyrpafmfdgBEAsp3scXx/ienNB1D 1UMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/sELHticWUnm3yn7/k7vFYFdVLR7r3ra3zdbIVM1J20=; b=Kp8g71dQ+jm5wE6a5VVIYtaUcZKY4pHafP8w8NUEeY4mm85zasovmpXxQ658ACobHl p1hfHiU9m0/WqCd4jvXpRF8FnbOU8/RHrfu3B/YdcoqeurAUG0YSe/SoTgwlOmgwDpg+ Nom/qgkT1Qv/sBKZHCgUa71Yw3Qpejbtc+p+xm+ljb52RnrGA9uTQQDA4R8J2GHdx3sv KhePmezakJAmkns5i8qtbKYVrzs7XEMmtY0kG/8GOH3iArw4LSaX51Jvz12IqLvy3Q6d oFvakuF0+76zBWlBklP4ismvQXe8jroAHnoafGzyPTpEe7wzPzfOImwLgS3p33rfJD1a hXcA== X-Gm-Message-State: AO0yUKWcqLeI49J0/8rUO/DDXmaOAfuWiL1STQsl/rbUBJopsfPkTT4M XD5MV1dqyOdLlPHr5s2n5dag9hoX+zVqJA== X-Google-Smtp-Source: AK7set+x3i0tlvxP6bK0jsjDCV/2Qg0oS8i5/UsWZ/N+XyvoECrfsID4goO8WYEo+BGVYPXG0Z/h5Q== X-Received: by 2002:a17:906:b84c:b0:878:7c18:8fd9 with SMTP id ga12-20020a170906b84c00b008787c188fd9mr25852839ejb.44.1677314099056; Sat, 25 Feb 2023 00:34:59 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::6fd0]) by smtp.gmail.com with ESMTPSA id rl5-20020a170907216500b008b175c46867sm596569ejb.116.2023.02.25.00.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 00:34:57 -0800 (PST) From: Augusto Stoffel To: Juri Linkov Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <867cytgk0k.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 15 Dec 2022 10:05:39 +0200") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> Date: Sat, 25 Feb 2023 09:34:56 +0100 Message-ID: <871qme5ej3.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: Eli Zaretskii , stefankangas@gmail.com, 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain I've been using the grep-use-headings locally for a long time and it works well. Should the the patches be installed? --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0002-New-user-option-grep-use-headings.patch Content-Transfer-Encoding: quoted-printable >From 77ea46f6dc50a8f463bd2f51ce9d0585de0bb55c Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Wed, 7 Dec 2022 18:44:07 +0100 Subject: [PATCH 2/2] New user option 'grep-use-headings' * lisp/progmodes/grep.el (grep-heading-regexp): New user option. (grep-heading): New face. (grep--heading-format, grep--heading-state, grep--heading-filter): Filter function for grep processes and supporting variables. (grep-use-headings): New user option. (grep-mode): Use the above, if applicable. --- etc/NEWS | 8 ++++ lisp/progmodes/grep.el | 69 +++++++++++++++++++++++++++++++ test/lisp/progmodes/grep-tests.el | 14 +++++++ 3 files changed, 91 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 4b0e4e6bd46..ca2e8011510 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -95,6 +95,14 @@ If you want to get back the old behavior, set the user o= ption to the value (setopt gdb-locals-table-row-config `((type . 0) (name . 0) (value . ,gdb-locals-value-limit))) =20 +** Compile + +*** New user option 'grep-use-headings'. +When non-nil, the output of Grep is split into sections, one for each +file, instead of having file names prefixed to each line. It is +equivalent to the --heading option of some tools such as 'git grep' +and 'rg'. + ** VC =20 --- diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 0da16b44dda..9e3cec89c01 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -30,6 +30,7 @@ ;;; Code: =20 (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'rx)) (require 'compile) =20 (defgroup grep nil @@ -457,6 +458,35 @@ grep-search-path :type '(repeat (choice (const :tag "Default" nil) (string :tag "Directory")))) =20 +(defcustom grep-use-headings nil + "If non-nil, subdivide grep output into sections, one per file." + :type 'boolean + :version "30.1") + +(defcustom grep-heading-regexp + (rx bol + (or + (group-n 2 + (group-n 1 (+ (not (any 0 ?\n)))) + 0) + (group-n 2 + (group-n 1 (+? nonl)) + (any ?: ?- ?=3D))) + (+ digit) + (any ?: ?- ?=3D)) + "Regexp used to create headings from grep output lines. +It should be anchored at beginning of line. The first capture +group, if present, should match the heading associated to the +line. The buffer range of the second capture, if present, is +made invisible (presumably because displaying it would be +redundant)." + :type 'regexp + :version "30.1") + +(defface grep-heading `((t :inherit ,grep-hit-face)) + "Face of headings when `grep-use-headings' is non-nil." + :version "30.1") + (defvar grep-find-abbreviate-properties (let ((ellipsis (if (char-displayable-p ?=E2=80=A6) "[=E2=80=A6]" "[...]= ")) (map (make-sparse-keymap))) @@ -612,6 +642,40 @@ grep-filter (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1) (replace-match "" t t)))))) =20 +(defvar grep--heading-format + (eval-when-compile + (let ((title (propertize "%s" + 'font-lock-face 'grep-heading + 'outline-level 1))) + (propertize (concat title "\n") 'compilation-annotation t))) + "Format string of grep headings. +This is passed to `format' with one argument, the text of the +first capture group of `grep-heading-regexp'.") + +(defvar-local grep--heading-state nil + "Variable to keep track of the `grep--heading-filter' state.") + +(defun grep--heading-filter () + "Filter function to add headings to output of a grep process." + (unless grep--heading-state + (setq grep--heading-state (cons (point-min-marker) nil))) + (save-excursion + (let ((limit (car grep--heading-state))) + ;; Move point to the old limit and update limit marker. + (move-marker limit (prog1 (pos-bol) (goto-char limit))) + (while (re-search-forward grep-heading-regexp limit t) + (unless (get-text-property (point) 'compilation-annotation) + (let ((heading (match-string-no-properties 1)) + (start (match-beginning 2)) + (end (match-end 2))) + (when start + (put-text-property start end 'invisible t)) + (when (and heading (not (equal heading (cdr grep--heading-stat= e)))) + (save-excursion + (forward-line 0) + (insert-before-markers (format grep--heading-format headin= g))) + (setf (cdr grep--heading-state) heading)))))))) + (defun grep-probe (command args &optional func result) (let (process-file-side-effects) (equal (condition-case nil @@ -906,6 +970,11 @@ grep-mode (add-function :filter-return (local 'kill-transform-function) (lambda (string) (string-replace "\0" ":" string))) + (when grep-use-headings + (add-hook 'compilation-filter-hook #'grep--heading-filter 80 t) + (setq-local outline-search-function #'outline-search-level + outline-level (lambda () (get-text-property + (point) 'outline-level)))) (add-hook 'compilation-filter-hook #'grep-filter nil t)) =20 (defun grep--save-buffers () diff --git a/test/lisp/progmodes/grep-tests.el b/test/lisp/progmodes/grep-t= ests.el index 39307999d6d..9b7f83086bf 100644 --- a/test/lisp/progmodes/grep-tests.el +++ b/test/lisp/progmodes/grep-tests.el @@ -66,4 +66,18 @@ grep-tests--rgrep-abbreviate-properties-windows-nt-sh-se= mantics (cl-letf (((symbol-function 'w32-shell-dos-semantics) #'ignore)) (grep-tests--check-rgrep-abbreviation)))) =20 +(ert-deftest grep-tests--grep-heading-regexp-without-null () + (dolist (sep '(?: ?- ?=3D)) + (let ((string (format "filename%c123%ctext" sep sep))) + (should (string-match grep-heading-regexp string)) + (should (equal (match-string 1 string) "filename")) + (should (equal (match-string 2 string) (format "filename%c" sep)))))) + +(ert-deftest grep-tests--grep-heading-regexp-with-null () + (dolist (sep '(?: ?- ?=3D)) + (let ((string (format "funny:0:filename%c123%ctext" 0 sep))) + (should (string-match grep-heading-regexp string)) + (should (equal (match-string 1 string) "funny:0:filename")) + (should (equal (match-string 2 string) "funny:0:filename\0"))))) + ;;; grep-tests.el ends here --=20 2.39.2 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Introduce-compilation-annotation-text-property.patch >From 6d97ae3b43fe893f2ec7dab67c14f06e1eb9a3fb Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Thu, 8 Dec 2022 21:05:10 +0100 Subject: [PATCH 1/2] Introduce 'compilation-annotation' text property It is meant to mark parts of compilation buffers which do not correspond to process output. * lisp/progmodes/compile.el (compilation-insert-annotation): New function. (compilation-start, compilation-handle-exit): Use it. (compilation--ensure-parse) Rely on 'compilation-annotation' property instead of 'compilation-header-end'. --- lisp/progmodes/compile.el | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index ccf64fb670b..6d151db8a83 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1706,7 +1706,7 @@ compilation--ensure-parse (set-marker (make-marker) (save-excursion (goto-char (point-min)) - (text-property-search-forward 'compilation-header-end) + (text-property-search-forward 'compilation-annotation) ;; If we have no end marker, this will be ;; `point-min' still. (point))))) @@ -1854,6 +1854,14 @@ compilation--update-in-progress-mode-line ;; buffers when it changes from nil to non-nil or vice-versa. (unless compilation-in-progress (force-mode-line-update t))) +(defun compilation-insert-annotation (&rest args) + "Insert ARGS at point, adding the `compilation-annotation' text property. +This property is used to distinguish output of the compilation +process from additional information inserted by Emacs." + (let ((start (point))) + (apply #'insert args) + (put-text-property start (point) 'compilation-annotation t))) + ;;;###autoload (defun compilation-start (command &optional mode name-function highlight-regexp continue) @@ -1975,17 +1983,16 @@ compilation-start (setq-local compilation-auto-jump-to-next t)) (when (zerop (buffer-size)) ;; Output a mode setter, for saving and later reloading this buffer. - (insert "-*- mode: " name-of-mode - "; default-directory: " - (prin1-to-string (abbreviate-file-name default-directory)) - " -*-\n")) - (insert (format "%s started at %s\n\n" - mode-name - (substring (current-time-string) 0 19)) - command "\n") - ;; Mark the end of the header so that we don't interpret - ;; anything in it as an error. - (put-text-property (1- (point)) (point) 'compilation-header-end t) + (compilation-insert-annotation + "-*- mode: " name-of-mode + "; default-directory: " + (prin1-to-string (abbreviate-file-name default-directory)) + " -*-\n")) + (compilation-insert-annotation + (format "%s started at %s\n\n" + mode-name + (substring (current-time-string) 0 19)) + command "\n") (setq thisdir default-directory)) (set-buffer-modified-p nil)) ;; Pop up the compilation buffer. @@ -2467,13 +2474,13 @@ compilation-handle-exit (cur-buffer (current-buffer))) ;; Record where we put the message, so we can ignore it later on. (goto-char omax) - (insert ?\n mode-name " " (car status)) + (compilation-insert-annotation ?\n mode-name " " (car status)) (if (and (numberp compilation-window-height) (zerop compilation-window-height)) (message "%s" (cdr status))) (if (bolp) (forward-char -1)) - (insert " at " (substring (current-time-string) 0 19)) + (compilation-insert-annotation " at " (substring (current-time-string) 0 19)) (goto-char (point-max)) ;; Prevent that message from being recognized as a compilation error. (add-text-properties omax (point) -- 2.39.2 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 25 13:02:08 2023 Received: (at 59888) by debbugs.gnu.org; 25 Feb 2023 18:02:08 +0000 Received: from localhost ([127.0.0.1]:41375 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVys4-00068x-DB for submit@debbugs.gnu.org; Sat, 25 Feb 2023 13:02:08 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:54733) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVys2-00068R-Tw for 59888@debbugs.gnu.org; Sat, 25 Feb 2023 13:02:07 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id EEBC3C0004; Sat, 25 Feb 2023 18:01:58 +0000 (UTC) From: Juri Linkov To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <871qme5ej3.fsf@gmail.com> (Augusto Stoffel's message of "Sat, 25 Feb 2023 09:34:56 +0100") Organization: LINKOV.NET References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> <871qme5ej3.fsf@gmail.com> Date: Sat, 25 Feb 2023 20:00:35 +0200 Message-ID: <86h6v9iq0s.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59888 Cc: Eli Zaretskii , stefankangas@gmail.com, 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > I've been using the grep-use-headings locally for a long time and it > works well. Should the the patches be installed? Thanks, I'd like to try out your patches for a few days. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 08:17:27 2023 Received: (at 59888) by debbugs.gnu.org; 26 Feb 2023 13:17:27 +0000 Received: from localhost ([127.0.0.1]:42577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWGu7-0007SY-Cc for submit@debbugs.gnu.org; Sun, 26 Feb 2023 08:17:27 -0500 Received: from mail-wm1-f49.google.com ([209.85.128.49]:36506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWGu5-0007SJ-BU for 59888@debbugs.gnu.org; Sun, 26 Feb 2023 08:17:26 -0500 Received: by mail-wm1-f49.google.com with SMTP id j19-20020a05600c191300b003eb3e1eb0caso736003wmq.1 for <59888@debbugs.gnu.org>; Sun, 26 Feb 2023 05:17:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=KnVezPHq+GdOoLqjyao/nGLEqem7qYUbuTLbilK7DwM=; b=AxoVmld9yNE0aUxi7e0QmG5J1gm7l9Um0197OlhPWZXuM9hHPGYcHe2mWSOzvdFlz8 g14rhOmtyhvZumWT9a/1u28t9g0+4v/r09gNqSCCAjgAlgpLf3/QuQ5jtQeoGEGUZ/3u dY0I+PjBRZX/ouYki5PkkieE2AD1Q5arQzqOpFtXjfpY6Fs2gFcHczqdTSYDVOgUnVdV uNX9n2tBrcrRJig9WKzC7F/MgJriUeLgK+dQc3ulzm4VLuCWr2EfGB4wZ75bOvECzfIW ImQ2AmL5KiEwTFmey+A70xC2BKRZA9w6JHUtBjrCNZ1eyHKGrLsCxgatqjScqKRoMpCu 0jRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KnVezPHq+GdOoLqjyao/nGLEqem7qYUbuTLbilK7DwM=; b=XFjqYJ1WHMOQuePi3kEBns/veDBbFuT68VwnAAqoSmxI16jMgeqLUnEnfNlAz12F2w pf1+MyVNitwCu/h6gaV+M9s0Ccx/Q+H3cwFDyKSE+BiNRwTTV8zplsTtNhdCpgDTRlZw g+Y+KH8c55b5KoQEwgx2ggzjBL4QQXBPGO73C18awEIjor4+wxTSW/9c1H/Z9QkzljWw 3pOR+UcUgMhvbcLKaj/P+/1h/nHShgNLsZAaFYFCmKBJqtmaPilD8Kufa56dNu/748dl NSL23i67+kwlZYmytt6Jpn9S1FLHXO2iBXB48hLeWeIUdVNOHdEU6snkMHWkgOApvljn 1J3w== X-Gm-Message-State: AO0yUKVDNQDrE7HLuWiyiyBtWA6L+GfepPIDhoANx5WNrh12JVOEwVQf ULjMppjbdv6hsAFGGrTHPLAUT5KBXBc= X-Google-Smtp-Source: AK7set9jAdRCd7u7ADguMd/95fkWUQA2DoMp2/2y4yhfox1X5UcJshXO/nXP04fpzbIcLtbdqv7eLw== X-Received: by 2002:a05:600c:34cb:b0:3eb:a4e:a2b2 with SMTP id d11-20020a05600c34cb00b003eb0a4ea2b2mr6998750wmq.4.1677417438830; Sun, 26 Feb 2023 05:17:18 -0800 (PST) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id l4-20020a05600c4f0400b003df7b40f99fsm10092954wmq.11.2023.02.26.05.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 05:17:18 -0800 (PST) From: Robert Pluim To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <871qme5ej3.fsf@gmail.com> (Augusto Stoffel's message of "Sat, 25 Feb 2023 09:34:56 +0100") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> <871qme5ej3.fsf@gmail.com> Date: Sun, 26 Feb 2023 14:17:17 +0100 Message-ID: <87cz5w7ehu.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: Eli Zaretskii , stefankangas@gmail.com, 59888@debbugs.gnu.org, Juri Linkov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Sat, 25 Feb 2023 09:34:56 +0100, Augusto Stoffel said: Augusto> I've been using the grep-use-headings locally for a long time = and it Augusto> works well. Should the the patches be installed? Augusto> From 77ea46f6dc50a8f463bd2f51ce9d0585de0bb55c Mon Sep 17 00:00= :00 2001 Augusto> From: Augusto Stoffel Augusto> Date: Wed, 7 Dec 2022 18:44:07 +0100 Augusto> Subject: [PATCH 2/2] New user option 'grep-use-headings' Augusto> * lisp/progmodes/grep.el (grep-heading-regexp): New user optio= n. Augusto> (grep-heading): New face. Augusto> (grep--heading-format, grep--heading-state, grep--heading-filt= er): Augusto> Filter function for grep processes and supporting variables. Augusto> (grep-use-headings): New user option. Augusto> (grep-mode): Use the above, if applicable. Augusto> --- Augusto> etc/NEWS | 8 ++++ Augusto> lisp/progmodes/grep.el | 69 ++++++++++++++++++++++= +++++++++ Augusto> test/lisp/progmodes/grep-tests.el | 14 +++++++ Augusto> 3 files changed, 91 insertions(+) Augusto> diff --git a/etc/NEWS b/etc/NEWS Augusto> index 4b0e4e6bd46..ca2e8011510 100644 Augusto> --- a/etc/NEWS Augusto> +++ b/etc/NEWS Augusto> @@ -95,6 +95,14 @@ If you want to get back the old behavior, s= et the user option to the value Augusto> (setopt gdb-locals-table-row-config Augusto> `((type . 0) (name . 0) (value . ,gdb-locals-valu= e-limit))) =20 Augusto> +** Compile Augusto> + Augusto> +*** New user option 'grep-use-headings'. Augusto> +When non-nil, the output of Grep is split into sections, one = for each Augusto> +file, instead of having file names prefixed to each line. It= is Augusto> +equivalent to the --heading option of some tools such as 'git= grep' Augusto> +and 'rg'. Augusto> + You also add a face and a user option for the regexp, they should be mentioned in NEWS (and the manual, if relevant) =20 Augusto> +(defvar grep--heading-format Augusto> + (eval-when-compile Augusto> + (let ((title (propertize "%s" Augusto> + 'font-lock-face 'grep-heading Augusto> + 'outline-level 1))) Augusto> + (propertize (concat title "\n") 'compilation-annotation= t))) Augusto> + "Format string of grep headings. Augusto> +This is passed to `format' with one argument, the text of the Augusto> +first capture group of `grep-heading-regexp'.") Augusto> + Augusto> +(defvar-local grep--heading-state nil Augusto> + "Variable to keep track of the `grep--heading-filter' state= .") Augusto> + Augusto> +(defun grep--heading-filter () Augusto> + "Filter function to add headings to output of a grep proces= s." Augusto> + (unless grep--heading-state Augusto> + (setq grep--heading-state (cons (point-min-marker) nil))) Augusto> + (save-excursion Augusto> + (let ((limit (car grep--heading-state))) Augusto> + ;; Move point to the old limit and update limit marker. Augusto> + (move-marker limit (prog1 (pos-bol) (goto-char limit))) Augusto> + (while (re-search-forward grep-heading-regexp limit t) Augusto> + (unless (get-text-property (point) 'compilation-annot= ation) Augusto> + (let ((heading (match-string-no-properties 1)) Augusto> + (start (match-beginning 2)) Augusto> + (end (match-end 2))) Augusto> + (when start Augusto> + (put-text-property start end 'invisible t)) Augusto> + (when (and heading (not (equal heading (cdr grep-= -heading-state)))) Augusto> + (save-excursion Augusto> + (forward-line 0) That=CA=BCs the same as (goto-char (pos-bol)) because of a wrinkle in the implementation of `forward-line'. It might even be faster, but I=CA=BCve not measured it :-) Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 10:07:24 2023 Received: (at 59888) by debbugs.gnu.org; 26 Feb 2023 15:07:25 +0000 Received: from localhost ([127.0.0.1]:44808 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWIcW-0002cY-Lz for submit@debbugs.gnu.org; Sun, 26 Feb 2023 10:07:24 -0500 Received: from mail-ed1-f46.google.com ([209.85.208.46]:37446) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWIcT-0002cL-Vv for 59888@debbugs.gnu.org; Sun, 26 Feb 2023 10:07:22 -0500 Received: by mail-ed1-f46.google.com with SMTP id d30so15973184eda.4 for <59888@debbugs.gnu.org>; Sun, 26 Feb 2023 07:07:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aMAWPiNZxbb0R2m6OIiLIiorEqpjpCQWaqCe2F9zatU=; b=aYZSiEV68znLbCv24S75A/Wt5z648L80zCDZastaybF+r1eTh2cZXUqlajebZ6iUva G5SRxf3vCBD4czP/ExfdEx0DGJEXgsfi/xJql/ACOJHz2qphATVLJILJ33msULhRoQR4 64jg7FxWF+lXgfsujfZpwdH94yO83EpESRDFG7whJz5umj6/5tRtK41W6LyVpl4h6uJi 5RJbmkJN4UKO+Pvd+z0W1Fwx3MiSDKEcYK/GnXLhNuWNBhXT/4Tf7bWp2KKoqQ3macLp uarvWm2R+mEQhE0d3S5Dr3dORJ9OsU8w5eDkRNsBYk0ZCnIPFo4wyvrVXBRPdhdSzx/C X6Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=aMAWPiNZxbb0R2m6OIiLIiorEqpjpCQWaqCe2F9zatU=; b=Cttp/GO1XXdfIcLZTRISRgDgS+uEn028tvfSabYxFTxV3Ua24w+EwNEnP+r140P2xD XJ1C1bTN1yEAp2KGUnfBPMb2AE38gn4U3LsztyVuLU2V4C4lzggiGBrHZ8LXnggbfTM2 PJUFCGLT1S8Lb0jOtopLorjk2BM/Hu63m+GTphJRdRXcCSBA4axBORYztTbU/bkPJJjg 2mgJUuiNrWtXHYDjuj/gdVv7/+P0kOmBIn4ayz8Xgo2qaWrwm+1S9wh190fY5z7wpekm DgUQbmJ+/LFgOW9cpNdpqQXfeqlFJkYLZO5d9soSdCWU25K9mFxt393m39xwH+NgKlK9 zvmg== X-Gm-Message-State: AO0yUKXYddlPWxf4/ghnYysxmMJSKGeHa8sxTR6pny/+cXpGp7B0nep5 tzWgIiiMGGgwSslKCVGsQs4Ybk3NdaaKyQ== X-Google-Smtp-Source: AK7set8CH/7mnkCWtS8V7MbCNlicVbhISgP9M22qXqvu9/9SMGIYZ4syWOcBSE7mxD2TTmiEKkMZqQ== X-Received: by 2002:a17:906:8595:b0:8b1:326e:5374 with SMTP id v21-20020a170906859500b008b1326e5374mr31945900ejx.46.1677424035619; Sun, 26 Feb 2023 07:07:15 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::8b3a]) by smtp.gmail.com with ESMTPSA id e6-20020a1709061e8600b008cecb8f374asm2064180ejj.0.2023.02.26.07.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 07:07:15 -0800 (PST) From: Augusto Stoffel To: Robert Pluim Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <87cz5w7ehu.fsf@gmail.com> (Robert Pluim's message of "Sun, 26 Feb 2023 14:17:17 +0100") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> <871qme5ej3.fsf@gmail.com> <87cz5w7ehu.fsf@gmail.com> Date: Sun, 26 Feb 2023 16:07:13 +0100 Message-ID: <87pm9wcvoe.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: Eli Zaretskii , stefankangas@gmail.com, 59888@debbugs.gnu.org, Juri Linkov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sun, 26 Feb 2023 at 14:17, Robert Pluim wrote: > You also add a face and a user option for the regexp, they should be > mentioned in NEWS (and the manual, if relevant) Thanks, I added the face to the NEWS (but not the regexp, which is not a user option although it can be modified if you are desperate). > Augusto> + (forward-line 0) > > That=CA=BCs the same as (goto-char (pos-bol)) because of a wrinkle in the > implementation of `forward-line'. It might even be faster, but I=CA=BCve > not measured it :-) Ugh, that was an anachronism. It will be fixed when I send the final patch. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 01:24:31 2023 Received: (at 59888) by debbugs.gnu.org; 27 Feb 2023 06:24:31 +0000 Received: from localhost ([127.0.0.1]:45692 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWWw3-0000tp-4e for submit@debbugs.gnu.org; Mon, 27 Feb 2023 01:24:31 -0500 Received: from mail-wr1-f42.google.com ([209.85.221.42]:37418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWWvz-0000tY-H0 for 59888@debbugs.gnu.org; Mon, 27 Feb 2023 01:24:29 -0500 Received: by mail-wr1-f42.google.com with SMTP id h14so4978331wru.4 for <59888@debbugs.gnu.org>; Sun, 26 Feb 2023 22:24:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1QBH7cF3wDmsxBpnEFAq4fv2GSElzZ4Fta5uhota76A=; b=GPyMBacCfBTHuAXYSFCRENXFHUtaCcIRiQ7WSeLOQHhV0pEekMYWChYs+tqB/HBm99 4YaSOwKZnrW9SyFKCi0rd9pYIpyUdG0O0QlLK4F2wR6tJ+Q/+B4ztlOWQLirno53S676 bsF8Ec9kI6lU2hXG7TBmv4vJRMOGZouzWs+j58a/F19GIydkU7c7A6whenBAS0I6/jiA CP8zEZqLoovp8dSPgNKwrRrEfj6+bK1g3BYaPhE0qHmMV3Gdludti8zb5+D9KX0UxO4m IRTTDt5si2zFSBMr3CyVNgtGLh10PspEW2OpvHSv2Tk/onV4wX91vClCnob7gbDapHvf txgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1QBH7cF3wDmsxBpnEFAq4fv2GSElzZ4Fta5uhota76A=; b=ZPRcYAtTWLfLwbJDA4C8q5U83FD1gbYzp5qeUPkz7DveXkwH9wZrh5MTryMBl2UOHm qr9X7sKTjTp31dBAI+sQegtq9BhjU98GaXdsaXcHRQMiMZUbnOYzYdso3meChfnQ/0IA kAmExwK2l5EoppeSzJzTtrVHLjenRYy9y1+P1xHd5Zz+mwpL9jTAP4oOli4nM3nmTYuU ObIexHKI08+Czt1jieUaF3EJhKs6fTqxug+u1y8V8slzX5S4rYs4GtkCTnJKpqYsmnCI C7Q80IzIurkhotVyMjDwp003AelVkW0Fs6GwpWT0YsxEtn3R8NlGpMLHf0GpDGs3rUwh bf/A== X-Gm-Message-State: AO0yUKWhJgo0NPd7TbS7FovX4bn4EzxkfkhnV6vA1H8snVJFgvzGd/03 n40jkV8Cx6yF9kHXFAX8vdg= X-Google-Smtp-Source: AK7set/vkfL3U1NojhGiiaZc79xOMMBBYQmGXzQraW+E+usIlHqEVbiL72u8gf3wn4mbPNEYjtiWJA== X-Received: by 2002:a05:6000:1146:b0:2c5:8c04:efbf with SMTP id d6-20020a056000114600b002c58c04efbfmr18094846wrx.13.1677479061318; Sun, 26 Feb 2023 22:24:21 -0800 (PST) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id i11-20020a05600c354b00b003eb2e685c7dsm8961812wmq.9.2023.02.26.22.24.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 22:24:20 -0800 (PST) From: Robert Pluim To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <87pm9wcvoe.fsf@gmail.com> (Augusto Stoffel's message of "Sun, 26 Feb 2023 16:07:13 +0100") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> <871qme5ej3.fsf@gmail.com> <87cz5w7ehu.fsf@gmail.com> <87pm9wcvoe.fsf@gmail.com> Date: Mon, 27 Feb 2023 07:24:19 +0100 Message-ID: <878rgj7hik.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: Eli Zaretskii , Juri Linkov , stefankangas@gmail.com, 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Sun, 26 Feb 2023 16:07:13 +0100, Augusto Stoffel said: Augusto> On Sun, 26 Feb 2023 at 14:17, Robert Pluim wrote: >> You also add a face and a user option for the regexp, they should be >> mentioned in NEWS (and the manual, if relevant) Augusto> Thanks, I added the face to the NEWS (but not the regexp, whic= h is not a Augusto> user option although it can be modified if you are desperate). It=CA=BCs a `defcustom', so by definition it=CA=BCs a user option. If you= =CA=BCre not expecting it to be modified, maybe make it a `defvar'. Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 06:26:19 2023 Received: (at 59888) by debbugs.gnu.org; 27 Feb 2023 11:26:20 +0000 Received: from localhost ([127.0.0.1]:46244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWbe7-0003Dh-MI for submit@debbugs.gnu.org; Mon, 27 Feb 2023 06:26:19 -0500 Received: from mail-ed1-f46.google.com ([209.85.208.46]:38876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWbe4-0003DR-NF for 59888@debbugs.gnu.org; Mon, 27 Feb 2023 06:26:17 -0500 Received: by mail-ed1-f46.google.com with SMTP id cy6so24363166edb.5 for <59888@debbugs.gnu.org>; Mon, 27 Feb 2023 03:26:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QXJUh+5SQ9u1Qcu9Id1+k6W6X1tFXvs0DU6u7Jgvo6U=; b=IjZ9/fFetATDrYUHnTPxuUYHAPY+HtxLu8mzsP110VHBf3sz6Kmgyzs8rYexmu53cH 3EUqrlNaGmGXLfeTPHSgkG+sUJPQuLujS0SXEXS5Q4b/QNuLm09zA8d1q/zIQvICCOZI 2kuQ25xrEhV6zCpQvu3S19wLX86PSIwDFd8FnUGJVP9KViaCwI8lb0qMzrvvr1Dx9z8C t8EcfC1D4G6us/yWxJTLXA0/LXGTHPHeOGCgZkMLceDd0WYD6oAEyO8BmORqWTQSKZjF X9UP0yzXXgsi+cGZBvgn1iIz5AP3lR87a6BXJHIsatwsTHcX8PUHx2HvQ5IOIXjxw576 WPIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QXJUh+5SQ9u1Qcu9Id1+k6W6X1tFXvs0DU6u7Jgvo6U=; b=b3xpJ9AoJzKf67nJxp2UGJaRQYuNmK/S3vFHZSjft103GEnbDUnPbAevDASTtBX8CD +SELfjIQ9f+Q34SRdJmOeLIO1PtUlgxj228UGWfHKlE/quCWKr36uR6Opc1kjkGmkGlw zXs/a49YVoLbXzLbux/ftklkNVRmtWSzhzvApb8fi/DE7yOPgwmLlr7v6za6QStFpDbh soLjE0tCnVGBNPdUxMkgAKK815vwK5lcY1M64KMZsQHGnHhlxz/J6luzasGL9CoNGRoF jMZ0FN2XJ6y4NrocoxUbGhgWYMSYhl4mh6U9K5E4a9tpDBIzCKsDEHbmsmdAcq+uWn2j kxQw== X-Gm-Message-State: AO0yUKXhzs4kAXIW4hqyENg83cEnyyS+3dSOHQ/IO3+HA223DCLSBAl8 JW8e6qF/W8DdhMknwxHXMhg= X-Google-Smtp-Source: AK7set8py5c6BnhsHi7ua1V25JbcT9TvlqU1RKDc+CKW2k5id9OWMrximrDIv33+BzR8HKLQr2PvdA== X-Received: by 2002:aa7:c489:0:b0:4ad:7056:23a5 with SMTP id m9-20020aa7c489000000b004ad705623a5mr24016319edq.14.1677497170516; Mon, 27 Feb 2023 03:26:10 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::8b3a]) by smtp.gmail.com with ESMTPSA id y28-20020a50ce1c000000b004acc61206cfsm3036233edi.33.2023.02.27.03.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 03:26:10 -0800 (PST) From: Augusto Stoffel To: Robert Pluim Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <878rgj7hik.fsf@gmail.com> (Robert Pluim's message of "Mon, 27 Feb 2023 07:24:19 +0100") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> <871qme5ej3.fsf@gmail.com> <87cz5w7ehu.fsf@gmail.com> <87pm9wcvoe.fsf@gmail.com> <878rgj7hik.fsf@gmail.com> Date: Mon, 27 Feb 2023 12:26:08 +0100 Message-ID: <877cw3ic33.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: Eli Zaretskii , Juri Linkov , stefankangas@gmail.com, 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Mon, 27 Feb 2023 at 07:24, Robert Pluim wrote: > It=CA=BCs a `defcustom', so by definition it=CA=BCs a user option. If you= =CA=BCre not > expecting it to be modified, maybe make it a `defvar'. Oops, I wrote this a couple months back and had forgotten. I don't know if you have an opinion. `grep-regexp-alist' is a defconst, which seems exaggerated, but `grep-match-regexp' is a defcustom although nobody should want to change this except to work around bugs. My new variable has a similar "degree of technicality" and I think that asks for be a defvar. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 09:18:34 2023 Received: (at 59888) by debbugs.gnu.org; 27 Feb 2023 14:18:34 +0000 Received: from localhost ([127.0.0.1]:46457 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWeKo-0004QN-AK for submit@debbugs.gnu.org; Mon, 27 Feb 2023 09:18:34 -0500 Received: from mail1478c50.megamailservers.eu ([91.136.14.78]:48970 helo=mail118c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWeKl-0004Q2-F4 for 59888@debbugs.gnu.org; Mon, 27 Feb 2023 09:18:33 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1677507504; bh=UzAvXOXq01sbDRX7e2/tVPhsn5nwBM/Q/M4cwOyIOtY=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=Nsvbc4virgSdwJgk7VqIsEQJj+w26UKYi2j5xgsohSJlXu6aJ3lIS5nx4fmD37+Fp HjU1vGjkelrlOpghsnTpdn+2sQFsdgxB5zKCoe8FD598GdvyyRqvtmNwgbpAGpY9fj pz0vEtv8T3SeCPkoYmdaAQ8/GzYIzQHXqmWTxV38= Feedback-ID: mattiase@acm.or Received: from smtpclient.apple (c188-150-171-209.bredband.tele2.se [188.150.171.209]) (authenticated bits=0) by mail118c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 31REILnY013175; Mon, 27 Feb 2023 14:18:23 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.14\)) Subject: Re: bug#59888: [PATCH] Add 'grep-heading-mode' From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: <9E8F141A-B8FF-46ED-9C9D-5F11FA9CC243@acm.org> Date: Mon, 27 Feb 2023 15:18:20 +0100 Content-Transfer-Encoding: 7bit Message-Id: <75BFA9CE-3663-40A7-A359-E8DE43C181E4@acm.org> References: <9DED6125-13ED-4BF6-83A1-E1B2C4249F24@acm.org> <87edtadw9k.fsf@gmail.com> <9E8F141A-B8FF-46ED-9C9D-5F11FA9CC243@acm.org> To: Augusto Stoffel X-Mailer: Apple Mail (2.3654.120.0.1.14) X-VADE-SPAMSTATE: clean X-VADE-SPAMSCORE: -100 X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrudeltddgiedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffquffvqffrkfetpdfqfgfvpdfgpfggqdevhedtnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpegtggfuhfgjffevgffkfhfvofesthejmhdthhdtvdenucfhrhhomhepofgrthhtihgrshcugfhnghguvghgnohrugcuoehmrghtthhirghsvgesrggtmhdrohhrgheqnecuggftrfgrthhtvghrnhepgfeufeelteduvedvkeevvdfhgeehjedvjeeigedvudefheegffejudefjefhjeffnecukfhppedukeekrdduhedtrddujedurddvtdelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudekkedrudehtddrudejuddrvddtledphhgvlhhopehsmhhtphgtlhhivghnthdrrghpphhlvgdpmhgrihhlfhhrohhmpehmrghtthhirghsvgesrggtmhdrohhrghdpnhgspghrtghpthhtohepvddprhgtphhtthhopegrrhhsthhofhhfvghlsehgmhgrihhlrdgtohhmpdhrtghpthhtohepheelkeekkeesuggvsggsuhhgshdrghhnuhdrohhrgh X-Origin-Country: SE X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) > +(eval-when-compile (require 'rx)) Is this needed? The `rx` macro is autoloaded. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 11:51:44 2023 Received: (at 59888) by debbugs.gnu.org; 27 Feb 2023 16:51:44 +0000 Received: from localhost ([127.0.0.1]:48682 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWgj1-0005qK-TY for submit@debbugs.gnu.org; Mon, 27 Feb 2023 11:51:44 -0500 Received: from mail-wr1-f47.google.com ([209.85.221.47]:35634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWgiz-0005q2-Ar for 59888@debbugs.gnu.org; Mon, 27 Feb 2023 11:51:42 -0500 Received: by mail-wr1-f47.google.com with SMTP id q16so6950200wrw.2 for <59888@debbugs.gnu.org>; Mon, 27 Feb 2023 08:51:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ADsKHk+26fr3BzkSHS/pLm1KXVOcVh4rlR3T2V4RbAI=; b=FGFWwLXc5uY1tev+ysc538npuNlqJjxIGAvAMNm1mOwu55nKalF3gcH2Ol3MrXoLWp 2eLHZRrUvz1O1gThSMHVRMlhg4TbLRZumhVlFxUs/UWLThfZfRoHddtNw4UT8cIjXGr7 Fmim4bl4BZTKDZVWryeVXcpq9ZXX6r2wqaIjt4yCLz9lszIXpG7NAHy5V4Iwcn1ZY/1g SvXoN3PW5Yqm/nLtQNxiZFV8Z+twi36QF0dlAt1W8TjMzQUGp2p97iJtlVak4KWHpg9t u4twg8JCm3vRMOn1PPxtmggBQXXyzIjEsc+W/0k5SnOd0lxUE3QQTEKA+RfSkcWo1A77 p6HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ADsKHk+26fr3BzkSHS/pLm1KXVOcVh4rlR3T2V4RbAI=; b=Kv9i0tJVoH4owzDy2MJw0MeD0qhk00US9m+y+ACCHQY4bNu1HZJkJ5fteM0J2WlqNa VDApZ+srOPVHBB/7q7NSD1LIXhsIq5IZ1vVlI2FoSa3GXryIUy7zu65LEdWRDAlO0G2r 9GLYfx/iC0WagpoqQmz7XgA5H+EiPo5Fg60GnvZBxstHlkO8jR8sYnez2wtLU35CiFdl pwowgUl/0juvJnNZ1rDFhPby3fqdYFDM/hQlU/RIJawcROaTHqRbOxWH47NrTjkRwIY9 ors/x6wmbnXQxi3zwnt57RDWszZxTRLKyauhcSq/65QEXudxQkdvRYte1gSRnkbR/LUA IDJg== X-Gm-Message-State: AO0yUKV7I0sIT0JMLokAUvpmmq1VRhn6Fj/K6aUNUjBPwRzmUaCvhveS IzwlPSpeKb7q1Xb5x1SepHaVDilNwIE= X-Google-Smtp-Source: AK7set/FGl3oT9Kj0sIej0ImkhkS2ulGzBdLWZ9Ei3GTSRM8YRjQzJNX5JGPdT2M0AS8c9k1rmbdcg== X-Received: by 2002:adf:de88:0:b0:2ca:de61:b234 with SMTP id w8-20020adfde88000000b002cade61b234mr4588049wrl.51.1677516694757; Mon, 27 Feb 2023 08:51:34 -0800 (PST) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id m4-20020a05600c4f4400b003e209b45f6bsm14227576wmq.29.2023.02.27.08.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 08:51:34 -0800 (PST) From: Robert Pluim To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <877cw3ic33.fsf@gmail.com> (Augusto Stoffel's message of "Mon, 27 Feb 2023 12:26:08 +0100") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> <871qme5ej3.fsf@gmail.com> <87cz5w7ehu.fsf@gmail.com> <87pm9wcvoe.fsf@gmail.com> <878rgj7hik.fsf@gmail.com> <877cw3ic33.fsf@gmail.com> Date: Mon, 27 Feb 2023 17:51:33 +0100 Message-ID: <87v8jn59wq.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: Eli Zaretskii , stefankangas@gmail.com, 59888@debbugs.gnu.org, Juri Linkov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Mon, 27 Feb 2023 12:26:08 +0100, Augusto Stoffel said: Augusto> On Mon, 27 Feb 2023 at 07:24, Robert Pluim wrote: >> It=CA=BCs a `defcustom', so by definition it=CA=BCs a user option. I= f you=CA=BCre not >> expecting it to be modified, maybe make it a `defvar'. Augusto> Oops, I wrote this a couple months back and had forgotten. Augusto> I don't know if you have an opinion. `grep-regexp-alist' is a= defconst, Augusto> which seems exaggerated, but `grep-match-regexp' is a defcusto= m although Augusto> nobody should want to change this except to work around bugs. Augusto> My new variable has a similar "degree of technicality" and I t= hink that Augusto> asks for be a defvar. I think I agree. Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 13:54:21 2023 Received: (at 59888) by debbugs.gnu.org; 27 Feb 2023 18:54:21 +0000 Received: from localhost ([127.0.0.1]:48794 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWidh-0003FD-7F for submit@debbugs.gnu.org; Mon, 27 Feb 2023 13:54:21 -0500 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:57021) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWidd-0003Ew-DU for 59888@debbugs.gnu.org; Mon, 27 Feb 2023 13:54:19 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id EB76520008; Mon, 27 Feb 2023 18:54:06 +0000 (UTC) From: Juri Linkov To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <87pm9wcvoe.fsf@gmail.com> (Augusto Stoffel's message of "Sun, 26 Feb 2023 16:07:13 +0100") Organization: LINKOV.NET References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> <871qme5ej3.fsf@gmail.com> <87cz5w7ehu.fsf@gmail.com> <87pm9wcvoe.fsf@gmail.com> Date: Mon, 27 Feb 2023 20:53:44 +0200 Message-ID: <86y1oj9byf.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59888 Cc: Robert Pluim , Eli Zaretskii , 59888@debbugs.gnu.org, stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> Thatʼs the same as (goto-char (pos-bol)) because of a wrinkle in the >> implementation of `forward-line'. It might even be faster, but Iʼve >> not measured it :-) > > Ugh, that was an anachronism. It will be fixed when I send the final > patch. I tried out your patch, and everything works nicely. So I guess it could be pushed when you send the final version. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 14:06:21 2023 Received: (at 59888) by debbugs.gnu.org; 27 Feb 2023 19:06:21 +0000 Received: from localhost ([127.0.0.1]:48820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWipJ-0005yg-4p for submit@debbugs.gnu.org; Mon, 27 Feb 2023 14:06:21 -0500 Received: from mail-ed1-f43.google.com ([209.85.208.43]:34690) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWipD-0005yN-TD for 59888@debbugs.gnu.org; Mon, 27 Feb 2023 14:06:20 -0500 Received: by mail-ed1-f43.google.com with SMTP id cq23so30154868edb.1 for <59888@debbugs.gnu.org>; Mon, 27 Feb 2023 11:06:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=l9hZd8vSpc0sEgpNKVqeufwyzTU0YesKGVE7fyTM6Ws=; b=jFIxK7MjUTtZ0wTqdwerJPewK9dcHgwdpoHHcLUjyI6m2+VOsNa/ipjjYXhYAajUvG EJaeb4qTtjD/Cr081dB49dmqDYu+44QnjiHPITP420nleXVBt9kRPAr5S9a4HR9nwtXX 1xkrgrvM1inSMXJr86hBcNzE7l/16P+ykl27ITcrGHk0DllPxzTAolGYHGwVdCquCUM9 4xtizEgwU/pwF+U9jO3PjACuzJHBmztb+66jWBkfuq4tBvCIbR845xxGGa+BpP/kMHAt TbcnXhW1pmzvuk9N3EHQS4oUXDIvEJoLtCENcPOikg1A0etnQdvGl5KrHs74nFyzIvUs +zKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=l9hZd8vSpc0sEgpNKVqeufwyzTU0YesKGVE7fyTM6Ws=; b=MdwpKBu/LaZp2YCRWE5lbsc/mCOOZ9vwjkDOeie0xgYGIfrGADKufXIjqrrbWmOs1f 5Bgxojklfx7KMLtrEbOmO8Sc3JPK4bOayvDV/kOSblG4+65SfGV72Igyy7p5UsV01Rg9 0nurnLZFH8xP1D0/5jfMrnynbf8pmJgbYetYn2FsasWzxHGfc7PgbKjJCptfJPOJHRzu T3ddrU8jLetfpovrqeQiCxV/yIYe1RJceqrcn6MRTj4uZMPvqmfFFm0hkZQtHE8GWOwO Wosl5voynIgJTm2nK+TythHaJ7BFL3kVl3qGXS1g2G2FI/gV5a1hKG7FPghGmK/9wCRh ccYQ== X-Gm-Message-State: AO0yUKWm3/0axiy7YoGyoMH1/ex0guhXNgXT3aQbucsQ83+sNo2I13Qm B06LgzLLahca3pF3T5fM2K/WJXmBncOAQw== X-Google-Smtp-Source: AK7set9fAJu8J9ml9gEwntMue63qr8AYY9HG3dtlnIswBSvOn7q0hDzT5FM0RzkX7nl89agl/qLXuw== X-Received: by 2002:a05:6402:20a:b0:4ac:bde4:ff14 with SMTP id t10-20020a056402020a00b004acbde4ff14mr509509edv.42.1677524769406; Mon, 27 Feb 2023 11:06:09 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::8b3a]) by smtp.gmail.com with ESMTPSA id 13-20020a508e0d000000b004af6e957b22sm3520148edw.6.2023.02.27.11.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 11:06:08 -0800 (PST) From: Augusto Stoffel To: Juri Linkov Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <86y1oj9byf.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 27 Feb 2023 20:53:44 +0200") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> <871qme5ej3.fsf@gmail.com> <87cz5w7ehu.fsf@gmail.com> <87pm9wcvoe.fsf@gmail.com> <86y1oj9byf.fsf@mail.linkov.net> Date: Mon, 27 Feb 2023 20:06:07 +0100 Message-ID: <87cz5vc4io.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: Robert Pluim , Eli Zaretskii , 59888@debbugs.gnu.org, stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain On Mon, 27 Feb 2023 at 20:53, Juri Linkov wrote: > I tried out your patch, and everything works nicely. > So I guess it could be pushed when you send the final version. There you go :-) --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0002-New-user-option-grep-use-headings.patch Content-Transfer-Encoding: quoted-printable >From d141b5c31718bf312cd06cd85c2865621753ad7b Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Wed, 7 Dec 2022 18:44:07 +0100 Subject: [PATCH 2/2] New user option 'grep-use-headings' * lisp/progmodes/grep.el (grep-heading-regexp): New user option. (grep-heading): New face. (grep--heading-format, grep--heading-state, grep--heading-filter): Filter function for grep processes and supporting variables. (grep-use-headings): New user option. (grep-mode): Use the above, if applicable. --- etc/NEWS | 9 +++++ lisp/progmodes/grep.el | 66 +++++++++++++++++++++++++++++++ test/lisp/progmodes/grep-tests.el | 14 +++++++ 3 files changed, 89 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 4b0e4e6bd46..58bbd083ef8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -95,6 +95,15 @@ If you want to get back the old behavior, set the user o= ption to the value (setopt gdb-locals-table-row-config `((type . 0) (name . 0) (value . ,gdb-locals-value-limit))) =20 +** Compile + +*** New user option 'grep-use-headings'. +When non-nil, the output of Grep is split into sections, one for each +file, instead of having file names prefixed to each line. It is +equivalent to the --heading option of some tools such as 'git grep' +and 'rg'. The headings are displayed using the new 'grep-heading' +face. + ** VC =20 --- diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 0da16b44dda..82e9c5d8edf 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -457,6 +457,33 @@ grep-search-path :type '(repeat (choice (const :tag "Default" nil) (string :tag "Directory")))) =20 +(defcustom grep-use-headings nil + "If non-nil, subdivide grep output into sections, one per file." + :type 'boolean + :version "30.1") + +(defface grep-heading `((t :inherit ,grep-hit-face)) + "Face of headings when `grep-use-headings' is non-nil." + :version "30.1") + +(defvar grep-heading-regexp + (rx bol + (or + (group-n 2 + (group-n 1 (+ (not (any 0 ?\n)))) + 0) + (group-n 2 + (group-n 1 (+? nonl)) + (any ?: ?- ?=3D))) + (+ digit) + (any ?: ?- ?=3D)) + "Regexp used to create headings from grep output lines. +It should be anchored at beginning of line. The first capture +group, if present, should match the heading associated to the +line. The buffer range of the second capture, if present, is +made invisible (presumably because displaying it would be +redundant).") + (defvar grep-find-abbreviate-properties (let ((ellipsis (if (char-displayable-p ?=E2=80=A6) "[=E2=80=A6]" "[...]= ")) (map (make-sparse-keymap))) @@ -612,6 +639,40 @@ grep-filter (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1) (replace-match "" t t)))))) =20 +(defvar grep--heading-format + (eval-when-compile + (let ((title (propertize "%s" + 'font-lock-face 'grep-heading + 'outline-level 1))) + (propertize (concat title "\n") 'compilation-annotation t))) + "Format string of grep headings. +This is passed to `format' with one argument, the text of the +first capture group of `grep-heading-regexp'.") + +(defvar-local grep--heading-state nil + "Variable to keep track of the `grep--heading-filter' state.") + +(defun grep--heading-filter () + "Filter function to add headings to output of a grep process." + (unless grep--heading-state + (setq grep--heading-state (cons (point-min-marker) nil))) + (save-excursion + (let ((limit (car grep--heading-state))) + ;; Move point to the old limit and update limit marker. + (move-marker limit (prog1 (pos-bol) (goto-char limit))) + (while (re-search-forward grep-heading-regexp limit t) + (unless (get-text-property (point) 'compilation-annotation) + (let ((heading (match-string-no-properties 1)) + (start (match-beginning 2)) + (end (match-end 2))) + (when start + (put-text-property start end 'invisible t)) + (when (and heading (not (equal heading (cdr grep--heading-stat= e)))) + (save-excursion + (goto-char (pos-bol)) + (insert-before-markers (format grep--heading-format headin= g))) + (setf (cdr grep--heading-state) heading)))))))) + (defun grep-probe (command args &optional func result) (let (process-file-side-effects) (equal (condition-case nil @@ -906,6 +967,11 @@ grep-mode (add-function :filter-return (local 'kill-transform-function) (lambda (string) (string-replace "\0" ":" string))) + (when grep-use-headings + (add-hook 'compilation-filter-hook #'grep--heading-filter 80 t) + (setq-local outline-search-function #'outline-search-level + outline-level (lambda () (get-text-property + (point) 'outline-level)))) (add-hook 'compilation-filter-hook #'grep-filter nil t)) =20 (defun grep--save-buffers () diff --git a/test/lisp/progmodes/grep-tests.el b/test/lisp/progmodes/grep-t= ests.el index 39307999d6d..9b7f83086bf 100644 --- a/test/lisp/progmodes/grep-tests.el +++ b/test/lisp/progmodes/grep-tests.el @@ -66,4 +66,18 @@ grep-tests--rgrep-abbreviate-properties-windows-nt-sh-se= mantics (cl-letf (((symbol-function 'w32-shell-dos-semantics) #'ignore)) (grep-tests--check-rgrep-abbreviation)))) =20 +(ert-deftest grep-tests--grep-heading-regexp-without-null () + (dolist (sep '(?: ?- ?=3D)) + (let ((string (format "filename%c123%ctext" sep sep))) + (should (string-match grep-heading-regexp string)) + (should (equal (match-string 1 string) "filename")) + (should (equal (match-string 2 string) (format "filename%c" sep)))))) + +(ert-deftest grep-tests--grep-heading-regexp-with-null () + (dolist (sep '(?: ?- ?=3D)) + (let ((string (format "funny:0:filename%c123%ctext" 0 sep))) + (should (string-match grep-heading-regexp string)) + (should (equal (match-string 1 string) "funny:0:filename")) + (should (equal (match-string 2 string) "funny:0:filename\0"))))) + ;;; grep-tests.el ends here --=20 2.39.2 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Introduce-compilation-annotation-text-property.patch >From 8660f5cc050ecf3789574cfc11544b5950b8e949 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Thu, 8 Dec 2022 21:05:10 +0100 Subject: [PATCH 1/2] Introduce 'compilation-annotation' text property It is meant to mark parts of compilation buffers which do not correspond to process output. * lisp/progmodes/compile.el (compilation-insert-annotation): New function. (compilation-start, compilation-handle-exit): Use it. (compilation--ensure-parse) Rely on 'compilation-annotation' property instead of 'compilation-header-end'. --- lisp/progmodes/compile.el | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index ccf64fb670b..6d151db8a83 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1706,7 +1706,7 @@ compilation--ensure-parse (set-marker (make-marker) (save-excursion (goto-char (point-min)) - (text-property-search-forward 'compilation-header-end) + (text-property-search-forward 'compilation-annotation) ;; If we have no end marker, this will be ;; `point-min' still. (point))))) @@ -1854,6 +1854,14 @@ compilation--update-in-progress-mode-line ;; buffers when it changes from nil to non-nil or vice-versa. (unless compilation-in-progress (force-mode-line-update t))) +(defun compilation-insert-annotation (&rest args) + "Insert ARGS at point, adding the `compilation-annotation' text property. +This property is used to distinguish output of the compilation +process from additional information inserted by Emacs." + (let ((start (point))) + (apply #'insert args) + (put-text-property start (point) 'compilation-annotation t))) + ;;;###autoload (defun compilation-start (command &optional mode name-function highlight-regexp continue) @@ -1975,17 +1983,16 @@ compilation-start (setq-local compilation-auto-jump-to-next t)) (when (zerop (buffer-size)) ;; Output a mode setter, for saving and later reloading this buffer. - (insert "-*- mode: " name-of-mode - "; default-directory: " - (prin1-to-string (abbreviate-file-name default-directory)) - " -*-\n")) - (insert (format "%s started at %s\n\n" - mode-name - (substring (current-time-string) 0 19)) - command "\n") - ;; Mark the end of the header so that we don't interpret - ;; anything in it as an error. - (put-text-property (1- (point)) (point) 'compilation-header-end t) + (compilation-insert-annotation + "-*- mode: " name-of-mode + "; default-directory: " + (prin1-to-string (abbreviate-file-name default-directory)) + " -*-\n")) + (compilation-insert-annotation + (format "%s started at %s\n\n" + mode-name + (substring (current-time-string) 0 19)) + command "\n") (setq thisdir default-directory)) (set-buffer-modified-p nil)) ;; Pop up the compilation buffer. @@ -2467,13 +2474,13 @@ compilation-handle-exit (cur-buffer (current-buffer))) ;; Record where we put the message, so we can ignore it later on. (goto-char omax) - (insert ?\n mode-name " " (car status)) + (compilation-insert-annotation ?\n mode-name " " (car status)) (if (and (numberp compilation-window-height) (zerop compilation-window-height)) (message "%s" (cdr status))) (if (bolp) (forward-char -1)) - (insert " at " (substring (current-time-string) 0 19)) + (compilation-insert-annotation " at " (substring (current-time-string) 0 19)) (goto-char (point-max)) ;; Prevent that message from being recognized as a compilation error. (add-text-properties omax (point) -- 2.39.2 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 14:18:04 2023 Received: (at 59888) by debbugs.gnu.org; 27 Feb 2023 19:18:04 +0000 Received: from localhost ([127.0.0.1]:48852 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWj0e-0006KK-2E for submit@debbugs.gnu.org; Mon, 27 Feb 2023 14:18:04 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:53157) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWj0c-0006Jk-JD; Mon, 27 Feb 2023 14:18:03 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 7BD54240007; Mon, 27 Feb 2023 19:17:54 +0000 (UTC) From: Juri Linkov To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <87cz5vc4io.fsf@gmail.com> (Augusto Stoffel's message of "Mon, 27 Feb 2023 20:06:07 +0100") Organization: LINKOV.NET References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> <871qme5ej3.fsf@gmail.com> <87cz5w7ehu.fsf@gmail.com> <87pm9wcvoe.fsf@gmail.com> <86y1oj9byf.fsf@mail.linkov.net> <87cz5vc4io.fsf@gmail.com> Date: Mon, 27 Feb 2023 21:15:57 +0200 Message-ID: <86r0uaaphu.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59888 Cc: Robert Pluim , Eli Zaretskii , 59888@debbugs.gnu.org, stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) close 59888 30.0.50 thanks >> I tried out your patch, and everything works nicely. >> So I guess it could be pushed when you send the final version. > > There you go :-) Thanks for this useful feature. Now pushed to master. (And immediately customized it to t ;-) From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 12:34:23 2023 Received: (at 59888) by debbugs.gnu.org; 28 Feb 2023 17:34:23 +0000 Received: from localhost ([127.0.0.1]:51917 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pX3rr-0006lb-0e for submit@debbugs.gnu.org; Tue, 28 Feb 2023 12:34:23 -0500 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:48873) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pX3rl-0006kq-Iw for 59888@debbugs.gnu.org; Tue, 28 Feb 2023 12:34:18 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id C3C15240009; Tue, 28 Feb 2023 17:34:08 +0000 (UTC) From: Juri Linkov To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <87cz5vc4io.fsf@gmail.com> (Augusto Stoffel's message of "Mon, 27 Feb 2023 20:06:07 +0100") Organization: LINKOV.NET References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> <871qme5ej3.fsf@gmail.com> <87cz5w7ehu.fsf@gmail.com> <87pm9wcvoe.fsf@gmail.com> <86y1oj9byf.fsf@mail.linkov.net> <87cz5vc4io.fsf@gmail.com> Date: Tue, 28 Feb 2023 19:24:58 +0200 Message-ID: <86r0u9oj4p.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > +(defvar grep-heading-regexp > + (rx bol > + (or > + (group-n 2 > + (group-n 1 (+ (not (any 0 ?\n)))) > + 0) > + (group-n 2 > + (group-n 1 (+? nonl)) > + (any ?: ?- ?=))) > + (+ digit) > + (any ?: ?- ?=)) I wonder what is the reason for this regexp to be different from grep-regexp-alist? Especially with such additional characters as ?- and ?=. This mismatch causes wrong handling of files when file names contain these characters. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 13:17:56 2023 Received: (at 59888) by debbugs.gnu.org; 28 Feb 2023 18:17:56 +0000 Received: from localhost ([127.0.0.1]:51984 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pX4Xz-0007u2-TN for submit@debbugs.gnu.org; Tue, 28 Feb 2023 13:17:56 -0500 Received: from mail-ed1-f47.google.com ([209.85.208.47]:35576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pX4Xx-0007tp-Jt for 59888@debbugs.gnu.org; Tue, 28 Feb 2023 13:17:54 -0500 Received: by mail-ed1-f47.google.com with SMTP id ee7so43859868edb.2 for <59888@debbugs.gnu.org>; Tue, 28 Feb 2023 10:17:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=ykJDx0bSBsVr5agDGXRRvWH0gFWi6b+tiXm4L5G+WPQ=; b=ab+/hSmkqOJvfnMI5Ptji8AGFkRjZICkRnb4SNJmB+X1o5OsUndNPynHInrmg6ER+O AV0fo19HGzq+7C5FHFDjmprMIU9h117wzZqWNYPK+lp0INKYvTN29sgrejFGgbedalbz M2aYq0Tj5gIt+u1Qp+xS4jJmLt2PC8EpcPonV6o+Rufq+2Ra4M2gaCMjGmQ8wrqQun9/ RDuLJKVscr94LPa64R9KqA+q0XKgZjkg6RjjRk7NpsgKnqgEZTHCmzCC81TQZsHL/TJ7 1heaMHi8gJB8q6jX3vimv/dtnGLHMGeVZgbnhkzxQib5Qsl51xDw06suyDB/A3IRQHZI p9pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ykJDx0bSBsVr5agDGXRRvWH0gFWi6b+tiXm4L5G+WPQ=; b=SAkNUzT8+ASXkNBZN8OumpWkFm4mvek9QKlGHJGg27JRi53rx+lNlVSOM+YksA2dhG 69xP2ZIX3rO1auI8K+2oJDao/+UdJe5DnsbS8ikSmXj+3kB+l3RLThvo3zkXwi9gC1Tn DStLQws3y1pW2Q2sQYXbg9YnrgxyjvdkVh0H/oQt55YYFNOKE0FsLqAqYzaocIi4x0fz o/IBOoS4C0Xd3+zsHb0AIMjHmR/IpkTBhXt3nkRZdNk/Mzyc92MDj+Q4H2BAztGktxLR JXGnAaxt7GyeltRvTSjUqOCznuDLtJc8C2Gj8nUtRCHg/9rcNAWbmGSeu+Twodt2QX6g n2tg== X-Gm-Message-State: AO0yUKVcugxB8Lg6qemVli/ElgfY0zGLBPgJVdzON8JoCZwD5QYUXI50 6eKrAtfGKOJEPrj5rr5iaUSniB+0U6TOzA== X-Google-Smtp-Source: AK7set+mPu91OSuexDejge4DRdOHOAawNJB7qOVbodp1ZtDroKsZPw5IDSILHylH+veEhVCk1L1ueg== X-Received: by 2002:a05:6402:3458:b0:4af:6c28:337a with SMTP id l24-20020a056402345800b004af6c28337amr3915656edc.36.1677608267099; Tue, 28 Feb 2023 10:17:47 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::8b3a]) by smtp.gmail.com with ESMTPSA id x2-20020a50d602000000b004acd14ab4dfsm4675320edi.41.2023.02.28.10.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 10:17:46 -0800 (PST) From: Augusto Stoffel To: Juri Linkov Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <86r0u9oj4p.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 28 Feb 2023 19:24:58 +0200") References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> <871qme5ej3.fsf@gmail.com> <87cz5w7ehu.fsf@gmail.com> <87pm9wcvoe.fsf@gmail.com> <86y1oj9byf.fsf@mail.linkov.net> <87cz5vc4io.fsf@gmail.com> <86r0u9oj4p.fsf@mail.linkov.net> Date: Tue, 28 Feb 2023 19:17:45 +0100 Message-ID: <871qm9bqnq.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Tue, 28 Feb 2023 at 19:24, Juri Linkov wrote: >> +(defvar grep-heading-regexp >> + (rx bol >> + (or >> + (group-n 2 >> + (group-n 1 (+ (not (any 0 ?\n)))) >> + 0) >> + (group-n 2 >> + (group-n 1 (+? nonl)) >> + (any ?: ?- ?=))) >> + (+ digit) >> + (any ?: ?- ?=)) > > I wonder what is the reason for this regexp to be different > from grep-regexp-alist? Especially with such additional characters > as ?- and ?=. This mismatch causes wrong handling of files when > file names contain these characters. This is because of context lines: --8<---------------cut here---------------start------------->8--- $ git grep -nC 1 grep-use-headings etc/NEWS-99- etc/NEWS:100:*** New user option 'grep-use-headings'. etc/NEWS-101-When non-nil, the output of Grep is split into sections, one for each -- lisp/progmodes/grep.el-459- lisp/progmodes/grep.el:460:(defcustom grep-use-headings nil lisp/progmodes/grep.el-461- "If non-nil, subdivide grep output into sections, one per file." -- lisp/progmodes/grep.el-465-(defface grep-heading `((t :inherit ,grep-hit-face)) lisp/progmodes/grep.el:466: "Face of headings when `grep-use-headings' is non-nil." lisp/progmodes/grep.el-467- :version "30.1") -- lisp/progmodes/grep.el-969- (string-replace "\0" ":" string))) lisp/progmodes/grep.el:970: (when grep-use-headings lisp/progmodes/grep.el-971- (add-hook 'compilation-filter-hook #'grep--heading-filter 80 t) --8<---------------cut here---------------end--------------->8--- (I forget which program uses the =LINE= syntax) At least when using grep --null, I think there is no confusion possible. I wrote a unit test that purports to prove that. From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 01 12:58:13 2023 Received: (at 59888) by debbugs.gnu.org; 1 Mar 2023 17:58:13 +0000 Received: from localhost ([127.0.0.1]:54851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXQiS-0003lk-W9 for submit@debbugs.gnu.org; Wed, 01 Mar 2023 12:58:13 -0500 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:39675) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXQiR-0003lT-5x for 59888@debbugs.gnu.org; Wed, 01 Mar 2023 12:58:11 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id A4C8B2000E; Wed, 1 Mar 2023 17:58:02 +0000 (UTC) From: Juri Linkov To: Augusto Stoffel Subject: Re: bug#59888: [PATCH] Add 'grep-use-headings' In-Reply-To: <871qm9bqnq.fsf@gmail.com> (Augusto Stoffel's message of "Tue, 28 Feb 2023 19:17:45 +0100") Organization: LINKOV.NET References: <87v8mndrla.fsf@gmail.com> <87ilime025.fsf@gmail.com> <86359pm55x.fsf@mail.linkov.net> <87o7scdb45.fsf_-_@gmail.com> <837cz0z7wj.fsf@gnu.org> <87k0301h16.fsf@gmail.com> <831qp8z5gp.fsf@gnu.org> <87sfhn3tui.fsf@gmail.com> <83wn6zui9n.fsf@gnu.org> <87ilii41p9.fsf@gmail.com> <867cytgk0k.fsf@mail.linkov.net> <871qme5ej3.fsf@gmail.com> <87cz5w7ehu.fsf@gmail.com> <87pm9wcvoe.fsf@gmail.com> <86y1oj9byf.fsf@mail.linkov.net> <87cz5vc4io.fsf@gmail.com> <86r0u9oj4p.fsf@mail.linkov.net> <871qm9bqnq.fsf@gmail.com> Date: Wed, 01 Mar 2023 19:52:53 +0200 Message-ID: <86o7pcpduq.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 59888 Cc: 59888@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >>> + (any ?: ?- ?=)) >> >> I wonder what is the reason for this regexp to be different >> from grep-regexp-alist? Especially with such additional characters >> as ?- and ?=. This mismatch causes wrong handling of files when >> file names contain these characters. > > This is because of context lines: > > $ git grep -nC 1 grep-use-headings > lisp/progmodes/grep.el-459- > lisp/progmodes/grep.el:460:(defcustom grep-use-headings nil > lisp/progmodes/grep.el-461- "If non-nil, subdivide grep output into sections, one per file." > ... > At least when using grep --null, I think there is no confusion possible. I > wrote a unit test that purports to prove that. Thanks for mentioning --null, I completely forgot about it. I've customized 'grep-find-template' to "rg --no-heading" because ripgrep is fast, but since its headings are not supported by grep.el, so also needed "--no-heading". And now after adding "--null" to "rg --no-heading --null" 'grep-use-headings' correctly handles context lines and file names with numbers separated by dashes. From unknown Sun Sep 07 16:50:55 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 30 Mar 2023 11:24:13 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator