bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#39902: 28.0.50; Marking in dired with active region


From: Drew Adams
Subject: bug#39902: 28.0.50; Marking in dired with active region
Date: Sun, 22 Mar 2020 16:33:56 -0700 (PDT)

> > Here is a complete implementation, please try if it works for you:
> 
> Yes, works well, thank you very much.  Also other marking commands seem
> to work well with the new option.
> 
> The docstring of `dired-mark-inclusive' should be enhanced a bit I
> think.  You could add one sentence about what "inclusive" means, and
> another saying that other (un-)marking commands are also covered.

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.)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]