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: Mon, 23 Mar 2020 08:09:47 -0700 (PDT)

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

Yes, that's what I was hinting at: an empty
region should always be ignored, i.e., that case
should be treated as if the region were not
active.

A better way to do it than binding that variable
(even if it were _not_ a user option) is to just
do what one would have done before `use-region-p'
was defined:

(if (and (region-active-p)
         (> (region-end) (region-beginning)))
    ...

Really, `use-region-p', although convenient, is
error prone.  Few use cases really call for
being able to use an empty region (non-nil
`use-empty-active-region'), and code that deals
with the region is much clearer if it says
explicitly what it intends for an empty region.





reply via email to

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