From unknown Sun Jun 22 17:11:33 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#8252 <8252@debbugs.gnu.org> To: bug#8252 <8252@debbugs.gnu.org> Subject: Status: Please add a function to get files in *grep* Reply-To: bug#8252 <8252@debbugs.gnu.org> Date: Mon, 23 Jun 2025 00:11:33 +0000 retitle 8252 Please add a function to get files in *grep* reassign 8252 emacs submitter 8252 Lennart Borgman severity 8252 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 14 17:46:40 2011 Received: (at submit) by debbugs.gnu.org; 14 Mar 2011 21:46:41 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PzFb5-0003kL-K1 for submit@debbugs.gnu.org; Mon, 14 Mar 2011 17:46:39 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PzFb4-0003k5-0T for submit@debbugs.gnu.org; Mon, 14 Mar 2011 17:46:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzFax-0006mh-UP for submit@debbugs.gnu.org; Mon, 14 Mar 2011 17:46:32 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:47354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzFax-0006mc-Oi for submit@debbugs.gnu.org; Mon, 14 Mar 2011 17:46:31 -0400 Received: from [140.186.70.92] (port=57944 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzFaw-00081s-69 for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2011 17:46:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzFau-0006mH-JV for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2011 17:46:29 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:59632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzFau-0006m6-E3 for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2011 17:46:28 -0400 Received: by wwc33 with SMTP id 33so5257026wwc.30 for ; Mon, 14 Mar 2011 14:46:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=qOanDbkM4hB/Z5Gq0SHpWNYZc7YMh087CwlanWJ70yg=; b=VFhYB/qpf/Kg/2ZgoE50YmFTeO3qC1qjSJvsGMZevcxb0TqYqD/S6vM29kiwpYa0qr 9KKYZ7vtpaSckPZDorQ7f5HX4ZXbEXgab4pA75EW9Lr7R84HS7QzXCmVFgk5a3gejxCu 3BYp2wY5GhXvcm95gASVCiQGY6thnMvXI0ZKg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=P62lP4eXoypXUgsw+C5rnuw/7KOcbV38gSVkU7ZRcuFuhI3+ESfDGVog96cTzfU+xS m9KDYiS334ch7chW7pydrM+lAmo84La6uormPlrpu1r6djiNddvu7U45YiWDIdi/I4f5 g0anA+pRkbaC+5w1tgM1FBxa/SmbRxZDyJLzw= Received: by 10.216.145.131 with SMTP id p3mr8853778wej.82.1300139187410; Mon, 14 Mar 2011 14:46:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.243.7 with HTTP; Mon, 14 Mar 2011 14:46:05 -0700 (PDT) From: Lennart Borgman Date: Mon, 14 Mar 2011 22:46:05 +0100 Message-ID: Subject: Please add a function to get files in *grep* To: Emacs Bugs Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.7 (----) For example something like this (which I just added to ourcomments-util.el in nXhtml) works now: (defun grep-grepped-file (pt) "Return grepped file at PT in a `grep-mode' buffer. The returned file name is relative." (let* ((msg (get-text-property (point) 'compilation-message)) (loc (when msg (compilation--message->loc msg))) (file (when loc (caar (compilation--loc->file-struct loc))))) file)) From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 14 22:16:54 2011 Received: (at 8252) by debbugs.gnu.org; 15 Mar 2011 02:16:54 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PzJoc-0001EH-NB for submit@debbugs.gnu.org; Mon, 14 Mar 2011 22:16:54 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PzJoa-0001E6-Ce for 8252@debbugs.gnu.org; Mon, 14 Mar 2011 22:16:52 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAPpofk1FxIRf/2dsb2JhbACmC3iIQQG6AoViBJVQ X-IronPort-AV: E=Sophos;i="4.62,320,1297054800"; d="scan'208";a="96526982" Received: from 69-196-132-95.dsl.teksavvy.com (HELO pastel.home) ([69.196.132.95]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 14 Mar 2011 22:16:46 -0400 Received: by pastel.home (Postfix, from userid 20848) id 4512158ED9; Mon, 14 Mar 2011 22:16:46 -0400 (EDT) From: Stefan Monnier To: Lennart Borgman Subject: Re: bug#8252: Please add a function to get files in *grep* Message-ID: References: Date: Mon, 14 Mar 2011 22:16:46 -0400 In-Reply-To: (Lennart Borgman's message of "Mon, 14 Mar 2011 22:46:05 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8252 Cc: 8252@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) Could you motivate your request? Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 15 05:32:08 2011 Received: (at 8252) by debbugs.gnu.org; 15 Mar 2011 09:32:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PzQbn-0003cY-Pn for submit@debbugs.gnu.org; Tue, 15 Mar 2011 05:32:07 -0400 Received: from mail-ey0-f172.google.com ([209.85.215.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PzQbl-0003c4-SF for 8252@debbugs.gnu.org; Tue, 15 Mar 2011 05:32:06 -0400 Received: by eye13 with SMTP id 13so112506eye.3 for <8252@debbugs.gnu.org>; Tue, 15 Mar 2011 02:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=s7XPRqYHzGeQhEphI3Pdnssc/Zc1tIfe5VT38mDT6x0=; b=XWmDdolbY6e0IKKI11kTX1y9XnoGXIOed/EBJIjBzbpa60ecEE/kEzEUVZTzsS4XO3 yd4o9eOXKBFXRBM+8BcJb76cGkEvpwMx+PM1ooiWkLoIXx7d6+eDZxmYdO+PNzMtbxdH aebo88gFkcRsNqjRTvNJ1ByDMML+xPWly3MB4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=BRWmgAbKpeIA2iv5jPPPqFcsGKz2vc1VwFwbIeiLfvGKFMVkOEuXmn4+XCUy9B3I3N 1fRDAL8Zsz/q2luQ1OuUDeQEK+tgnCtW0m/2PuX58fjmnFQl7hUohFLyteiadDk2icif jlcQ7z+Ugo0Q8SaPxn5GmP0LHsdKLKF3ORoJs= Received: by 10.213.25.79 with SMTP id y15mr3629011ebb.41.1300181520138; Tue, 15 Mar 2011 02:32:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.213.27.136 with HTTP; Tue, 15 Mar 2011 02:31:40 -0700 (PDT) In-Reply-To: References: From: Lennart Borgman Date: Tue, 15 Mar 2011 10:31:40 +0100 Message-ID: Subject: Re: bug#8252: Please add a function to get files in *grep* To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 8252 Cc: 8252@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) On Tue, Mar 15, 2011 at 3:16 AM, Stefan Monnier wrote: > Could you motivate your request? There can be a lot of uses for it. In my case I am using it for this: (defun grep-get-buffer-files () "Return list of files in a `grep-mode' buffer." (or (and (compilation-buffer-p (current-buffer)) (derived-mode-p 'grep-mode)) (error "Not in a grep buffer")) (let ((here (point)) files) (font-lock-fontify-buffer) (goto-char (point-min)) (while (not (eobp)) (let ((file (grep-grepped-file (point)))) (when file (add-to-list 'files file))) (forward-line)) (goto-char here) ;;(message "files=%s" files) files)) (defun grep-query-replace(from to &optional delimited) "Do `query-replace-regexp' of FROM with TO, on all files in *grep*. Third arg DELIMITED (prefix arg) means replace only word-delimited matches. If you exit (\\[keyboard-quit], RET or q), you can resume the query replace with the command \\[tags-loop-continue]. Must be called from a `grep-mode' buffer." (interactive (let ((common ;; Use the regexps that have been used in grep (let ((query-replace-from-history-variable 'grep-regexp-history) (query-replace-defaults (or grep-query-replace-defaults query-replace-defaults))) (unless (derived-mode-p 'grep-mode) (error "This command must be used in a grep output buffer")) (query-replace-read-args "Query replace regexp in grepped files" t t)))) (setq grep-query-replace-defaults (cons (nth 0 common) (nth 1 common))) (list (nth 0 common) (nth 1 common) (nth 2 common)))) (unless (derived-mode-p 'grep-mode) (error "This command must be used in a grep output buffer")) (dolist (file (grep-get-buffer-files)) (let ((buffer (get-file-buffer file))) (if (and buffer (with-current-buffer buffer buffer-read-only)) (error "File `%s' is visited read-only" file)))) (tags-query-replace from to delimited '(grep-get-buffer-files))) From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 17 10:55:11 2021 Received: (at 8252) by debbugs.gnu.org; 17 Jul 2021 14:55:11 +0000 Received: from localhost ([127.0.0.1]:54535 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4lig-000185-T4 for submit@debbugs.gnu.org; Sat, 17 Jul 2021 10:55:11 -0400 Received: from quimby.gnus.org ([95.216.78.240]:52420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4lic-00017K-B0 for 8252@debbugs.gnu.org; Sat, 17 Jul 2021 10:55:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=gDNftE/631MGGCzxgxce2QTe1YvRECJiUR5I5Km7Rzc=; b=P6GnNlGZq2IHawQE0Ee0+3KDZ+ /rHxRG8NUm1SJlU1Pg9Lv1uldzzHt6y2uefXKhT2NWro6kaHjqyJLmZHk3yLADq/ZwiNzS+UTfxJL IFMoKR5LONNpZ/nSYOIAorFcl+Ihh0vt9wqDQSCBeMAo5hSjmjX/uEfnVRY59ur6PBw0=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m4liT-0008Go-Bl; Sat, 17 Jul 2021 16:54:59 +0200 From: Lars Ingebrigtsen To: Lennart Borgman Subject: Re: bug#8252: Please add a function to get files in *grep* References: X-Now-Playing: Tarek Atoui's _Mort Aux Vaches_: "(untitled)" Date: Sat, 17 Jul 2021 16:54:56 +0200 In-Reply-To: (Lennart Borgman's message of "Mon, 14 Mar 2011 22:46:05 +0100") Message-ID: <877dhp3s8v.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Lennart Borgman writes: > For example something like this (which I just added to > ourcomments-util.el in nXhtml) works now: > > (defun grep-grepped-file (pt) > "Return grepped file at PT in a `grep-mode' buffer. > The retur [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 8252 Cc: 8252@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 (---) Lennart Borgman writes: > For example something like this (which I just added to > ourcomments-util.el in nXhtml) works now: > > (defun grep-grepped-file (pt) > "Return grepped file at PT in a `grep-mode' buffer. > The returned file name is relative." > (let* ((msg (get-text-property (point) 'compilation-message)) > (loc (when msg (compilation--message->loc msg))) > (file (when loc (caar (compilation--loc->file-struct loc))))) > file)) I think that sounds generally useful -- writing things on top of grep mode is quite popular, and it isn't obvious how to get at the file name (which is what people generally want). So I've added your function to Emacs 28 (with some minor tweaks) under the name `grep-file-at-point'. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 17 10:55:14 2021 Received: (at control) by debbugs.gnu.org; 17 Jul 2021 14:55:14 +0000 Received: from localhost ([127.0.0.1]:54537 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4lik-00018L-42 for submit@debbugs.gnu.org; Sat, 17 Jul 2021 10:55:14 -0400 Received: from quimby.gnus.org ([95.216.78.240]:52436) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4lig-00017j-7B for control@debbugs.gnu.org; Sat, 17 Jul 2021 10:55:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=IkauX2OxWVmULR7Ca5FHvPZV8WoEq2gYvOylzQMaDLw=; b=uX+Tn/1tD9HJvdruL/A8M046H5 VvOMY/4QkcE6R0uS6XZV7By4aYHgeeAIUlpJLPbFWz9cfu2p9BgX6PSMUGEhfz6ijlr8KfwpQCMKw en2txvQB4gzJMvEzU7AV66ukaBH9HxxQALLYZoVbh6fzr6zfQqQ74s+t9gr5FaBxSxv8=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m4liY-0008Gz-GR for control@debbugs.gnu.org; Sat, 17 Jul 2021 16:55:04 +0200 Date: Sat, 17 Jul 2021 16:55:02 +0200 Message-Id: <875yx93s8p.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #8252 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 8252 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 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: -3.3 (---) close 8252 28.1 quit From unknown Sun Jun 22 17:11:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 15 Aug 2021 11:24:05 +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