From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#39902: 28.0.50; Marking in dired with active region Date: Mon, 23 Mar 2020 02:43:33 +0200 Organization: LINKOV.NET Message-ID: <87a747zyru.fsf@mail.linkov.net> References: <87d09suras.fsf@web.de> <8736aiqu3y.fsf@mail.linkov.net> <7a0a6f19-f958-4b38-beaf-3d60dc8a279f@default> <87d09lb1ts.fsf@mail.linkov.net> <87a74n4vet.fsf@web.de> <87eetzah2s.fsf@mail.linkov.net> <87zhcn9229.fsf@mail.linkov.net> <6d82d04a-db94-4df4-82cc-3ea13a78a4dd@default> <877dzqidzn.fsf@mail.linkov.net> <1e37a524-80d3-445f-8f81-a18539105ac3@default> <87pndhhyvk.fsf@mail.linkov.net> <1ce62594-cc2a-4e95-b2b3-d022fa65decd@default> <87bloybivx.fsf@mail.linkov.net> <0066d43a-5f97-4c9d-a4b7-84c6b0ecf356@default> <87bloxgp9g.fsf@mail.linkov.net> <8736a7ajn5.fsf@web.de> <87fte52pbf.fsf@mail.linkov.net> <87o8sruchv.fsf@mail.linkov.net> <875zexf6l3.fsf@web.de> <4dd30e49-9a6a-4962-a6f2-1a68a41ce5e2@default> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="122552"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: Michael Heerdegen , 39902@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 23 01:53:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jGBL7-000Vk3-Ke for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 23 Mar 2020 01:53:13 +0100 Original-Received: from localhost ([::1]:55978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGBL6-0000L2-Iu for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Mar 2020 20:53:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41118) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGBKx-0000KL-Uf for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2020 20:53:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGBKw-0006SH-Qc for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2020 20:53:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45267) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jGBKw-0006SB-Nm for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2020 20:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jGBKw-0004Jt-Nc for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2020 20:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Mar 2020 00:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39902 X-GNU-PR-Package: emacs Original-Received: via spool by 39902-submit@debbugs.gnu.org id=B39902.158492475616557 (code B ref 39902); Mon, 23 Mar 2020 00:53:02 +0000 Original-Received: (at 39902) by debbugs.gnu.org; 23 Mar 2020 00:52:36 +0000 Original-Received: from localhost ([127.0.0.1]:51239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jGBKW-0004Is-Do for submit@debbugs.gnu.org; Sun, 22 Mar 2020 20:52:36 -0400 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:36859) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jGBKU-0004IP-Ku for 39902@debbugs.gnu.org; Sun, 22 Mar 2020 20:52:35 -0400 X-Originating-IP: 91.129.96.173 Original-Received: from mail.gandi.net (m91-129-96-173.cust.tele2.ee [91.129.96.173]) (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id EFE9DC0006; Mon, 23 Mar 2020 00:52:27 +0000 (UTC) In-Reply-To: <4dd30e49-9a6a-4962-a6f2-1a68a41ce5e2@default> (Drew Adams's message of "Sun, 22 Mar 2020 16:33:56 -0700 (PDT)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177636 Archived-At: > I took a quick look - didn't check much. > > Seems OK to me too (but I'd prefer a non-nil default > value for the option, as already mentioned). > > --- > > However, I notice one thing that seems like a bug > (didn't notice it before) - and the bug is present even > without the patch: > > If `use-empty-active-region' is non-nil, and the region > is empty, then `m' marks the current line only sometimes, > depending on where point is. And the behavior differs, > depending on the value of option `dired-mark-inclusive': > > `dired-mark-inclusive' = nil: > > marks line only if point is on the 2nd file-name > char or any char after that (including eol, i.e., > _after_ the file name) > > `dired-mark-inclusive' = t: > > marks only if point is not at bol > > IMO, the behavior should be the same, regardless of > the cursor position on the line. I think it should > mark the line: > > * for any position, if `dired-mark-inclusive' = t > * for any position on the file name, otherwise > > Juri, you decide the behavior for the nil case, but > I think it should be consistent. Personally, I see > no reason that point on the first file-name char > would act differently from point on the second. And > by the logic of non-inclusive I'd think that an empty > region _after_ the file name wouldn't mark the line > (no part of the file name is in the region). > > For the non-nil case, I think it's important that the > line get marked even when point is at bol. > > Why? Consistency. And it's easy to hit `C-SPC' > without realizing that you've done so - there's no > good visual signal (just the "Mark activated" msg). > > In the non-nil case, especially, I really feel that > a user expects the line to be marked, even if the > region is empty (when `use-empty-active-region' is > non-nil). > > --- > > As I said earlier, I really suspect that Emacs may > have lurking bugs because stuff that makes use of > `use-region-p' might not get tested with non-nil > `use-empty-active-region'. And yet the reason for > creating that option was for the addition of that > function (or vice versa). > > [Frankly, I think things were clearer in the code > before `use-region-p' and that option were added. > `region-active-p' was clear; `use-region-p' hides > use of an option, and I suspect that the non-nil > case doesn't get tested much. When just > `region-active-p' was used, it kinda invited testing > whether the region was empty.] > > (FWIW, I don't use non-nil `use-empty-active-region'. > But I imagine some people do.) Sorry, I received your message only after I pushed to master. But nonetheless, your test cases should be handled carefully. The simplest solution would be just to disallow the option `use-empty-active-region' to use the empty region in Dired, i.e. instead of (if (use-region-p) ... then mark files in the active region ... to use (if (let ((use-empty-active-region nil)) (use-region-p)) ... then mark files in the active region ...