GNU bug report logs -
#31209
27.0.50; current-kill calls interprogram-paste-function more than once
Previous Next
Reported by: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Date: Wed, 18 Apr 2018 17:48:01 UTC
Severity: normal
Tags: fixed, patch
Found in version 27.0.50
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31209 in the body.
You can then email your comments to 31209 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31209
; Package
emacs
.
(Wed, 18 Apr 2018 17:48:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Basil L. Contovounesios" <contovob <at> tcd.ie>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 18 Apr 2018 17:48:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Under lexical-binding, I expect the following:
(let* ((i 0)
(kill-ring ())
(kill-ring-yank-pointer ())
(save-interprogram-paste-before-kill t)
(interprogram-paste-function
(lambda ()
(setq i (1+ i))
(list "a" "b" "c"))))
(current-kill 0)
(message "\
`interprogram-paste-function' called %d time(s)
`kill-ring' = %s"
i kill-ring))
to evaluate to:
‘interprogram-paste-function’ called 1 time(s)
‘kill-ring’ = (a b c)
but the actual result is:
‘interprogram-paste-function’ called 4 time(s)
‘kill-ring’ = (a a b c b a b c c a b c)
This behaviour is due to current-kill passing each string returned by
interprogram-paste-function to kill-new, which in turn calls
interprogram-paste-function when save-interprogram-paste-before-kill is
non-nil, and was introduced along with
save-interprogram-paste-before-kill [1: 4ed8c7aadb].
[1: 4ed8c7aadb]: 2009-08-26 20:55:39 +0000
(save-interprogram-paste-before-kill): New user option.
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=4ed8c7aadb59c8ae75641710e3d9ff5bddbbd952
Patch addressing this to follow.
Thanks,
--
Basil
In GNU Emacs 27.0.50 (build 6, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2018-04-18 built on thunk
Repository revision: 5dff4905d73d0d42447ff4b114d1af726a689c6a
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Debian GNU/Linux buster/sid
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31209
; Package
emacs
.
(Wed, 18 Apr 2018 17:53:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 31209 <at> debbugs.gnu.org (full text, mbox):
[0001-Do-not-call-interprogram-paste-function-repeatedly.patch (text/x-diff, attachment)]
[0002-Improve-kill-related-documentation-bug-31209.patch (text/x-diff, attachment)]
[Message part 3 (text/plain, inline)]
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:
> Patch addressing this to follow.
I attach two patches.
The first makes current-kill disable interprogram-paste-function in
addition to interprogram-cut-function before calling kill-new.
The second suggests potential clarifications in related documentation,
both in '(elisp) Low-Level Kill Ring' and simple.el docstrings.
Hopefully someone can further improve upon these.
Thanks,
--
Basil
Added tag(s) patch.
Request was from
"Basil L. Contovounesios" <contovob <at> tcd.ie>
to
control <at> debbugs.gnu.org
.
(Wed, 18 Apr 2018 17:55:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31209
; Package
emacs
.
(Wed, 18 Apr 2018 18:59:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 31209 <at> debbugs.gnu.org (full text, mbox):
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:
> The second suggests potential clarifications in related documentation,
> both in '(elisp) Low-Level Kill Ring' and simple.el docstrings.
> Hopefully someone can further improve upon these.
I just noticed one more thing. The docstring of
interprogram-paste-function ends with:
Note that the function should return a string only if a program
other than Emacs has provided a string for pasting; if Emacs
provided the most recent string, the function should return nil.
If it is difficult to tell whether Emacs or some other program
provided the current string, it is probably good enough to return
nil if the string is equal (according to `string=') to the last
^^^^^^^
text Emacs provided.
Would equal-including-properties (as per kill-do-not-save-duplicates) be
more accurate here, or is string= fine?
--
Basil
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31209
; Package
emacs
.
(Wed, 25 Apr 2018 11:57:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 31209 <at> debbugs.gnu.org (full text, mbox):
tags 31209 fixed
close 31209 27.1
quit
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:
> The first makes current-kill disable interprogram-paste-function in
> addition to interprogram-cut-function before calling kill-new.
Pushed to master [1: 532f5fb387].
> The second suggests potential clarifications in related documentation,
> both in '(elisp) Low-Level Kill Ring' and simple.el docstrings.
> Hopefully someone can further improve upon these.
Pushed to emacs-26 [2: 343d70b10e].
[1: 532f5fb387]: 2018-04-25 07:37:32 -0400
Do not call interprogram-paste-function repeatedly
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=532f5fb3877ccd535a822f7c3c08d396621b4325
[2: 343d70b10e]: 2018-04-24 20:58:15 -0400
Improve kill-related documentation (bug#31209)
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=343d70b10edbd42ebe49ada3a8ef878b2ee044f0
> I just noticed one more thing. The docstring of
> interprogram-paste-function ends with:
>
> Note that the function should return a string only if a program
> other than Emacs has provided a string for pasting; if Emacs
> provided the most recent string, the function should return nil.
> If it is difficult to tell whether Emacs or some other program
> provided the current string, it is probably good enough to return
> nil if the string is equal (according to `string=') to the last
> ^^^^^^^
> text Emacs provided.
>
> Would equal-including-properties (as per kill-do-not-save-duplicates) be
> more accurate here, or is string= fine?
I guess if we're talking about strings coming from other programs,
properties are unlikely to show up.
Added tag(s) fixed.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Wed, 25 Apr 2018 11:57:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.1, send any further explanations to
31209 <at> debbugs.gnu.org and "Basil L. Contovounesios" <contovob <at> tcd.ie>
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Wed, 25 Apr 2018 11:57:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 24 May 2018 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 337 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.