From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73635: dired-do-query-replace-regexp should check if files are selected first Date: Sat, 26 Oct 2024 09:59:39 +0300 Message-ID: <867c9vbb8k.fsf@gnu.org> References: <87frpbb4cn.3.fsf@jidanni.org> <87v7y7b2mn.fsf@gmail.com> <865xpomv7y.fsf@gnu.org> <878qubsvcl.3.fsf@jidanni.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36820"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73635@debbugs.gnu.org, visuweshm@gmail.com To: Dan Jacobson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 26 09:00:52 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t4an6-0009Tt-8b for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Oct 2024 09:00:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t4amo-0002Gr-40; Sat, 26 Oct 2024 03:00:34 -0400 Original-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 1t4amk-0002Ga-Cj for bug-gnu-emacs@gnu.org; Sat, 26 Oct 2024 03:00:32 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t4amj-0000fM-Fs for bug-gnu-emacs@gnu.org; Sat, 26 Oct 2024 03:00:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=U/rUb4qLVKDoihu7W2eXR8KZK3Hlho8y7kKejogugdI=; b=RWmYfjEvaQc+gzwr6/5drvD+5jCaJxl6vIYw23CzhNo6lGd8BhOxZHt2QBVIBNqw2BvvWMTZsn9kSSqdpA3zN8e+gfIus5l0/UH3Cqg0hazBtnNXpwPfjdww7LSsLY23SYZ09DmMf9W4GLKOT6bmFzJs0AuVAf+MYH9osIgup0xZWXaowf/6hHaI6oWMxhQFURAEWwziG0Bajxyav0oz/XpxtYQa0873f/Jc+l66nZUPuRMpUIizhF8n7qjzHCkMSDliFvCIGWbVPMny7DlAuL+Sut+8QvRla08y2KZ/74mhhb8o7p3GAXjVGv3YEKROoVsy2ZdXlxT1GMBn/LsQBw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t4anG-00048N-8g for bug-gnu-emacs@gnu.org; Sat, 26 Oct 2024 03:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Oct 2024 07:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73635 X-GNU-PR-Package: emacs Original-Received: via spool by 73635-submit@debbugs.gnu.org id=B73635.172992602315470 (code B ref 73635); Sat, 26 Oct 2024 07:01:02 +0000 Original-Received: (at 73635) by debbugs.gnu.org; 26 Oct 2024 07:00:23 +0000 Original-Received: from localhost ([127.0.0.1]:40400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4amd-00041R-5g for submit@debbugs.gnu.org; Sat, 26 Oct 2024 03:00:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:50284) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4ama-00041A-UH for 73635@debbugs.gnu.org; Sat, 26 Oct 2024 03:00:21 -0400 Original-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 1t4aly-0000Pd-FW; Sat, 26 Oct 2024 02:59:42 -0400 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=U/rUb4qLVKDoihu7W2eXR8KZK3Hlho8y7kKejogugdI=; b=Ve5wAeEpbClS GEeLIuf/J47fsYBvFLT1nLI43z0YdlNI83sixfda1OEHVnVnMGlJoxqwsIIoYE4yDT7vuWUOviBLu JEuzfXwPzoMtT1KDEqMX1bc7Rdg4CPKcMprJ7MZ+yT00S02amdFpwPvEk9ZlZD1wmKPNnP4Er6bmL +1j+npf4IYb5yUEeeZyKwVxtTcH4OjrwbjFCUsMz4jtx4PAhbIrHVrIhJxG9gevfVM+7ERDhaaFid hA9dva92vtWkSlN73TUWR2fu6sQlEGrZ7GVF0CzeqAvqN0yADr6Rb+PfoGPHsJAYXe2WCVB3cXIC3 6udcNJcP1aZmffLLojIihw==; In-Reply-To: <878qubsvcl.3.fsf@jidanni.org> (message from Dan Jacobson on Sat, 26 Oct 2024 05:53:14 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294254 Archived-At: > From: Dan Jacobson > Cc: Visuwesh , 73635-done@debbugs.gnu.org > Date: Sat, 26 Oct 2024 05:53:14 +0800 > > >> > E.g., yes there were files selected, but we just did a first run, and > >> > are no longer looking at the dired buffer. We need to go back to the > >> > dired buffer first. Fine. But at least let the user know before they > >> > bother entering the from and to values. > >> > >> It uses the filename under point if there are no marked files like all > >> dired commands. > > EZ> Right, and so I think there's no bug here to fix, and I'm therefore > EZ> closing it. > > There is no check that the user is staring at the dired buffer first > before asking for the two strings. When this command is invoked, it prompts thusly: Query replace regexp in marked files: Which already says that files should be marked before they could be query-replaced. > In fact what needs to be changed is: > dired-do-query-replace-regexp needs to first check if the current buffer > is a dired buffer. That already happens if you invoke with "M-X" (capital X) or if you customize read-extended-command-predicate to command-completion-default-include-p. We just decided not to make that the default yet. > And if it is not, it needs to say "Must be run in a dired buffer" and > quit. > > (Even if there is only one dired buffer in buffer-list.) I see no reason to complicate the command to cover such made-up scenarios. If and when we decide to make command-completion-default-include-p the default, this will happen automatically.