unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31209: 27.0.50; current-kill calls interprogram-paste-function more than once
@ 2018-04-18 17:47 Basil L. Contovounesios
  2018-04-18 17:52 ` Basil L. Contovounesios
  0 siblings, 1 reply; 4+ messages in thread
From: Basil L. Contovounesios @ 2018-04-18 17:47 UTC (permalink / raw)
  To: 31209

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-25 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-18 17:47 bug#31209: 27.0.50; current-kill calls interprogram-paste-function more than once Basil L. Contovounesios
2018-04-18 17:52 ` Basil L. Contovounesios
2018-04-18 18:58   ` Basil L. Contovounesios
2018-04-25 11:56   ` Noam Postavsky

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