GNU bug report logs - #42865
28.0.50; Add new 'copy-region-quietly' defcustom

Previous Next

Package: emacs;

Reported by: Sean Whitton <spwhitton <at> spwhitton.name>

Date: Fri, 14 Aug 2020 17:39:01 UTC

Severity: normal

Tags: patch

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 42865 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 42865 <at> debbugs.gnu.org, Sean Whitton <spwhitton <at> spwhitton.name>
Subject: Re: bug#42865: 28.0.50; Add new 'copy-region-quietly' defcustom
Date: Wed, 19 Aug 2020 04:16:58 +0300
>> +(defcustom copy-region-quietly nil
>> +  "Whether the copying of an inactive region is indicated visually.
>> +If nil, behave as per the documentation of `indicate-copied-region'.
>> +`no-swap' means inhibit briefly swapping point and mark.
>> +`no-message' means inhibit displaying a message.
>> +Any other value means inhibit both swapping and message-displaying."
>> +  :type '(choice :tag "Copy region quietly"
>> +                 (const :tag "Default behavior" nil)
>> +                 (const :tag "Don't swap point and mark" no-swap)
>> +                 (const :tag "Don't display a message" no-message)
>> +                 (const
>> +                  :tag
>> +                  "Don't swap point and mark or display a message"
>> +                  t))
>> +  :group 'killing)
>
> Thanks for the patch.
>
> The change looks reasonable to me, but I'm not quite sure of how useful
> this is.  Does many people want to tweak the behaviour of this command
> to this extent?
>
> Perhaps somebody else on the bug tracker has opinions here.

When I needed to customize the behaviour of 'indicate-copied-region',
I relied on advice-add like this:

(advice-add 'kill-ring-save :after
            (lambda (&rest _args)
              (let ((text (substring-no-properties (current-kill 0))))
                (message "Copied text \"%s\""
                         ;; Don't show newlines literally
                         (query-replace-descr
                          (if (> (length text) 64)
                              (concat (substring text 0 64) "..." (substring text -16))
                            text)))))
            '((name . indicate-copied-region)))

that tries to fix the problem of multi-line messages that abruptly changes
the window configuration by resizing the echo area after text copying.
This problem is caused by the fact that 'indicate-copied-region' displays
the constant number of copied characters, including newlines.

Regarding a new option to disable such messages at all, it seems this is
a more general question because AFAIR, in the past, users asked for a way
to disable messages for many other commands, such as "Wrote ..." of 'save-buffer',
etc.

Maybe there should be a new feature allowing to disable messages selectively
for different commands?  Maybe just by putting a symbol property on the
command symbol.

Regarding disabling the "swapping point and mark" feature: since
'indicate-copied-region' uses 'blink-matching-delay', shouldn't this
behaviour be disabled by the existing option 'blink-matching-paren-on-screen'
in 'indicate-copied-region' as well (in addition to 'blink-matching-open'
where it's used originally)?




This bug report was last modified 3 years and 329 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.