unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Visuwesh <visuweshm@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 55692@debbugs.gnu.org
Subject: bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse
Date: Sun, 29 May 2022 13:40:20 +0530	[thread overview]
Message-ID: <87y1yk7o9f.fsf@gmail.com> (raw)
In-Reply-To: <837d64ltka.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 29 May 2022 09:52:05 +0300")

[ஞாயிறு மே 29, 2022] Eli Zaretskii wrote:

>> From: Visuwesh <visuweshm@gmail.com>
>> Cc: 55692@debbugs.gnu.org
>> Date: Sun, 29 May 2022 11:47:32 +0530
>> 
>> [சனி மே 28, 2022] Eli Zaretskii wrote:
>> 
>> > IMO, we shouldn't distinguish between the mouse and shift-selection
>> > methods of defining the region.  So this feature, if accepted, should
>> > also treat both methods of defining the region the same.
>> 
>> Considering shift-selection would be convenient as well.  Please check
>> attached patch.
>
> Thanks.
>
>> +@vindex delete-selection-temporary-regions-only
>
> I'd drop the "-only" part: it is not necessary, and makes the variable
> name longer.
>

Okay, will do.

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

>> @@ -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?  When the defcustom is t, we could have it check for '(only
. ...)' and the value 'lambda', no?

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

I will send an updated patch a bit later.  Thanks.





  reply	other threads:[~2022-05-29  8:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-28 17:33 bug#55692: 29.0.50; delete-selection-mode: Replace region only if set using the mouse Visuwesh
2022-05-28 19:10 ` Eli Zaretskii
2022-05-29  6:17   ` Visuwesh
2022-05-29  6:52     ` Eli Zaretskii
2022-05-29  8:10       ` Visuwesh [this message]
2022-05-29  9:04         ` Eli Zaretskii
2022-05-29 14:53           ` Visuwesh
2022-05-29 17:10             ` Eli Zaretskii
2022-05-31 10:44               ` Visuwesh
2022-05-31 14:33                 ` Drew Adams
2022-06-01 16:04                 ` Eli Zaretskii
2022-06-01 17:03                   ` Visuwesh
2022-09-06 10:59                     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1yk7o9f.fsf@gmail.com \
    --to=visuweshm@gmail.com \
    --cc=55692@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).