[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#55692: 29.0.50; delete-selection-mode: Replace region only if set us
From: |
Visuwesh |
Subject: |
bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse |
Date: |
Sun, 29 May 2022 20:23:49 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
[ஞாயிறு மே 29, 2022] Eli Zaretskii wrote:
>> From: Visuwesh <visuweshm@gmail.com>
>> Cc: 55692@debbugs.gnu.org
>> Date: Sun, 29 May 2022 13:40:20 +0530
>>
>> >> By default, text insertion occurs normally even if the mark is
>> >> active---for example, typing @kbd{a} inserts the character @samp{a},
>> >> then deactivates the mark. Delete Selection mode, a minor mode,
>> >> modifies this behavior: if you enable that mode, then inserting text
>> >> while the mark is active causes the text in the region to be deleted
>> >> -first. To toggle Delete Selection mode on or off, type @kbd{M-x
>> >> -delete-selection-mode}.
>> >> +first. If you want to replace only temporary regions, set by
>> >> +mouse-dragging or shift-selection, then change the variable
>> >
>> > There should be cross-references here to where these methods are
>> > described in the manual.
>> >
>>
>> These methods as in "mouse-dragging" or "shift-selection". I'm afraid I
>> don't fully understand what you mean.
>
> I mean to add @xref or @pxref to the places in the manual where mouse
> selection and shift-selection are described. Those places are,
> respectively, the nodes "Setting Mark" and "Shift Selection".
>
Done.
>> >> @@ -251,6 +259,10 @@ delete-selection-pre-hook
>> >> have this property won't delete the selection.
>> >> See `delete-selection-helper'."
>> >> (when (and delete-selection-mode (use-region-p)
>> >> + (if delete-selection-temporary-regions-only
>> >> + (and (consp transient-mark-mode)
>> >> + (eq (car transient-mark-mode) 'only))
>> >> + t)
>> >
>> > I wonder whether we should also optionally allow replacing text in
>> > regions activated by "C-u C-x C-x" when transient-mark-mode is off.
>> > Those cause transient-mark-mode to have the value 'lambda', not
>> > '(only...)'. So maybe the new defcustom should be a tristate, not a
>> > boolean?
>> >
>>
>> Sure, that could be useful. But I have transient-mark-mode turned on
>> always so I can't comment much on it. However, what would the third
>> state be?
>
> Some symbol.
>
>> When the defcustom is t, we could have it check for '(only . ...)'
>> and the value 'lambda', no?
>
> Yes, we could have:
>
> . nil - always replace the region
> . t - replace region from mouse, shift-selection, and "C-u C-x C-x"
> . selection - only replace region from mouse and shift-selection
>
Done.
>> > Also, can we have the above condition in a more elegant form? In
>> > general, whenever you have something like
>> >
>> > (if SOMETHING foo t)
>> >
>> > it begs to be rewritten so the "t" part is not needed, because 'if'
>> > itself already returns a boolean value.
>>
>> Sure. I will factor out the condition into a separate function. Is
>> that more elegant?
>
> No, that's overkill. I meant that if you need an 'if' to return t or
> something else, you could instead make it return nil or something
> else, as in
>
> (if SOMETHING foo)
>
> and reverse the condition.
>
> But if you still don't understand, just forget this comment.
I don't think I fully understood what you meant but I took a shot at it
anyway. Please review updated patch.
0001-delete-selection-mode-Add-user-option-to-delete-temp.patch
Description: Text Data
- bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse, Visuwesh, 2022/05/28
- bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse, Eli Zaretskii, 2022/05/28
- bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse, Visuwesh, 2022/05/29
- bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse, Eli Zaretskii, 2022/05/29
- bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse, Visuwesh, 2022/05/29
- bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse, Eli Zaretskii, 2022/05/29
- bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse,
Visuwesh <=
- bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse, Eli Zaretskii, 2022/05/29
- bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse, Visuwesh, 2022/05/31
- bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse, Drew Adams, 2022/05/31