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: Juri Linkov
Subject: bug#39902: 28.0.50; Marking in dired with active region
Date: Tue, 24 Mar 2020 23:58:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

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

Typing `C-x SPC' shows an indication as a thin vertical bar highlighted
with the region face.  But `C-SPC' doesn't have the same subtle indication.

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

Thanks for the suggestion, now changed in master.





reply via email to

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